Commit 8a2f250d authored by Florian Bezdeka's avatar Florian Bezdeka Committed by Jan Kiszka
Browse files

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.
Signed-off-by: default avatarFlorian Bezdeka <florian.bezdeka@siemens.com>
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent c7dade09
......@@ -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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment