syscalls/fadvise: Fix regression
PATCH 1/1 syscalls/fadvise: Fix regression
These test were disabled from execution without _FILE_OFFSET_BITS != 64 since their conversion into the new library. The problem is that we didn't copied the original condition correctly. Originally the tests were disabled in case of:
if ((_FILE_OFFSET_BITS != 64) && (__NR_fadvise64 == 0))
While after the change they were disabled in case of:
Now looking at the original condition the __NR_fadvise64 was never equal to 0, since the original tests included lapi/syscalls.h which defines fallback definitions with value -1. So either had the __NR_fadvise64 correct value or was set to -1.
All in all looking at the code it does not make sense to disable these tests anyway, so this commit just removes the ifdefs.
--- testcases/kernel/syscalls/fadvise/posix_fadvise01.c | 11 ----------- testcases/kernel/syscalls/fadvise/posix_fadvise02.c | 11 ----------- testcases/kernel/syscalls/fadvise/posix_fadvise03.c | 11 ----------- testcases/kernel/syscalls/fadvise/posix_fadvise04.c | 10 ---------- 4 files changed, 43 deletions(-)
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0 -11
@@ -29,13 +29,7 @@#include <string.h> #include "tst_test.h" -#include "lapi/syscalls.h" -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 32 -#endif - -#if (_FILE_OFFSET_BITS ==64 )char fname[] ="/bin/cat" ;/* test executable to open */ int fd =-1 ;/* initialized in open */
@@ -86,8 +80,3 @@ static struct tst_test test = { .test = verify_fadvise, .tcnt = ARRAY_SIZE(defined_advise), }; - -#else -TST_TEST_TCONF ("This test can only run on kernels that implements " -"fadvise64 which is used from posix_fadvise" ); -#endif
testcases/kernel/syscalls/fadvise/posix_fadvise02.c +0 -11
@@ -28,13 +28,7 @@#include <string.h> #include "tst_test.h" -#include "lapi/syscalls.h" -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 32 -#endif - -#if (_FILE_OFFSET_BITS ==64 )#define WRONG_FD 42/* The number has no meaning. Just used as something wrong fd */
@@ -93,8 +87,3 @@ static struct tst_test test = { .test = verify_fadvise, .tcnt = ARRAY_SIZE(defined_advise), }; - -#else -TST_TEST_TCONF ("This test can only run on kernels that implements " -"fadvise64 which is used from posix_fadvise" ); -#endif
testcases/kernel/syscalls/fadvise/posix_fadvise03.c +0 -11
@@ -29,13 +29,7 @@#include <string.h> #include "tst_test.h" -#include "lapi/syscalls.h" -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 32 -#endif - -#if (_FILE_OFFSET_BITS ==64 )char fname[] ="/bin/cat" ;/* test executable to open */ int fd =-1 ;/* initialized in open */
@@ -135,8 +129,3 @@ static struct tst_test test = { .test = verify_fadvise, .tcnt = ADVISE_LIMIT, }; - -#else -TST_TEST_TCONF ("This test can only run on kernels that implements " -"fadvise64 which is used from posix_fadvise" ); -#endif
testcases/kernel/syscalls/fadvise/posix_fadvise04.c +0 -10
@@ -30,11 +30,6 @@#include "tst_test.h" #include "lapi/syscalls.h" -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 32 -#endif - -#if (_FILE_OFFSET_BITS ==64 )static int pipedes[2 ];
@@ -91,8 +86,3 @@ static struct tst_test test = { .tcnt = ARRAY_SIZE(defined_advise), .min_kver = "2.6.16", }; - -#else -TST_TEST_TCONF ("This test can only run on kernels that implements " -"fadvise64 which is used from posix_fadvise" ); -#endif
Signature · 1 line
2.18.1
PATCH 1/1 syscalls/fadvise: Fix regression
Hi!
Quoted 8 lines
These test were disabled from execution without
_FILE_OFFSET_BITS!= 64 since their conversion into the new library. The problem is that we didn't copied the original condition correctly. Originally the tests were disabled in case of:if ((
_FILE_OFFSET_BITS!= 64) && (__NR_fadvise64== 0))While after the change they were disabled in case of:
If you are wonder if there is something missing here, yes it is, apparently I've been biten by the fact that git removes all lines starting with hash (#) from commit messages.
So the line missing here is:
#if (_FILE_OFFSET_BITS != 64)
Signature · 2 lines
Cyril Hrubis [email protected]
PATCH 1/1 syscalls/fadvise: Fix regression
In reply to Cyril HrubisQuoted 46 lines · Cyril Hrubis
These test were disabled from execution without
_FILE_OFFSET_BITS!= 64 since their conversion into the new library. The problem is that we didn't copied the original condition correctly. Originally the tests were disabled in case of:if ((
_FILE_OFFSET_BITS!= 64) && (__NR_fadvise64== 0))While after the change they were disabled in case of:
Now looking at the original condition the
__NR_fadvise64was never equal to 0, since the original tests includedlapi/syscalls.hwhich defines fallback definitions with value -1. So either had the__NR_fadvise64correct value or was set to -1.All in all looking at the code it does not make sense to disable these tests anyway, so this commit just removes the ifdefs.
Signed-off-by Cyril Hrubis <[email protected]>CC Amir Goldstein <[email protected]>--- testcases/kernel/syscalls/fadvise/posix_fadvise01.c | 11 ----------- testcases/kernel/syscalls/fadvise/posix_fadvise02.c | 11 ----------- testcases/kernel/syscalls/fadvise/posix_fadvise03.c | 11 ----------- testcases/kernel/syscalls/fadvise/posix_fadvise04.c | 10 ---------- 4 files changed, 43 deletions(-)testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-6@@ -29,13 +29,7 @@#include <string.h> #include "tst_test.h" -#include "lapi/syscalls.h" -#ifndef _FILE_OFFSET_BITS -#define _FILE_OFFSET_BITS 32 -#endif - -#if (_FILE_OFFSET_BITS ==64 )char fname[] ="/bin/cat" ;/* test executable to open */ int fd =-1 ;/* initialized in open */
testcases/kernel/syscalls/fadvise/posix_fadvise01.c static struct tst_test test = { · line 93
Quoted 8 lines
testcases/kernel/syscalls/fadvise/posix_fadvise01.c +0
-5@@ -86,8 +80,3 @@ static struct tst_test test = { .test = verify_fadvise, .tcnt = ARRAY_SIZE(defined_advise), }; - -#else -TST_TEST_TCONF ("This test can only run on kernels that implements " -"fadvise64 which is used from posix_fadvise" ); -#endif
ACK. FWIW, I never understood the intention behind this build time check.
Not related to the cleanup nor to your regression fix, but his test does not seem to cope well with kernel without CONFIG_ADVISE_SYSCALLS.
Thanks,
Amir.