1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-30 16:33:41 +02:00

tests: Add wraps for __xstat/__fxstat variants of stat/fstat

__xstat and __fxstat variants of stat/fstat are invoked under
chromium chroot. For all existing tests it is sufficient for
stat/fstat to "do nothing, return 0", so new wraps do just that.

Test which needs __xstat: linux_mtd lifecycle.

Tests which need __fxstat:
read_chip_test_success
read_chip_with_dummyflasher_test_success
write_chip_test_success
write_chip_with_dummyflasher_test_success

Without this patch tests above fail under chromium chroot.

BUG=b:181803212
TEST=running tests on three different environments,
1) stat64/fstat64 (ninja tests in upstream tree)
2) stat64/fstat64 (ninja tests in chromium tree)
2) __xstat64/__fxstat64 (emerge with tests in chromium tree)

Change-Id: I4c5c243acde09dc5bb6b2a14042fcd23a49707db
Signed-off-by: Anastasia Klimchuk <aklm@chromium.org>
Reviewed-on: https://review.coreboot.org/c/flashrom/+/58103
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Edward O'Callaghan <quasisec@chromium.org>
This commit is contained in:
Anastasia Klimchuk 2021-10-05 15:59:06 +11:00 committed by Nico Huber
parent 7692a2ee78
commit 421d9133bb
2 changed files with 28 additions and 0 deletions

View File

@ -46,8 +46,12 @@ mocks = [
'-Wl,--wrap=fflush', '-Wl,--wrap=fflush',
'-Wl,--wrap=stat', '-Wl,--wrap=stat',
'-Wl,--wrap=stat64', '-Wl,--wrap=stat64',
'-Wl,--wrap=__xstat',
'-Wl,--wrap=__xstat64',
'-Wl,--wrap=fstat', '-Wl,--wrap=fstat',
'-Wl,--wrap=fstat64', '-Wl,--wrap=fstat64',
'-Wl,--wrap=__fxstat',
'-Wl,--wrap=__fxstat64',
'-Wl,--wrap=fileno', '-Wl,--wrap=fileno',
'-Wl,--wrap=fsync', '-Wl,--wrap=fsync',
'-Wl,--wrap=fread', '-Wl,--wrap=fread',

View File

@ -154,6 +154,18 @@ int __wrap_stat64(const char *path, void *buf)
return 0; return 0;
} }
int __wrap___xstat(const char *path, void *buf)
{
LOG_ME;
return 0;
}
int __wrap___xstat64(const char *path, void *buf)
{
LOG_ME;
return 0;
}
int __wrap_fstat(int fd, void *buf) int __wrap_fstat(int fd, void *buf)
{ {
LOG_ME; LOG_ME;
@ -166,6 +178,18 @@ int __wrap_fstat64(int fd, void *buf)
return 0; return 0;
} }
int __wrap___fxstat(int fd, void *buf)
{
LOG_ME;
return 0;
}
int __wrap___fxstat64(int fd, void *buf)
{
LOG_ME;
return 0;
}
char *__wrap_fgets(char *buf, int len, FILE *fp) char *__wrap_fgets(char *buf, int len, FILE *fp)
{ {
LOG_ME; LOG_ME;