y2038: testsuite/smokey/y2038: Run tests on y2038 safe kernels only
PATCH 1/1 y2038: testsuite/smokey/y2038: Run tests on y2038 safe kernels only
Especially 4.19 is not 2038 safe and 32 bit kernels do not have CONFIG_64BIT_TIME set, which ends up in __kernel_timespec being defined in a non y2038 safe way.
cobalt_get_timespec64 will copy the upper bytes of the sec field into the nsec field, which is always zero.
Testing y2038 syscalls on a non y2038 safe kernel doesn't make sense, hence limiting the test runs to kernels with 2038 support.
--- testsuite/smokey/y2038/syscall-tests.c | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
testsuite/smokey/y2038/syscall-tests.c +27 -0
@@ -11,6 +11,7 @@*/ #include <asm/xenomai/syscall.h> #include <smokey/smokey.h> +#include <sys/utsname.h> #include <mqueue.h> smokey_test_plugin (y2038,SMOKEY_NOARGS ,"Validate correct y2038 support" );
@@ -989,10 +990,36 @@ static int test_sc_cobalt_event_wait64(void)return 0 ; } +static int check_kernel_version (void ) +{ +int ret, major, minor; +struct utsname uts; + + ret =smokey_check_errno (uname (&uts)); +if (ret) +return ret; + + ret =sscanf (uts.release,"%d.%d" , &major, &minor); +if (!smokey_assert (ret ==2 )) +return -EINVAL ; + +/* We need a kernel with y2038 support, 5.4 onwards */ +if (!(major >5 || (major ==5 && minor >=4 ))) { +smokey_note ("y2038: skipped. (no y2038 safe kernel)" ); +return 1 ; + } + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {int ret; + ret =check_kernel_version (); +if (ret) +return (ret <0 ) ? ret :0 ;/* skip if no y2038 safe kernel */ + ret =test_sc_cobalt_sem_timedwait64 ();if (ret)return ret;
Signature · 1 line
2.30.2
Quoted 55 lines · Florian Bezdeka
Especially 4.19 is not 2038 safe and 32 bit kernels do not have
CONFIG_64BIT_TIMEset, which ends up in__kernel_timespecbeing defined in a non y2038 safe way.
cobalt_get_timespec64will copy the upper bytes of the sec field into the nsec field, which is always zero.Testing y2038 syscalls on a non y2038 safe kernel doesn't make sense, hence limiting the test runs to kernels with 2038 support.
Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)testsuite/smokey/y2038/syscall-tests.c +23
-0@@ -11,6 +11,7 @@*/ #include <asm/xenomai/syscall.h> #include <smokey/smokey.h> +#include <sys/utsname.h> #include <mqueue.h> smokey_test_plugin (y2038,SMOKEY_NOARGS ,"Validate correct y2038 support" );@@ -989,10 +990,36 @@ static int test_sc_cobalt_event_wait64(void)return 0 ; } +static int check_kernel_version (void ) +{ +int ret, major, minor; +struct utsname uts; + + ret =smokey_check_errno (uname (&uts)); +if (ret) +return ret; + + ret =sscanf (uts.release,"%d.%d" , &major, &minor); +if (!smokey_assert (ret ==2 )) +return -EINVAL ; + +/* We need a kernel with y2038 support, 5.4 onwards */ +if (!(major >5 || (major ==5 && minor >=4 ))) { +smokey_note ("y2038: skipped. (no y2038 safe kernel)" ); +return 1 ; + } + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[])
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_event_wait64(void) · line 1025
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +4
-0{int ret; + ret =check_kernel_version (); +if (ret) +return (ret <0 ) ? ret :0 ;/* skip if no y2038 safe kernel */ + ret =test_sc_cobalt_sem_timedwait64 ();if (ret)return ret;
OK, will apply. But I'm also expected a patch that makes the test case fail in cases of early shots. We only noticed this issue because you read the logs of successful runs.
Jan
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 58 lines · Jan Kiszka
Quoted 57 lines · Florian Bezdeka
Especially 4.19 is not 2038 safe and 32 bit kernels do not have
CONFIG_64BIT_TIMEset, which ends up in__kernel_timespecbeing defined in a non y2038 safe way.
cobalt_get_timespec64will copy the upper bytes of the sec field into the nsec field, which is always zero.Testing y2038 syscalls on a non y2038 safe kernel doesn't make sense, hence limiting the test runs to kernels with 2038 support.
Signed-off-by Florian Bezdeka <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 27 ++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)testsuite/smokey/y2038/syscall-tests.c +23
-0@@ -11,6 +11,7 @@*/ #include <asm/xenomai/syscall.h> #include <smokey/smokey.h> +#include <sys/utsname.h> #include <mqueue.h> smokey_test_plugin (y2038,SMOKEY_NOARGS ,"Validate correct y2038 support" );@@ -989,10 +990,36 @@ static int test_sc_cobalt_event_wait64(void)return 0 ; } +static int check_kernel_version (void ) +{ +int ret, major, minor; +struct utsname uts; + + ret =smokey_check_errno (uname (&uts)); +if (ret) +return ret; + + ret =sscanf (uts.release,"%d.%d" , &major, &minor); +if (!smokey_assert (ret ==2 )) +return -EINVAL ; + +/* We need a kernel with y2038 support, 5.4 onwards */ +if (!(major >5 || (major ==5 && minor >=4 ))) { +smokey_note ("y2038: skipped. (no y2038 safe kernel)" ); +return 1 ; + } + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {int ret;
Quoted 12 lines
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_event_wait64(void) · line 1025
Quoted 8 lines
testsuite/smokey/y2038/syscall-tests.c +4
-0+ ret =check_kernel_version (); +if (ret) +return (ret <0 ) ? ret :0 ;/* skip if no y2038 safe kernel */ + ret =test_sc_cobalt_sem_timedwait64 ();if (ret)return ret;OK, will apply. But I'm also expected a patch that makes the test case fail in cases of early shots. We only noticed this issue because you read the logs of successful runs.
When we started we saw a lot of such warnings, especially on virtual targets and decided not to fail the tests in such cases. Hopefully all of such problems are now solved / completely understood, so we could move forward and now fail if such a early shot happens.
We will take care of the "migration" from warning to error.
Quoted 3 lines
Jan