From c003d47a54384dcc62951239dccf1bbad96e72b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Duval?= Date: Mon, 22 May 2006 16:14:00 +0000 Subject: [PATCH] added some more tests git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17535 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- .../conformance/interfaces/Jamfile | 3 ++ .../conformance/interfaces/difftime/1-1.c | 39 +++++++++++++++++++ .../conformance/interfaces/difftime/Jamfile | 6 +++ .../conformance/interfaces/kill/2-1.c | 30 ++++++++++++++ .../conformance/interfaces/kill/Jamfile | 6 +++ 5 files changed, 84 insertions(+) create mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c create mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile create mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c create mode 100644 src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile index 69d9561dd6..4cd9bf4fa1 100644 --- a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/Jamfile @@ -1,3 +1,6 @@ SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces ; +SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces difftime ; +SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces kill ; SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigprocmask ; +SubInclude HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces sigsuspend ; diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c new file mode 100644 index 0000000000..ab02c3f035 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/1-1.c @@ -0,0 +1,39 @@ +/* + * Copyright (c) 2002-3, Intel Corporation. All rights reserved. + * Created by: salwan.searty 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 that the difftime function shall return the difference between + two calendar times. + */ + +#define WAIT_DURATION 1 + +#include +#include +#include +#include +#include "posixtest.h" + +int main() +{ + time_t time1, time0; + + double time_diff; + time_diff = 0; + time0 = time(NULL); + sleep(WAIT_DURATION); + time1 = time(NULL); + time_diff = difftime(time1, time0); + + if (time_diff != WAIT_DURATION) { + perror("Test FAILED: difftime did not return the correct value\n"); + return PTS_FAIL; + } + + printf("Test PASSED\n"); + return PTS_PASS; +} + diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile new file mode 100644 index 0000000000..d5dfbc4806 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/difftime/Jamfile @@ -0,0 +1,6 @@ +SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces difftime ; + +SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; + +SimpleTest 1-1.test : 1-1.c ; + diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c new file mode 100644 index 0000000000..ba248069b4 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/2-1.c @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include "posixtest.h" + +/* + * 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 that if the signal is the null signal (0), no signal is sent. + * 1) Call kill on the current process with the null signal. + * 2) If process is still functional after kill() is called, consider + * the test a pass (most likely no signal was sent). + */ + +int main() +{ + if (kill(getpid(), 0) != 0) { + printf("Could not call kill with sig = 0\n"); + return PTS_FAIL; + } + + printf("Test PASSED\n"); + return PTS_PASS; +} + diff --git a/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile new file mode 100644 index 0000000000..7f64d2fe39 --- /dev/null +++ b/src/tests/system/libroot/posix/posixtestsuite/conformance/interfaces/kill/Jamfile @@ -0,0 +1,6 @@ +SubDir HAIKU_TOP src tests system libroot posix posixtestsuite conformance interfaces kill ; + +SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) $(DOTDOT) $(DOTDOT) include ] ; + +SimpleTest 2-1.test : 2-1.c ; +