syscalls/fstat{01,02}: rewrote testcases
PATCH 1/2 syscalls/fstat{01,02}: rewrote testcases
Merged the two tests:
fstat01 is a subset of fstat02 and is therefore not needed anymore.
Rewrote testcase:
Cleaned up, ported to new library and added variants to test for libc aswell as the raw syscall.
--- runtest/syscalls | 2 - testcases/kernel/syscalls/fstat/.gitignore | 2 - testcases/kernel/syscalls/fstat/fstat.h | 34 ++++++ testcases/kernel/syscalls/fstat/fstat01.c | 175 ----------------------------- testcases/kernel/syscalls/fstat/fstat02.c | 141 +++++++---------------- 5 files changed, 76 insertions(+), 278 deletions(-) create mode 100644 testcases/kernel/syscalls/fstat/fstat.h delete mode 100644 testcases/kernel/syscalls/fstat/fstat01.c
runtest/syscalls +0 -2
@@ -334,8 +334,6 @@ fpathconf01 fpathconf01 fremovexattr01 fremovexattr01 fremovexattr02 fremovexattr02 -fstat01 fstat01 -fstat01_64 fstat01_64 fstat02 fstat02 fstat02_64 fstat02_64 fstat03 fstat03
testcases/kernel/syscalls/fstat/.gitignore +0 -2
@@ -1,5 +1,3 @@ -/fstat01 -/fstat01_64 /fstat02 /fstat02_64 /fstat03
testcases/kernel/syscalls/fstat/fstat.h new file +34 -0
@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) SUSE LLC, 2019 +* Author: Christian Amann <[email protected]> +*/ + +#ifndef __FSTAT_H__ +#define __FSTAT_H__ + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include "lapi/syscalls.h" + +#define TEST_VARIANTS 2 +#define TESTFILE "test_file" + +static void syscall_info (void ) +{ +if (tst_variant ==0 ) { +tst_res (TINFO ,"Testing libc fstat()" ); +return ; + } +tst_res (TINFO ,"Testing syscall fstat()" ); +} + +static int tst_fstat (int fd,struct stat *statbuf) +{ +if (tst_variant ==0 ) +return fstat (fd, statbuf); +return tst_syscall (__NR_fstat, fd, statbuf); +} + +#endif /* __FSTAT_H__ */
testcases/kernel/syscalls/fstat/fstat01.c deleted +0 -175
175 lines not on this page · raw message
testcases/kernel/syscalls/fstat/fstat02.c +42 -99
194 lines not on this page · raw message
Signature · 1 line
2.16.4
PATCH 2/2 syscalls/fstat{03,05}: rewrote testcases
Merged fstat03 and fstat05:
Both testcases had lots of duplicated code which could be removed by creating a single testcase for both scenarios.
Rewrote testcase:
Cleaned up and ported to new library.
--- runtest/syscalls | 2 - testcases/kernel/syscalls/fstat/.gitignore | 2 - testcases/kernel/syscalls/fstat/fstat03.c | 198 +++++++---------------- testcases/kernel/syscalls/fstat/fstat05.c | 244 ----------------------------- 4 files changed, 59 insertions(+), 387 deletions(-) delete mode 100644 testcases/kernel/syscalls/fstat/fstat05.c
runtest/syscalls +0 -2
@@ -338,8 +338,6 @@ fstat02 fstat02 fstat02_64 fstat02_64 fstat03 fstat03 fstat03_64 fstat03_64 -fstat05 fstat05 -fstat05_64 fstat05_64 #fstatat64/newfstatat test cases fstatat01 fstatat01
testcases/kernel/syscalls/fstat/.gitignore +0 -2
@@ -2,5 +2,3 @@ /fstat02_64 /fstat03 /fstat03_64 -/fstat05 -/fstat05_64
testcases/kernel/syscalls/fstat/fstat03.c +59 -139
219 lines not on this page · raw message
testcases/kernel/syscalls/fstat/fstat05.c deleted +0 -244
244 lines not on this page · raw message
Signature · 1 line
2.16.4
PATCH 1/2 syscalls/fstat{01,02}: rewrote testcases
In reply to Christian AmannHi!
Quoted 24 lines
+++
b/testcases/kernel/syscalls/fstat/fstat.htestcases/kernel/syscalls/fstat/fstat.h new file +22
-0@@ -0,0 +1,34 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* +* Copyright (c) SUSE LLC, 2019 +* Author: Christian Amann <[email protected]> +*/ + +#ifndef __FSTAT_H__ +#define __FSTAT_H__ + +#include <sys/types.h> +#include <sys/stat.h> +#include <unistd.h> +#include "lapi/syscalls.h" + +#define TEST_VARIANTS 2 +#define TESTFILE "test_file" + +static void syscall_info (void ) +{ +if (tst_variant ==0 ) { +tst_res (TINFO ,"Testing libc fstat()" ); +return ;
testcases/kernel/syscalls/fstat/fstat.h line 32
Quoted 10 lines
testcases/kernel/syscalls/fstat/fstat.h new file +10
-0+ } +tst_res (TINFO ,"Testing syscall fstat()" ); +} + +static int tst_fstat (int fd,struct stat *statbuf) +{ +if (tst_variant ==0 ) +return fstat (fd, statbuf); +return tst_syscall (__NR_fstat, fd, statbuf); +}
Have you tested this wrapper with 32bit binary?
Because on x86 (among others) we do have fstat and fstat64 that differ in the statbuf structure size (see man fstat NOTES). If I add a printf() to print sizeof(struct stat) to the fstat01.c test on x86 I get 96 bytes with _FILE_OFFSET_BITS=64 and 88 without, so I guess that this uses wrong syscall with the _FILE_OFFSET_BITS=64 defined.
And actually there are three fstat variants there, the old_fstat, fstat and fstat64, we could probably test all three variants but I guess that old_fstat is actually not worth of the effort...
HINT: You can compile 32bit LTP on 64bit distribution with:
./configure CFLAGS=-m32 LDFLAGS=-m32.
Signature · 2 lines
Cyril Hrubis [email protected]