Testing statx syscall Timestamp fields
PATCH v4 1/1 Testing statx syscall Timestamp fields
The time before and after the execution of the corresponding system call is noted.
It is checked whether the time returned by statx lies in this range.
open syscall with O_CREAT flag for birth time.
write syscall for modified time.
read syscall for access time.
chmod syscall for status change time.
Signed-off-by Subash Ganesan <[email protected]>
Signed-off-by Vaishnavi.D <[email protected]>
--- include/tst_safe_clocks.h | 38 +++++++ runtest/syscalls | 1 + testcases/kernel/syscalls/statx/.gitignore | 2 + testcases/kernel/syscalls/statx/Makefile | 4 + testcases/kernel/syscalls/statx/statx06.c | 174 +++++++++++++++++++++++++++++ 5 files changed, 219 insertions(+) create mode 100644 include/tst_safe_clocks.h create mode 100644 testcases/kernel/syscalls/statx/statx06.c
include/tst_safe_clocks.h new file +38 -0
@@ -0,0 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 or later +/* +* Copyright (c) Zilogic Systems Pvt. Ltd., 2018 +* Email : [email protected] +*/ + +#include <time.h> +#include "tst_test.h" + +static inline void safe_clock_getres (const char *file,const int lineno, +clockid_t clk_id,struct timespec *res) +{ +int rval; + + rval =clock_getres (clk_id, res); +if (rval !=0 ) +tst_brk (TBROK |TERRNO , +"%s:%d clock_getres() failed" , file, lineno); + +} + +static inline void safe_clock_gettime (const char *file,const int lineno, +clockid_t clk_id,struct timespec *tp) +{ +int rval; + + rval =clock_gettime (clk_id, tp); +if (rval !=0 ) +tst_brk (TBROK |TERRNO , +"%s:%d clock_gettime() failed" , file, lineno); +} + +#define SAFE_CLOCK_GETRES (clk_id, res)\ + safe_clock_getres(__FILE__, __LINE__, (clk_id), (res)) + +#define SAFE_CLOCK_GETTIME (clk_id, tp)\ + safe_clock_gettime(__FILE__, __LINE__, (clk_id), (tp)) +
runtest/syscalls +1 -0
@@ -1514,3 +1514,4 @@ statx02 statx02 statx03 statx03 statx04 statx04 statx05 statx05 +statx06 statx06
testcases/kernel/syscalls/statx/.gitignore +2 -0
@@ -3,3 +3,5 @@ /statx03 /statx04 /statx05 +/statx06 +
testcases/kernel/syscalls/statx/Makefile +4 -0
@@ -24,3 +24,7 @@ include $(top_srcdir)/include/mk/testcases.mk %_64: CPPFLAGS += -D_FILE_OFFSET_BITS=64 include $(top_srcdir)/include/mk/generic_leaf_target.mk + +statx06: LDLIBS += -lrt + +
testcases/kernel/syscalls/statx/statx06.c new file +174 -0
174 lines not on this page · raw message
Signature · 1 line
2.11.0
PATCH v4 1/1 Testing statx syscall Timestamp fields
Hi!
Pushed with minor changes, thanks.
* Changed the tst_test structure to pass -I 256 instead of specifying minimal size for the image
* Removed additional \n from the TPASS message
Signature · 2 lines
Cyril Hrubis [email protected]