[PATCH v1 05/17] selftests/nolibc: stat_timestamps: remove procfs dependency

From: Zhangjin Wu
Date: Wed Jun 21 2023 - 08:59:53 EST


Since it is not really necessary to use /proc/self here, instead of
adding a condition check, we use the always existing '/' path instead of
/proc/self, this eventually let it work without procfs.

Signed-off-by: Zhangjin Wu <falcon@xxxxxxxxxxx>
---
tools/testing/selftests/nolibc/nolibc-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index ebec948ec808..2ef44176f7a9 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -520,7 +520,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("/", &st))
return 1;

if (st.st_atim.tv_sec != st.st_atime || st.st_atim.tv_nsec > 1000000000)
--
2.25.1