[PATCH] openposix: Remove timer_*/speculative tests for invalid timerid
Avinesh Kumar via ltp <[email protected]>
| Newsgroups | gmane.linux.ltp |
|---|---|
| Message-ID | <[email protected]> |
From: Avinesh Kumar <avinesh.kumar-IBi9RG/[email protected]> timer_delete/speculative/5-{1,2}, timer_getoverrun/speculative/6-{1,2,3}, timer_gettime/speculative/6-{1,2,3}, and timer_settime/speculative/12-{1,2,3} all test behavior for an invalid timerid that POSIX explicitly leaves undefined (Issue 6/TC2 made EINVAL optional; some of these functions' ERRORS sections define no errors at all). Remove them instead of special-casing a SIGSEGV some implementations produce for this input[2]. [0] https://pubs.opengroup.org/onlinepubs/9799919799/functions/timer_getoverrun.html [1] https://pubs.opengroup.org/onlinepubs/9799919799/functions/timer_delete.html [2] https://lore.kernel.org/ltp/20260808150331.127440-1-avinesh.kumar-IBi9RG/[email protected]/ Suggested-by: Martin Doucha <[email protected]> Signed-off-by: Avinesh Kumar <avinesh.kumar-IBi9RG/[email protected]> --- .../interfaces/timer_delete/coverage.txt | 5 +- .../interfaces/timer_delete/speculative/5-1.c | 40 -------- .../interfaces/timer_delete/speculative/5-2.c | 94 ------------------- .../timer_delete/speculative/LDLIBS | 1 - .../timer_getoverrun/speculative/6-1.c | 39 -------- .../timer_getoverrun/speculative/6-2.c | 58 ------------ .../timer_getoverrun/speculative/6-3.c | 50 ---------- .../timer_getoverrun/speculative/LDLIBS | 1 - .../interfaces/timer_gettime/coverage.txt | 6 +- .../timer_gettime/speculative/6-1.c | 38 -------- .../timer_gettime/speculative/6-2.c | 48 ---------- .../timer_gettime/speculative/6-3.c | 52 ---------- .../timer_gettime/speculative/LDLIBS | 1 - .../interfaces/timer_settime/coverage.txt | 10 +- .../timer_settime/speculative/12-1.c | 42 --------- .../timer_settime/speculative/12-2.c | 57 ----------- .../timer_settime/speculative/12-3.c | 59 ------------ .../timer_settime/speculative/LDLIBS | 1 - 18 files changed, 15 insertions(+), 587 deletions(-) delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/LDLIBS delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-1.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-2.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-3.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/LDLIBS delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-1.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-2.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-3.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/LDLIBS delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-1.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-2.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-3.c delete mode 100644 testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/LDLIBS diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/coverage.txt b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/coverage.txt index 51b8c5a711d9..11276c261286 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/coverage.txt +++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/coverage.txt @@ -5,4 +5,7 @@ Assertion Covered? 2 YES 3 YES 4 YES -5 YES +5 WON'T* + +* EINVAL is optional here (POSIX Issue 6/TC2; no errors are defined +at all as of Issue 8), so not testable. diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c deleted file mode 100644 index 912cf5800e6f..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-1.c +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test to see if timer_delete() returns -1 and sets errno==EINVAL if - * timerid is not a valid timer ID or not. - * Since this is a "may" requirement, either option is a PASS. - */ - -#include <time.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -#define BOGUSTIMERID 99999 - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - timer_t tid; - int tval = BOGUSTIMERID; - tid = (timer_t) & tval; - - if (timer_delete(tid) == -1) { - if (errno == EINVAL) { - printf - ("timer_delete() returned -1 and set errno=EINVAL\n"); - return PTS_PASS; - } else { - printf - ("timer_delete() returned -1, but didn't set errno!=EINVAL\n"); - return PTS_FAIL; - } - } - - printf("timer_delete() did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c deleted file mode 100644 index 74eeb46793b2..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/5-2.c +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - - * Test to see if timer_delete() returns -1 and sets errno==EINVAL when - * trying to delete a timer that has already been deleted or not. - * Since this is a "may" assertion, either option is a pass. - * Steps: - * - Run test case 1-1.c and then try to delete the timer again. - * - * For this test, signal SIGTOTEST will be used, clock CLOCK_REALTIME - * will be used. - */ - -#include <time.h> -#include <signal.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <errno.h> -#include "posixtest.h" - -#define SIGTOTEST SIGALRM -#define TIMERSEC 3 - -static void handler(int signo PTS_ATTRIBUTE_UNUSED) -{ - printf("Should not have caught signal\n"); - exit(PTS_FAIL); -} - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - struct sigaction act; - timer_t tid; - struct itimerspec its; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - act.sa_handler = handler; - act.sa_flags = 0; - - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = TIMERSEC; - its.it_value.tv_nsec = 0; - - if (sigemptyset(&act.sa_mask) == -1) { - perror("Error calling sigemptyset\n"); - return PTS_UNRESOLVED; - } - if (sigaction(SIGTOTEST, &act, 0) == -1) { - perror("Error calling sigaction\n"); - return PTS_UNRESOLVED; - } - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_settime(tid, 0, &its, NULL) != 0) { - perror("timer_settime() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_delete(tid) != 0) { - perror("timer_delete() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (sleep(TIMERSEC) != 0) { - printf("sleep() did not sleep full time\n"); - return PTS_UNRESOLVED; - } - - if (timer_delete(tid) == -1) { - if (errno == EINVAL) { - printf("fcn returned -1 and set errno=EINVAL\n"); - return PTS_PASS; - } else { - printf("errno!=EINVAL, but fcn returned -1\n"); - return PTS_FAIL; - } - } - - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/LDLIBS b/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/LDLIBS deleted file mode 100644 index 08f7cd60c2ad..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_delete/speculative/LDLIBS +++ /dev/null @@ -1 +0,0 @@ --lrt diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-1.c deleted file mode 100644 index 6e18560e5084..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-1.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_getoverrun() sets errno=EINVAL if no timers have been - * created yet or not. Since this is a "may" assertion, either way is - * a pass. - */ - -#include <time.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -#define BOGUSTID 9999 - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - timer_t tid; - int tval = BOGUSTID; - tid = (timer_t) & tval; - - if (timer_getoverrun(tid) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno=EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1, but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-2.c deleted file mode 100644 index 2d7f3967ced1..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-2.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_getoverrun() returns -1 and sets errno==EINVAL when - * trying to call timer_getoverrun on a timer that has been deleted or not. - * Since this assertion is a "may," either option is a pass. - * - * For this test, signal SIGCONT will be used, clock CLOCK_REALTIME - * will be used. - */ - -#include <sys/types.h> -#include <errno.h> -#include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include <unistd.h> -#include "posixtest.h" - -#define TIMERSEC 3 - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - timer_t tid; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGCONT; - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_delete(tid) != 0) { - perror("timer_delete() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_getoverrun(tid) == -1) { - if (errno == EINVAL) { - printf("fcn returned -1 and set errno=EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-3.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-3.c deleted file mode 100644 index 933a31dcd3e7..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/6-3.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_getoverrun() sets errno = EINVAL for timerid != a - * timer ID created via timer_create(). [Try to set timerid to a timer ID - * created + 1.] - * Since this assertion is a "may," either option is a pass. - * - * For this test, signal SIGCONT will be used, clock CLOCK_REALTIME - * will be used. - */ - -#include <sys/types.h> -#include <errno.h> -#include <signal.h> -#include <stdio.h> -#include <time.h> -#include "posixtest.h" - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - timer_t tid; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGCONT; - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_getoverrun(tid + 1) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/LDLIBS b/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/LDLIBS deleted file mode 100644 index 08f7cd60c2ad..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_getoverrun/speculative/LDLIBS +++ /dev/null @@ -1 +0,0 @@ --lrt diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/coverage.txt b/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/coverage.txt index aa9a47e4b5c2..dcfee8dfa2fe 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/coverage.txt +++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/coverage.txt @@ -6,4 +6,8 @@ Assertion Coverage 3 YES 4 YES 5 YES -6 YES +6 WON'T* + +* POSIX explicitly states the behavior is undefined for an invalid +timerid here (Issue 6/TC2 made EINVAL optional, not required), so +not testable. diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-1.c deleted file mode 100644 index d09c2f70901d..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-1.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_gettime() sets errno = EINVAL if no timers have been - * created yet and it is called with a bogus timer ID. Since this is a "may" - * assertion, either way is pass. - */ - -#include <time.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -#define BOGUSTID 9999 - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - timer_t tid; - struct itimerspec its; - int tval = BOGUSTID; - tid = (timer_t) & tval; - if (timer_gettime(tid, &its) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-2.c deleted file mode 100644 index 88a8d221914b..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-2.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_gettime() sets errno = EINVAL timerid != a timer ID - * created via timer_create(). [Try to set timerid to a timer ID - * created + 1.] Since this assertion is a "may," either way is a pass. - * - * For this test, signal SIGCONT will be used, clock CLOCK_REALTIME - * will be used. - */ - -#include <time.h> -#include <signal.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - timer_t tid; - struct itimerspec its; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGCONT; - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_gettime(tid + 1, &its) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-3.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-3.c deleted file mode 100644 index ef7c37f5eb99..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/6-3.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_gettime() sets errno = EINVAL when timerid = - * a timer ID of a deleted timer. Since this assertion is a "may" - * assertion, either way is a pass. - * - * For this test, signal SIGCONT will be used. - * Clock CLOCK_REALTIME will be used. - */ - -#include <time.h> -#include <signal.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - timer_t tid; - struct itimerspec its; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGCONT; - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - if (timer_delete(tid) != 0) { - perror("timer_delete() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_gettime(tid, &its) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/LDLIBS b/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/LDLIBS deleted file mode 100644 index 08f7cd60c2ad..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative/LDLIBS +++ /dev/null @@ -1 +0,0 @@ --lrt diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/coverage.txt b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/coverage.txt index 8e6034a21a6c..a4cd9d379fd7 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/coverage.txt +++ b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/coverage.txt @@ -12,14 +12,16 @@ Assertion Covered? 9 YES 10 YES 11 YES -12 YES +12 WON'T** 13 YES *Decided against testing this assertion as it would be quite difficult to get an accurate test. +** POSIX explicitly states the behavior is undefined for an invalid +timerid here (Issue 6/TC2 made EINVAL optional, not required), so +not testable. + Possible other items to test: assertion 6 - What happens if it_interval < it_value? - Would be easy to -use code from 6-1 and replace numbers to test this. - -May also want to run canned boundary tests on tid values. +use code from 6-1 and replace numbers to test this. \ No newline at end of file diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-1.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-1.c deleted file mode 100644 index 5d4e1dda30ba..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-1.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_settime() sets errno = EINVAL if no timers have been - * created yet. Since this is a "may" assertion, either way is a pass. - */ - -#include <time.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -#define BOGUSTID 9999 - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - timer_t tid; - struct itimerspec its; - int tval = BOGUSTID; - tid = (timer_t) & tval; - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = 0; - - if (timer_settime(tid, 0, &its, NULL) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1, but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-2.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-2.c deleted file mode 100644 index 3b6901c25dc7..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-2.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_settime() sets errno = EINVAL timerid != a timer ID - * created via timer_create(). [Try to set timerid to a timer ID - * created + 1.] Since this test is a "may" assertion, either way is a - * pass. - * - * For this test, signal SIGTOTEST will be used, clock CLOCK_REALTIME - * will be used. - */ - -#include <sys/types.h> -#include <errno.h> -#include <signal.h> -#include <stdio.h> -#include <time.h> -#include "posixtest.h" - -#define SIGTOTEST SIGALRM - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - timer_t tid; - struct itimerspec its; - - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = 0; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_settime(tid + 1, 0, &its, NULL) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-3.c b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-3.c deleted file mode 100644 index 04ceb2745af3..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/12-3.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2002, Intel Corporation. All rights reserved. - * Created by: julie.n.fleischer REMOVE-THIS AT intel DOT com - * This file is licensed under the GPL license. For the full content - * of this license, see the COPYING file at the top level of this - * source tree. - * - * Test to see if timer_settime() sets errno = EINVAL when timerid = - * a timer ID of a deleted timer. Since this is a "may" assertion, either - * way is a pass. - * - * For this test, signal SIGTOTEST will be used. - * Clock CLOCK_REALTIME will be used. - */ - -#include <time.h> -#include <signal.h> -#include <stdio.h> -#include <errno.h> -#include "posixtest.h" - -#define SIGTOTEST SIGALRM - -int test_main(int argc PTS_ATTRIBUTE_UNUSED, char **argv PTS_ATTRIBUTE_UNUSED) -{ - struct sigevent ev; - timer_t tid; - struct itimerspec its; - - its.it_interval.tv_sec = 0; - its.it_interval.tv_nsec = 0; - its.it_value.tv_sec = 0; - its.it_value.tv_nsec = 0; - - ev.sigev_notify = SIGEV_SIGNAL; - ev.sigev_signo = SIGTOTEST; - - if (timer_create(CLOCK_REALTIME, &ev, &tid) != 0) { - perror("timer_create() did not return success\n"); - return PTS_UNRESOLVED; - } - if (timer_delete(tid) != 0) { - perror("timer_delete() did not return success\n"); - return PTS_UNRESOLVED; - } - - if (timer_settime(tid, 0, &its, NULL) == -1) { - if (EINVAL == errno) { - printf("fcn returned -1 and errno==EINVAL\n"); - return PTS_PASS; - } else { - printf("fcn returned -1 but errno!=EINVAL\n"); - printf("Test FAILED\n"); - return PTS_FAIL; - } - } - printf("fcn did not return -1\n"); - return PTS_PASS; -} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/LDLIBS b/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/LDLIBS deleted file mode 100644 index 08f7cd60c2ad..000000000000 --- a/testcases/open_posix_testsuite/conformance/interfaces/timer_settime/speculative/LDLIBS +++ /dev/null @@ -1 +0,0 @@ --lrt -- 2.55.0 -- Mailing list info: https://lists.linux.it/listinfo/ltp