select: tests offer choice of syscall path:
PATCH 1/1 select: tests offer choice of syscall path:
Switch between libc library, __newselect syscall, select syscall or pselect6 syscall for selection of select() tests. This provides filled in coverage of all the possible select alternatives.
CC flags can be one of:
-DSYSCALL_SELECT_LIBC // use select() libc library function -DSYSCALL_SELECT__NEWSELECT // use __NR__newselect system call -DSYSCALL_SELECT_SELECT // use __NR_select system call -DSYSCALL_SELECT_PSELECT6 // use __NR_pselect6 system call worker <default> // chose a _defined_ system call
--- testcases/kernel/syscalls/select/.gitignore | 12 ++ testcases/kernel/syscalls/select/Makefile | 22 ++++ testcases/kernel/syscalls/select/select.h | 130 ++++++++++++++++++++ testcases/kernel/syscalls/select/select01.c | 7 +- testcases/kernel/syscalls/select/select02.c | 5 +- testcases/kernel/syscalls/select/select03.c | 7 +- testcases/kernel/syscalls/select/select04.c | 5 +- 7 files changed, 174 insertions(+), 14 deletions(-) create mode 100644 testcases/kernel/syscalls/select/select.h
testcases/kernel/syscalls/select/.gitignore +12 -0
@@ -1,4 +1,16 @@ /select01 +/select01_SYS__newselect +/select01_SYS_select +/select01_SYS_pselect6 /select02 +/select02_SYS__newselect +/select02_SYS_select +/select02_SYS_pselect6 /select03 +/select03_SYS__newselect +/select03_SYS_select +/select03_SYS_pselect6 /select04 +/select04_SYS__newselect +/select04_SYS_select +/select04_SYS_pselect6
testcases/kernel/syscalls/select/Makefile +22 -0
@@ -18,7 +18,29 @@ top_srcdir ?= ../../../.. +%_SYS__newselect: %_SYS__newselect.o + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ +%_SYS_select: %_SYS_select.o + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ +%_SYS_pselect6: %_SYS_pselect6.o + $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@ + +%_SYS__newselect.o: %.c select.h + $(COMPILE.c) -DSYSCALL_SELECT__NEWSELECT $(OUTPUT_OPTION) $< +%_SYS_select.o: %.c select.h + $(COMPILE.c) -DSYSCALL_SELECT_SELECT $(OUTPUT_OPTION) $< +%_SYS_pselect6.o: %.c select.h + $(COMPILE.c) -DSYSCALL_SELECT_PSELECT6 $(OUTPUT_OPTION) $< + +select01 select02 select03 select04: select.h +select01 select02 select03 select04: CFLAGS+=-DSYSCALL_SELECT_LIBC select04: LDLIBS+=-lrt +select04_SYS_%: LDLIBS+=-lrt + +MAKE_TARGETS := $(notdir $(patsubst %.c,%,$(wildcard $(abs_srcdir:%=%/)*.c))) \ + $(notdir $(patsubst %.c,%_SYS__newselect,$(wildcard $(abs_srcdir:%=%/)*.c))) \ + $(notdir $(patsubst %.c,%_SYS_select,$(wildcard $(abs_srcdir:%=%/)*.c))) \ + $(notdir $(patsubst %.c,%_SYS_pselect6,$(wildcard $(abs_srcdir:%=%/)*.c))) include $(top_srcdir)/include/mk/testcases.mk
testcases/kernel/syscalls/select/select.h new file +130 -0
130 lines not on this page · raw message
testcases/kernel/syscalls/select/select01.c +3 -4
@@ -43,17 +43,16 @@#include <signal.h> #include <string.h> #include <sys/param.h> -#include <sys/types.h> -#include <sys/time.h> #include "test.h" +#include "select.h" -#define FILENAME "select01" +#define FILENAME SELECT_TEST_FILENAME("select01")static void setup (void );static void cleanup (void ); -char *TCID ="select01" ; +char *TCID =FILENAME ;int TST_TOTAL =1 ;int Fd =-1 ;
testcases/kernel/syscalls/select/select02.c +2 -3
@@ -43,15 +43,14 @@#include <fcntl.h> #include <signal.h> #include <sys/param.h> -#include <sys/types.h> -#include <sys/time.h> #include "test.h" #include "safe_macros.h" +#include "select.h" static void setup (void ); -char *TCID ="select02" ; +char *TCID =SELECT_TEST_FILENAME ("select02" );int TST_TOTAL =1 ;int Fd[2 ];
testcases/kernel/syscalls/select/select03.c +3 -4
@@ -43,19 +43,18 @@#include <fcntl.h> #include <signal.h> #include <sys/param.h> -#include <sys/types.h> -#include <sys/time.h> #include <sys/stat.h> #include "test.h" #include "safe_macros.h" +#include "select.h" -#define FILENAME "select03" +#define FILENAME SELECT_TEST_FILENAME("select03")static void setup (void );static void cleanup (void ); -char *TCID ="select03" ; +char *TCID =FILENAME ;int TST_TOTAL =1 ;int Fd;
testcases/kernel/syscalls/select/select04.c +2 -3
@@ -21,11 +21,10 @@*/ #include <unistd.h> #include <errno.h> -#include <sys/time.h> -#include <sys/types.h> #include <fcntl.h> #include "tst_timer_test.h" +#include "select.h" static int fds[2 ];
@@ -66,7 +65,7 @@ static void cleanup(void) }static struct tst_test test = { - .scall ="select()" , + .scall = str_expand(SELECT_TEST_SYSCALL) "()", .sample = sample_fn, .setup = setup, .cleanup = cleanup,
Signature · 1 line
2.21.0.352.gf09ad66450-goog
PATCH 1/1 select: tests offer choice of syscall path:
Hi!
Quoted 11 lines
Switch between libc library,
__newselectsyscall, select syscall or pselect6 syscall for selection ofselect()tests. This provides filled in coverage of all the possible select alternatives.CC flags can be one of:
(quoted diff) +0
-4-DSYSCALL_SELECT_LIBC // use select() libc library function -DSYSCALL_SELECT__NEWSELECT // use __NR__newselect system call -DSYSCALL_SELECT_SELECT // use __NR_select system call -DSYSCALL_SELECT_PSELECT6 // use __NR_pselect6 system call worker<default> // chose a _defined_ system call
I was meanwhile thinking of how we should handle the libc/syscall multiplexing and I would be probably in favor of doing it on runtime since I do not see any reason why we should generate test binary for each syscall variant.
Rather than that I'm looking into having a multiplexer callback from the new test library that would allow running the test function in a loop for each possible syscall variant.
I will send a RFC patch ideally today and add you into CC.
Signature · 2 lines
Cyril Hrubis [email protected]