y2038: testsuite/smokey/y2038: testcase for adjtime64
PATCH 3/3 y2038: testsuite/smokey/y2038: testcase for adjtime64
add test case for clock_adjtime64 in testsuite
--- testsuite/smokey/y2038/syscall-tests.c | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)
testsuite/smokey/y2038/syscall-tests.c +71 -0
@@ -25,6 +25,43 @@ struct xn_timespec64 {int64_t tv_nsec; }; +struct xn_timex_timeval { +int64_t tv_sec; +int64_t tv_usec; +}; + +struct xn_timex64 { +unsigned int modes;/* mode selector */ + int:32; /* pad */ +long long offset;/* time offset (usec) */ +long long freq;/* frequency offset (scaled ppm) */ +long long maxerror;/* maximum error (usec) */ +long long esterror;/* estimated error (usec) */ +int status;/* clock command/status */ + int:32; /* pad */ +long long constant;/* pll time constant */ +long long precision;/* clock precision (usec) (read only) */ +long long tolerance;/* clock frequency tolerance (ppm) (read only) */ +struct xn_timex_timeval time;/* (read only, except for ADJ_SETOFFSET) */ +long long tick;/* (modified) usecs between clock ticks */ + +long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ +long long jitter;/* pps jitter (us) (ro) */ +int shift;/* interval duration (s) (shift) (ro) */ + int:32; /* pad */ +long long stabil;/* pps stability (scaled ppm) (ro) */ +long long jitcnt;/* jitter limit exceeded (ro) */ +long long calcnt;/* calibration intervals (ro) */ +long long errcnt;/* calibration errors (ro) */ +long long stbcnt;/* stability limit exceeded (ro) */ + +int tai;/* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; +#define NSEC_PER_SEC 1000000000static void ts_normalise (struct xn_timespec64 *ts)
@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void)return 0 ; } +static int test_sc_cobalt_clock_adjtime64 (void ) +{ +long ret; +int code =__xn_syscode (sc_cobalt_clock_adjtime64); +struct xn_timex64 tx64 = {}; + +/* Make sure we don't crash because of NULL pointers */ + ret =syscall (code,NULL ,NULL ); +if (ret ==-1 && errno ==ENOSYS ) { +smokey_note ("clock_adjtime64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) +return errno; + +/* Providing an invalid address has to deliver EFAULT */ + ret =syscall (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) +return errno; + +/* Provide a valid 64bit timex*/ + tx64.modes =ADJ_SETOFFSET ; + tx64.time.tv_usec =123 ; + ret =syscall (code,CLOCK_REALTIME , &tx64); +if (!smokey_assert (!ret)) +return errno; + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {
@@ -351,5 +418,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_adjtime64 (); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
2.7.4
Quoted 73 lines · Song Chen
add test case for
clock_adjtime64in testsuiteSigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)testsuite/smokey/y2038/syscall-tests.c +51
-0@@ -25,6 +25,43 @@ struct xn_timespec64 {int64_t tv_nsec; }; +struct xn_timex_timeval { +int64_t tv_sec; +int64_t tv_usec; +}; + +struct xn_timex64 { +unsigned int modes;/* mode selector */ + int:32; /* pad */ +long long offset;/* time offset (usec) */ +long long freq;/* frequency offset (scaled ppm) */ +long long maxerror;/* maximum error (usec) */ +long long esterror;/* estimated error (usec) */ +int status;/* clock command/status */ + int:32; /* pad */ +long long constant;/* pll time constant */ +long long precision;/* clock precision (usec) (read only) */ +long long tolerance;/* clock frequency tolerance (ppm) (read only) */ +struct xn_timex_timeval time;/* (read only, except for ADJ_SETOFFSET) */ +long long tick;/* (modified) usecs between clock ticks */ + +long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ +long long jitter;/* pps jitter (us) (ro) */ +int shift;/* interval duration (s) (shift) (ro) */ + int:32; /* pad */ +long long stabil;/* pps stability (scaled ppm) (ro) */ +long long jitcnt;/* jitter limit exceeded (ro) */ +long long calcnt;/* calibration intervals (ro) */ +long long errcnt;/* calibration errors (ro) */ +long long stbcnt;/* stability limit exceeded (ro) */ + +int tai;/* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; +#define NSEC_PER_SEC 1000000000static void ts_normalise (struct xn_timespec64 *ts)@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void)return 0 ; } +static int test_sc_cobalt_clock_adjtime64 (void ) +{ +long ret; +int code =__xn_syscode (sc_cobalt_clock_adjtime64); +struct xn_timex64 tx64 = {}; + +/* Make sure we don't crash because of NULL pointers */ + ret =syscall (code,NULL ,NULL ); +if (ret ==-1 && errno ==ENOSYS ) { +smokey_note ("clock_adjtime64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) +return errno;
testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 389
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+ +/* Providing an invalid address has to deliver EFAULT */ + ret =syscall (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) +return errno; + +/* Provide a valid 64bit timex*/ + tx64.modes =ADJ_SETOFFSET ; + tx64.time.tv_usec =123 ; + ret =syscall (code,CLOCK_REALTIME , &tx64);
In int __cobalt_clock_adjtime() we have
switch (clock_id) {
case CLOCK_REALTIME:
case CLOCK_MONOTONIC:
case CLOCK_MONOTONIC_RAW:
case CLOCK_HOST_REALTIME:
return -EOPNOTSUPP;So the test-failure I see on x86 is fully expected. How did you get this test running successfully?
Quoted 20 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (!smokey_assert (!ret)) +return errno; + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {@@ -351,5 +418,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_adjtime64 (); +if (ret) +return ret; +return 0 ; }
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 94 lines · Florian Bezdeka
Quoted 73 lines · Song Chen
add test case for
clock_adjtime64in testsuiteSigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)testsuite/smokey/y2038/syscall-tests.c +51
-0@@ -25,6 +25,43 @@ struct xn_timespec64 {int64_t tv_nsec; }; +struct xn_timex_timeval { +int64_t tv_sec; +int64_t tv_usec; +}; + +struct xn_timex64 { +unsigned int modes;/* mode selector */ + int:32; /* pad */ +long long offset;/* time offset (usec) */ +long long freq;/* frequency offset (scaled ppm) */ +long long maxerror;/* maximum error (usec) */ +long long esterror;/* estimated error (usec) */ +int status;/* clock command/status */ + int:32; /* pad */ +long long constant;/* pll time constant */ +long long precision;/* clock precision (usec) (read only) */ +long long tolerance;/* clock frequency tolerance (ppm) (read only) */ +struct xn_timex_timeval time;/* (read only, except for ADJ_SETOFFSET) */ +long long tick;/* (modified) usecs between clock ticks */ + +long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ +long long jitter;/* pps jitter (us) (ro) */ +int shift;/* interval duration (s) (shift) (ro) */ + int:32; /* pad */ +long long stabil;/* pps stability (scaled ppm) (ro) */ +long long jitcnt;/* jitter limit exceeded (ro) */ +long long calcnt;/* calibration intervals (ro) */ +long long errcnt;/* calibration errors (ro) */ +long long stbcnt;/* stability limit exceeded (ro) */ + +int tai;/* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; +#define NSEC_PER_SEC 1000000000static void ts_normalise (struct xn_timespec64 *ts)@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void)return 0 ; } +static int test_sc_cobalt_clock_adjtime64 (void ) +{ +long ret; +int code =__xn_syscode (sc_cobalt_clock_adjtime64); +struct xn_timex64 tx64 = {}; + +/* Make sure we don't crash because of NULL pointers */ + ret =syscall (code,NULL ,NULL ); +if (ret ==-1 && errno ==ENOSYS ) { +smokey_note ("clock_adjtime64: skipped. (no kernel support)" ); +return 0 ;// Not implemented, nothing to test, success + } +if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) +return errno;testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 389
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+ +/* Providing an invalid address has to deliver EFAULT */ + ret =syscall (code,CLOCK_REALTIME , (void *)0xdeadbeefUL ); +if (!smokey_assert (ret ==-1 ) || !smokey_assert (errno ==EFAULT )) +return errno; + +/* Provide a valid 64bit timex*/ + tx64.modes =ADJ_SETOFFSET ; + tx64.time.tv_usec =123 ; + ret =syscall (code,CLOCK_REALTIME , &tx64);In int
__cobalt_clock_adjtime()we haveswitch (clock_id) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: case CLOCK_MONOTONIC_RAW: case CLOCK_HOST_REALTIME: return -EOPNOTSUPP;
Quoted 2 lines
So the test-failure I see on x86 is fully expected. How did you get this test running successfully?
In this revision, i got this:
root@kylin-Lenovo:/home/kylin/workspace/y2038/xenomai-hacker-space# ./testsuite/smokey/smokey --run=27 syscall-tests.c:391, assertion failed: !ret /home/kylin/workspace/y2038/xenomai-hacker-space/testsuite/smokey/.libs/lt-smokey: test y2038 failed: Unknown error -95 (which is EOPNOTSUPP)
In my last revision, which replaced syscall with XENOMAI_SYSCALL, it returns -95, i'm afraid it will terminate smokey test, i turned it to if !smokey_assert(ret) for now.
when __cobalt_clock_adjtime becomes supported, i will turn it back.
Quoted 24 lines
Quoted 22 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+if (!smokey_assert (!ret)) +return errno; + +return 0 ; +} +static int run_y2038 (struct smokey_test *t,int argc,char *const argv[]) {@@ -351,5 +418,9 @@ static int run_y2038(struct smokey_test *t, int argc, char *const argv[])if (ret)return ret; + ret =test_sc_cobalt_clock_adjtime64 (); +if (ret) +return ret; +return 0 ; }
Quoted 108 lines · On 02.06.21 07:55, [email protected] wrote:
Quoted 95 lines · Florian Bezdeka
Quoted 74 lines · Song Chen
add test case for
clock_adjtime64in testsuiteSigned-off-by Song Chen <[email protected]>---
testsuite/smokey/y2038/syscall-tests.c| 71
++++++++++++++++++++++++++++++++++1 file changed, 71 insertions(+)testsuite/smokey/y2038/syscall-tests.c +16
-0@@ -25,6 +25,43 @@ struct xn_timespec64 { int64_t tv_nsec; }; +struct xn_timex_timeval { + int64_t tv_sec; + int64_t tv_usec; +}; + +struct xn_timex64 { + unsigned int modes; /* mode selector */ + int:32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror;/* maximum error (usec) */ + long long esterror;/* estimated error (usec) */ + int status; /* clock command/status */ + int:32; /* pad */ + long long constant;/* pll time constant */ + long long precision;/* clock precision (usec) (read only) */ + long long tolerance;/* clock frequency tolerance (ppm) (readonly) */
+ structxn_timex_timevaltime; /* (read only, except forADJ_SETOFFSET) */
+ long long tick; /* (modified) usecs between clock ticks */testsuite/smokey/y2038/syscall-tests.c +18
-0+ + long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int:32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; +#define
NSEC_PER_SEC1000000000
static voidts_normalise(struct xn_timespec64 *ts)testsuite/smokey/y2038/syscall-tests.c +13
-0@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void) return 0; } +static int test_sc_cobalt_clock_adjtime64(void) +{ + long ret; + int code = __xn_syscode(sc_cobalt_clock_adjtime64); + struct xn_timex64 tx64 = {}; + + /* Make sure we don't crash because of NULL pointers */ + ret = syscall(code, NULL, NULL); + if (ret == -1 && errno == ENOSYS) { + smokey_note("clock_adjtime64: skipped. (no kernel support)"); + return 0; // Not implemented, nothing to test, success + } + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno;testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 388
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+ + /* Providing an invalid address has to deliver EFAULT */ + ret = syscall(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno; + + /* Provide a valid 64bit timex*/ + tx64.modes = ADJ_SETOFFSET; + tx64.time.tv_usec = 123; + ret = syscall(code, CLOCK_REALTIME, &tx64);In int
__cobalt_clock_adjtime()we haveswitch (
clock_id) {
caseCLOCK_REALTIME:
caseCLOCK_MONOTONIC:
caseCLOCK_MONOTONIC_RAW:
caseCLOCK_HOST_REALTIME:
return-EOPNOTSUPP;Quoted 2 lines
So the test-failure I see on x86 is fully expected. How did you get this test running successfully?
In this revision, i got this:
root@kylin-Lenovo:/home/kylin/workspace/y2038/xenomai-hacker-space# ./testsuite/smokey/smokey --run=27
syscall-tests.c:391, assertion failed: !ret/home/kylin/workspace/y2038/xenomai-hacker-space/testsuite/smokey/.libs/lt-smokey:
test y2038 failed: Unknown error -95 (which is EOPNOTSUPP)
Quoted 5 lines
In my last revision, which replaced syscall with
XENOMAI_SYSCALL, it returns -95, i'm afraid it will terminate smokey test, i turned it to if !smokey_assert(ret) for now.when
__cobalt_clock_adjtimebecomes supported, i will turn it back.
Already done. See the series re-posted yesterday.
Quoted 25 lines
Quoted 25 lines
Quoted 23 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ if (!smokey_assert(!ret)) + return errno; + + return 0; +} +static int
run_y2038(struct smokey_test *t, int argc, char *const argv[])
{
@@ -351,5 +418,9 @@ static intrun_y2038(struct smokey_test *t, int argc, char *const argv[])
if (ret)
return ret;
+ ret =test_sc_cobalt_clock_adjtime64();
+ if (ret)
+ return ret;
+
return 0;
}
Signature · 2 lines
Siemens AG, T RDA IOT Corporate Competence Center Embedded Linux
Quoted 109 lines · Florian Bezdeka
Quoted 108 lines · On 02.06.21 07:55, [email protected] wrote:
Quoted 95 lines · Florian Bezdeka
Quoted 74 lines · Song Chen
add test case for
clock_adjtime64in testsuiteSigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)testsuite/smokey/y2038/syscall-tests.c +16
-0@@ -25,6 +25,43 @@ struct xn_timespec64 { int64_t tv_nsec; }; +struct xn_timex_timeval { + int64_t tv_sec; + int64_t tv_usec; +}; + +struct xn_timex64 { + unsigned int modes; /* mode selector */ + int:32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror;/* maximum error (usec) */ + long long esterror;/* estimated error (usec) */ + int status; /* clock command/status */ + int:32; /* pad */ + long long constant;/* pll time constant */ + long long precision;/* clock precision (usec) (read only) */ + long long tolerance;/* clock frequency tolerance (ppm) (readonly) */
+ structxn_timex_timevaltime; /* (read only, except forADJ_SETOFFSET) */
+ long long tick; /* (modified) usecs between clock ticks */testsuite/smokey/y2038/syscall-tests.c +31
-0+ + long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int:32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; + #define NSEC_PER_SEC 1000000000 static void ts_normalise(struct xn_timespec64 *ts)@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void) return 0; } +static int test_sc_cobalt_clock_adjtime64(void) +{ + long ret; + int code = __xn_syscode(sc_cobalt_clock_adjtime64); + struct xn_timex64 tx64 = {}; + + /* Make sure we don't crash because of NULL pointers */ + ret = syscall(code, NULL, NULL); + if (ret == -1 && errno == ENOSYS) { + smokey_note("clock_adjtime64: skipped. (no kernel support)"); + return 0; // Not implemented, nothing to test, success + } + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno;testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 388
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+ + /* Providing an invalid address has to deliver EFAULT */ + ret = syscall(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno; + + /* Provide a valid 64bit timex*/ + tx64.modes = ADJ_SETOFFSET; + tx64.time.tv_usec = 123; + ret = syscall(code, CLOCK_REALTIME, &tx64);In int
__cobalt_clock_adjtime()we haveswitch (
clock_id) {
caseCLOCK_REALTIME:
caseCLOCK_MONOTONIC:
caseCLOCK_MONOTONIC_RAW:
caseCLOCK_HOST_REALTIME:
return-EOPNOTSUPP;Quoted 2 lines
So the test-failure I see on x86 is fully expected. How did you get this test running successfully?
In this revision, i got this:
root@kylin-Lenovo:/home/kylin/workspace/y2038/xenomai-hacker-space# ./testsuite/smokey/smokey --run=27
syscall-tests.c:391, assertion failed: !ret/home/kylin/workspace/y2038/xenomai-hacker-space/testsuite/smokey/.libs/lt-smokey:
test y2038 failed: Unknown error -95 (which is EOPNOTSUPP)
Quoted 7 lines
Quoted 5 lines
In my last revision, which replaced syscall with
XENOMAI_SYSCALL, it returns -95, i'm afraid it will terminate smokey test, i turned it to if !smokey_assert(ret) for now.when
__cobalt_clock_adjtimebecomes supported, i will turn it back.Already done. See the series re-posted yesterday.
great, i will submit a patch to address it.
Quoted 28 lines
Quoted 26 lines
Quoted 26 lines
Quoted 24 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ if (!smokey_assert(!ret)) + return errno; + + return 0; +} + static int run_y2038(struct smokey_test *t, int argc, char *const argv[]) { @@ -351,5 +418,9 @@ static int run_y2038(struct smokey_test *t, intargc, char *const argv[])
if (ret)
return ret;
+ ret =test_sc_cobalt_clock_adjtime64();
+ if (ret)
+ return ret;
+
return 0;
}
Quoted 115 lines · On Wed, 2021-06-02 at 14:59 +0800, [email protected] wrote:
Quoted 113 lines · Florian Bezdeka
Quoted 112 lines · On 02.06.21 07:55, [email protected] wrote:
Quoted 95 lines · Florian Bezdeka
Quoted 74 lines · Song Chen
add test case for
clock_adjtime64in testsuiteSigned-off-by Song Chen <[email protected]>---
testsuite/smokey/y2038/syscall-tests.c| 71
++++++++++++++++++++++++++++++++++1 file changed, 71 insertions(+)testsuite/smokey/y2038/syscall-tests.c +16
-0@@ -25,6 +25,43 @@ struct xn_timespec64 { int64_t tv_nsec; }; +struct xn_timex_timeval { + int64_t tv_sec; + int64_t tv_usec; +}; + +struct xn_timex64 { + unsigned int modes; /* mode selector */ + int:32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror;/* maximum error (usec) */ + long long esterror;/* estimated error (usec) */ + int status; /* clock command/status */ + int:32; /* pad */ + long long constant;/* pll time constant */ + long long precision;/* clock precision (usec) (read only) */ + long long tolerance;/* clock frequency tolerance (ppm) (readonly) */
+ structxn_timex_timevaltime; /* (read only, except forADJ_SETOFFSET) */
+ long long tick; /* (modified) usecs between clock ticks */testsuite/smokey/y2038/syscall-tests.c +18
-0+ + long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int:32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; +#define
NSEC_PER_SEC1000000000
static voidts_normalise(struct xn_timespec64 *ts)testsuite/smokey/y2038/syscall-tests.c +13
-0@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void) return 0; } +static int test_sc_cobalt_clock_adjtime64(void) +{ + long ret; + int code = __xn_syscode(sc_cobalt_clock_adjtime64); + struct xn_timex64 tx64 = {}; + + /* Make sure we don't crash because of NULL pointers */ + ret = syscall(code, NULL, NULL); + if (ret == -1 && errno == ENOSYS) { + smokey_note("clock_adjtime64: skipped. (no kernel support)"); + return 0; // Not implemented, nothing to test, success + } + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno;testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 388
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+ + /* Providing an invalid address has to deliver EFAULT */ + ret = syscall(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno; + + /* Provide a valid 64bit timex*/ + tx64.modes = ADJ_SETOFFSET; + tx64.time.tv_usec = 123; + ret = syscall(code, CLOCK_REALTIME, &tx64);In int
__cobalt_clock_adjtime()we haveswitch (
clock_id) {
caseCLOCK_REALTIME:
caseCLOCK_MONOTONIC:
caseCLOCK_MONOTONIC_RAW:
caseCLOCK_HOST_REALTIME:
return-EOPNOTSUPP;Quoted 2 lines
So the test-failure I see on x86 is fully expected. How did you get this test running successfully?
In this revision, i got this:
root@kylin-Lenovo:/home/kylin/workspace/y2038/xenomai-hacker-space# ./testsuite/smokey/smokey --run=27
syscall-tests.c:391, assertion failed: !ret/home/kylin/workspace/y2038/xenomai-hacker-space/testsuite/smokey/.libs/lt-smokey:
test y2038 failed: Unknown error -95 (which is EOPNOTSUPP)In my last revision, which replaced syscall with
XENOMAI_SYSCALL, it returns -95, i'm afraid it will terminate smokey test, i turned it to if !smokey_assert(ret) for now.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
when
__cobalt_clock_adjtimebecomes supported, i will turn it back.Already done. See the series re-posted yesterday.
great, i will submit a patch to address it.
No additional work necessary. The patches sent out for integration already have it. (I squashed my fixes into your patch before publishing it)
Quoted 28 lines
Quoted 28 lines
Quoted 26 lines
Quoted 26 lines
Quoted 24 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ if (!smokey_assert(!ret)) + return errno; + + return 0; +} +static int
run_y2038(struct smokey_test *t, int argc, char *const argv[])
{
@@ -351,5 +418,9 @@ static intrun_y2038(struct smokey_test *t, int argc, char *const argv[])
if (ret)
return ret;
+ ret =test_sc_cobalt_clock_adjtime64();
+ if (ret)
+ return ret;
+
return 0;
}
Quoted 118 lines · Florian
Quoted 117 lines · On Wed, 2021-06-02 at 14:59 +0800, [email protected] wrote:
Quoted 115 lines · Florian Bezdeka
Quoted 113 lines · On 02.06.21 07:55, [email protected] wrote:
Quoted 95 lines · Florian Bezdeka
Quoted 74 lines · Song Chen
add test case for
clock_adjtime64in testsuiteSigned-off-by Song Chen <[email protected]>--- testsuite/smokey/y2038/syscall-tests.c | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+)testsuite/smokey/y2038/syscall-tests.c +16
-0@@ -25,6 +25,43 @@ struct xn_timespec64 { int64_t tv_nsec; }; +struct xn_timex_timeval { + int64_t tv_sec; + int64_t tv_usec; +}; + +struct xn_timex64 { + unsigned int modes; /* mode selector */ + int:32; /* pad */ + long long offset; /* time offset (usec) */ + long long freq; /* frequency offset (scaled ppm) */ + long long maxerror;/* maximum error (usec) */ + long long esterror;/* estimated error (usec) */ + int status; /* clock command/status */ + int:32; /* pad */ + long long constant;/* pll time constant */ + long long precision;/* clock precision (usec) (read only) */ + long long tolerance;/* clock frequency tolerance (ppm) (readonly) */
+ structxn_timex_timevaltime; /* (read only, except forADJ_SETOFFSET) */
+ long long tick; /* (modified) usecs between clock ticks */testsuite/smokey/y2038/syscall-tests.c +31
-0+ + long long ppsfreq;/* pps frequency (scaled ppm) (ro) */ + long long jitter; /* pps jitter (us) (ro) */ + int shift; /* interval duration (s) (shift) (ro) */ + int:32; /* pad */ + long long stabil; /* pps stability (scaled ppm) (ro) */ + long long jitcnt; /* jitter limit exceeded (ro) */ + long long calcnt; /* calibration intervals (ro) */ + long long errcnt; /* calibration errors (ro) */ + long long stbcnt; /* stability limit exceeded (ro) */ + + int tai; /* TAI offset (ro) */ + + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; int:32; + int:32; int:32; int:32; +}; + #define NSEC_PER_SEC 1000000000 static void ts_normalise(struct xn_timespec64 *ts)@@ -326,6 +363,36 @@ static int test_sc_cobalt_clock_getres64(void) return 0; } +static int test_sc_cobalt_clock_adjtime64(void) +{ + long ret; + int code = __xn_syscode(sc_cobalt_clock_adjtime64); + struct xn_timex64 tx64 = {}; + + /* Make sure we don't crash because of NULL pointers */ + ret = syscall(code, NULL, NULL); + if (ret == -1 && errno == ENOSYS) { + smokey_note("clock_adjtime64: skipped. (no kernel support)"); + return 0; // Not implemented, nothing to test, success + } + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno;testsuite/smokey/y2038/syscall-tests.c static int test_sc_cobalt_clock_getres64(void) · line 388
Quoted 10 lines
testsuite/smokey/y2038/syscall-tests.c +10
-0+ + /* Providing an invalid address has to deliver EFAULT */ + ret = syscall(code, CLOCK_REALTIME, (void *)0xdeadbeefUL); + if (!smokey_assert(ret == -1) || !smokey_assert(errno == EFAULT)) + return errno; + + /* Provide a valid 64bit timex*/ + tx64.modes = ADJ_SETOFFSET; + tx64.time.tv_usec = 123; + ret = syscall(code, CLOCK_REALTIME, &tx64);In int
__cobalt_clock_adjtime()we haveswitch (
clock_id) {
caseCLOCK_REALTIME:
caseCLOCK_MONOTONIC:
caseCLOCK_MONOTONIC_RAW:
caseCLOCK_HOST_REALTIME:
return-EOPNOTSUPP;Quoted 2 lines
So the test-failure I see on x86 is fully expected. How did you get this test running successfully?
In this revision, i got this:
root@kylin-Lenovo:/home/kylin/workspace/y2038/xenomai-hacker-space# ./testsuite/smokey/smokey --run=27
syscall-tests.c:391, assertion failed: !ret/home/kylin/workspace/y2038/xenomai-hacker-space/testsuite/smokey/.libs/lt-smokey:
test y2038 failed: Unknown error -95 (which is EOPNOTSUPP)In my last revision, which replaced syscall with
XENOMAI_SYSCALL, it returns -95, i'm afraid it will terminate smokey test, i turned it to if !smokey_assert(ret) for now.when
__cobalt_clock_adjtimebecomes supported, i will turn it back.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
Already done. See the series re-posted yesterday.
great, i will submit a patch to address it.
No additional work necessary. The patches sent out for integration already have it. (I squashed my fixes into your patch before publishing it)
no extra wok to do , great :), many thanks.
Song
Quoted 30 lines
Quoted 29 lines
Quoted 29 lines
Quoted 27 lines
Quoted 27 lines
Quoted 25 lines
testsuite/smokey/y2038/syscall-tests.c +6
-0+ if (!smokey_assert(!ret)) + return errno; + + return 0; +} + static int run_y2038(struct smokey_test *t, int argc, char *const argv[]) { @@ -351,5 +418,9 @@ static int run_y2038(struct smokey_test *t, intargc, char *const argv[])
if (ret)
return ret;
+ ret =test_sc_cobalt_clock_adjtime64();
+ if (ret)
+ return ret;
+
return 0;
}