Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix usage of FILE in unit test fapi-io #2423

Merged

Conversation

williamcroberts
Copy link
Member

The unit test had a static FILE structure used to pass to stdio FILE * routines as a dummy value to indicate to use the __real_xxx variant of the mocked function. This doesn't work when FILE is opaque as the compiler cannot figure out how much storage space is needed for a FILE struct.

Fix this by passing a dummy pointer to a data type the compiler knows about and casting it to FILE pointer.

Fixes: #2419

Signed-off-by: William Roberts william.c.roberts@intel.com

William Roberts added 2 commits September 27, 2022 12:14
Fixes:
pkg update -f
Updating FreeBSD repository catalogue...
Fetching meta.conf: . done
Fetching packagesite.pkg: .......... done
Processing entries:
Newer FreeBSD version for package zziplib:
To ignore this error set IGNORE_OSVERSION=yes
- package: 1301000
- running kernel: 1300139
Ignore the mismatch and continue? [y/N]: pkg: repository FreeBSD contains packages for wrong OS version: FreeBSD:13:amd64
Processing entries... done

Signed-off-by: William Roberts <william.c.roberts@intel.com>
The unit test had a static FILE structure used to pass to stdio FILE *
routines as a dummy value to indicate to use the __real_xxx variant of
the mocked function. This doesn't work when FILE is opaque as the
compiler cannot figure out how much storage space is needed for a FILE
struct.

Fix this by passing a dummy pointer to a data type the compiler knows
about and casting it to FILE pointer.

Fixes: tpm2-software#2419

Signed-off-by: William Roberts <william.c.roberts@intel.com>
@codecov
Copy link

codecov bot commented Sep 27, 2022

Codecov Report

Merging #2423 (6ee0ecd) into 3.2.x (93c2dbe) will increase coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##            3.2.x    #2423      +/-   ##
==========================================
+ Coverage   83.41%   83.43%   +0.02%     
==========================================
  Files         349      349              
  Lines       37722    37722              
==========================================
+ Hits        31465    31474       +9     
+ Misses       6257     6248       -9     
Impacted Files Coverage Δ
src/tss2-fapi/ifapi_policy_callbacks.c 85.41% <0.00%> (+1.56%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@williamcroberts williamcroberts merged commit bda2225 into tpm2-software:3.2.x Sep 27, 2022
@williamcroberts williamcroberts deleted the fix-FILE-musl-3.2.x branch September 27, 2022 18:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant