From: <ro...@us...> - 2003-07-02 22:37:08
|
Update of /cvsroot/ltp/ltp/testcases/open_posix_testsuite/conformance/interfaces/timer_gettime/speculative In directory sc8-pr-cvs1:/tmp/cvs-serv21378/conformance/interfaces/timer_gettime/speculative Added Files: 6-1.c 6-2.c 6-3.c Log Message: Added the 1.1.0 version of the Open POSIX Test Suite. --- NEW FILE: 6-1.c --- /* * 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 main(int argc, char *argv[]) { timer_t tid; struct itimerspec its; tid = BOGUSTID; 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; } --- NEW FILE: 6-2.c --- /* * 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 main(int argc, char *argv[]) { 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; } --- NEW FILE: 6-3.c --- /* * 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 main(int argc, char *argv[]) { 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; } |