Skip to content

Commit

Permalink
selftests/nolibc: stat_timestamps: remove procfs dependency
Browse files Browse the repository at this point in the history
'/proc/self/' is a good path which doesn't have stale time info but it
is only available for CONFIG_PROC_FS=y.

When CONFIG_PROC_FS=n, use argv0 instead of '/proc/self', use '/' for the
worst case.

Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
Signed-off-by: Willy Tarreau <w@1wt.eu>
  • Loading branch information
Zhangjin Wu authored and Willy Tarreau committed Aug 23, 2023
1 parent 38fc0a3 commit f576d3c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/testing/selftests/nolibc/nolibc-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ static int test_stat_timestamps(void)
if (sizeof(st.st_atim.tv_sec) != sizeof(st.st_atime))
return 1;

if (stat("/proc/self/", &st))
if (stat("/proc/self/", &st) && stat(argv0, &st) && stat("/", &st))
return 1;

if (st.st_atim.tv_sec != st.st_atime || st.st_atim.tv_nsec > 1000000000)
Expand Down

0 comments on commit f576d3c

Please sign in to comment.