From: Garrett C. <ris...@li...> - 2010-06-21 03:14:15
|
The branch, pu, has been updated via 4aaa81f17ce66894139a1e27eccba85dae34ea54 (commit) via 37f653f5c41b6a347ab382ee75c15acf3a82978b (commit) via 1c385e70b81f9580841f12eaa3106a5f2ace9534 (commit) via b62095f93c4c4e34edc948cbd4d9f39f92a4d290 (commit) via 38bbac335cc10b0db007e871393c216d4bba7143 (commit) via 1e1a3fd3eec33ea81d8a912c569eb57a41b9faab (commit) via 246c55b6ff11862d61341f13ffa19a59c8ec64d6 (commit) via 6f2d70d4a671cdf121c8301db093b86a0e080ea6 (commit) via 4065c2f47676a1b3590ad569feb07e6993167533 (commit) via 6f5eda9e882257afd6ddded59fa8a293e6c11c0e (commit) via c580fbc0a607da39a438af4d78a85f64171af6bf (commit) via 200d76535a50ffd4d06f54933479a8696267d303 (commit) via b8139e0b5a8f20cbd9bbc97528679dc2fcd430a0 (commit) via a147804a653f2e528ce508a4e251c69e7a57c473 (commit) from e6933b95841581fdb6eb3f06e29b592716a95cb8 (commit) - Log ----------------------------------------------------------------- commit 4aaa81f17ce66894139a1e27eccba85dae34ea54 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 20:09:56 2010 -0700 No need to use --[fs]{make,run} anymore. The make targets are now officially in recursive Makefiles, so no need to build the logic into locate-test. An excellent opportunity to remove some gmake-isms too. Signed-off-by: Garrett Cooper <yan...@gm...> commit 37f653f5c41b6a347ab382ee75c15acf3a82978b Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 20:08:04 2010 -0700 Complete the switchover from gmake to POSIX make. Signed-off-by: Garrett Cooper <yan...@gm...> commit 1c385e70b81f9580841f12eaa3106a5f2ace9534 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 20:07:24 2010 -0700 Block off Linux-isms. Signed-off-by: Garrett Cooper <yan...@gm...> commit b62095f93c4c4e34edc948cbd4d9f39f92a4d290 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 20:05:40 2010 -0700 Remove a reference to chrt(1): a linux only util. Signed-off-by: Garrett Cooper <yan...@gm...> commit 38bbac335cc10b0db007e871393c216d4bba7143 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:56:04 2010 -0700 Add test targets. Signed-off-by: Garrett Cooper <yan...@gm...> commit 1e1a3fd3eec33ea81d8a912c569eb57a41b9faab Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:55:02 2010 -0700 Add test target. Signed-off-by: Garrett Cooper <yan...@gm...> commit 246c55b6ff11862d61341f13ffa19a59c8ec64d6 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:53:54 2010 -0700 Yank gmake-isms. Signed-off-by: Garrett Cooper <yan...@gm...> commit 6f2d70d4a671cdf121c8301db093b86a0e080ea6 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:50:54 2010 -0700 Add test target for Makefiles to execute run.sh. Signed-off-by: Garrett Cooper <yan...@gm...> commit 4065c2f47676a1b3590ad569feb07e6993167533 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:45:32 2010 -0700 Change install target to test. Signed-off-by: Garrett Cooper <yan...@gm...> commit 6f5eda9e882257afd6ddded59fa8a293e6c11c0e Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:37:21 2010 -0700 Properly block off linux-isms. Signed-off-by: Garrett Cooper <yan...@gm...> commit c580fbc0a607da39a438af4d78a85f64171af6bf Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:27:55 2010 -0700 Make test wrapper scripts more portable. 1. Remove bashisms. 2. Remove a useless wrapper (because the logic will soon be embedded in the Makefile). 3. Make the scripts more consistent. Signed-off-by: Garrett Cooper <yan...@gm...> commit 200d76535a50ffd4d06f54933479a8696267d303 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:07:40 2010 -0700 Get rid of leftover bashism. Signed-off-by: Garrett Cooper <yan...@gm...> commit b8139e0b5a8f20cbd9bbc97528679dc2fcd430a0 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 19:04:55 2010 -0700 Clean up testcase. It started with a usage message and then evolved to fix some corner cases and moved on to style changes. Signed-off-by: Garrett Cooper <yan...@gm...> commit a147804a653f2e528ce508a4e251c69e7a57c473 Author: Garrett Cooper <yan...@gm...> Date: Sun Jun 20 16:26:18 2010 -0700 Add make agnostic Makefile. Signed-off-by: Garrett Cooper <yan...@gm...> ----------------------------------------------------------------------- Summary of changes: testcases/open_posix_testsuite/GNUmakefile | 32 ++++---------- .../functional/mqueues/GNUmakefile | 3 + .../functional/semaphores/GNUmakefile | 3 + .../functional/semaphores/run.sh | 2 +- .../functional/semaphores/sem_lock.c | 39 ++++++++++------ .../functional/threads/GNUmakefile | 12 ----- .../functional/threads/Makefile | 12 +++++ .../functional/threads/pi_test/GNUmakefile | 8 --- .../functional/threads/pi_test/Makefile | 11 +++++ .../functional/threads/pi_test/run.sh | 47 ++++++++++--------- .../functional/threads/robust_test/GNUmakefile | 9 ---- .../functional/threads/robust_test/Makefile | 12 +++++ .../functional/threads/robust_test/robust1-mode2.c | 6 ++- .../functional/threads/robust_test/robust1-sun.c | 6 ++- .../functional/threads/robust_test/robust2-mode2.c | 6 ++- .../functional/threads/robust_test/robust2-sun.c | 6 ++- .../functional/threads/robust_test/robust3-mode2.c | 8 +++- .../functional/threads/robust_test/run.sh | 44 ++++++++++--------- .../open_posix_testsuite/functional/threads/run.sh | 15 ------ .../functional/timers/GNUmakefile | 3 + testcases/open_posix_testsuite/locate-test | 16 ------- testcases/open_posix_testsuite/stress/Makefile | 6 +++ .../stress/mqueues/GNUmakefile | 21 +++++--- .../stress/semaphores/GNUmakefile | 17 ++++--- 24 files changed, 182 insertions(+), 162 deletions(-) delete mode 100644 testcases/open_posix_testsuite/functional/threads/GNUmakefile create mode 100644 testcases/open_posix_testsuite/functional/threads/Makefile delete mode 100644 testcases/open_posix_testsuite/functional/threads/pi_test/GNUmakefile create mode 100644 testcases/open_posix_testsuite/functional/threads/pi_test/Makefile delete mode 100644 testcases/open_posix_testsuite/functional/threads/robust_test/GNUmakefile create mode 100644 testcases/open_posix_testsuite/functional/threads/robust_test/Makefile delete mode 100755 testcases/open_posix_testsuite/functional/threads/run.sh create mode 100644 testcases/open_posix_testsuite/stress/Makefile diff --git a/testcases/open_posix_testsuite/GNUmakefile b/testcases/open_posix_testsuite/GNUmakefile index 42e1fa8..fd11733 100644 --- a/testcases/open_posix_testsuite/GNUmakefile +++ b/testcases/open_posix_testsuite/GNUmakefile @@ -30,10 +30,6 @@ LOGFILE= $(top_builddir)/logfile RUN_TESTS= $(shell $(top_builddir)/locate-test --execs $(top_builddir)/$(POSIX_TARGET)) BUILD_TESTS= $(shell $(top_builddir)/locate-test --buildable $(top_builddir)/$(POSIX_TARGET)) -FUNCTIONAL_MAKE=`$(top_builddir)/locate-test --fmake` -FUNCTIONAL_RUN= $(shell $(top_builddir)/locate-test --frun) -STRESS_MAKE= `$(top_builddir)/locate-test --smake` -STRESS_RUN= $(shell $(top_builddir)/locate-test --srun) PWD= `pwd` TIMEOUT= $(top_builddir)/t0 $(TIMEOUT_VAL) @@ -66,7 +62,7 @@ clean: -@# Build runnable tests -@find $(top_builddir) -iname \*.test | xargs -n 40 rm -f {} -@find $(top_builddir) -iname \*~ -o -iname \*.o | xargs -n 40 rm -f {} - -@for d in $(FUNCTIONAL_MAKE); do \ + -@for d in functional stress; do \ $(MAKE) -C $$d clean >/dev/null; \ done @@ -177,25 +173,15 @@ $(top_builddir)/t0.val: $(top_builddir)/t0 # Functional/Stress test build and execution functional-make: - @for d in $(FUNCTIONAL_MAKE); do \ - $(MAKE) -C $$d; \ - done - -.PHONY: $(FUNCTIONAL_RUN) - -functional-run: $(FUNCTIONAL_RUN) + $(MAKE) -C functional all -$(FUNCTIONAL_RUN): - cd $@ && ./run.sh +.PHONY: functional-test +functional-test: functional-make + $(MAKE) -C functional test stress-make: - for d in $(STRESS_MAKE); do \ - $(MAKE) -C $$d; \ - done - -.PHONY: $(STRESS_RUN) - -stress-run: $(STRESS_RUN) + $(MAKE) -C stress all -$(STRESS_RUN): - cd $@; ./run.sh +.PHONY: stress-test +stress-test: stress-make + $(MAKE) -C stress test diff --git a/testcases/open_posix_testsuite/functional/mqueues/GNUmakefile b/testcases/open_posix_testsuite/functional/mqueues/GNUmakefile index cf1e447..f99ec61 100644 --- a/testcases/open_posix_testsuite/functional/mqueues/GNUmakefile +++ b/testcases/open_posix_testsuite/functional/mqueues/GNUmakefile @@ -9,3 +9,6 @@ all: send_rev_1.test send_rev_2.test clean: rm -f *.test + +test: + ./run.sh diff --git a/testcases/open_posix_testsuite/functional/semaphores/GNUmakefile b/testcases/open_posix_testsuite/functional/semaphores/GNUmakefile index 348585c..59271be 100644 --- a/testcases/open_posix_testsuite/functional/semaphores/GNUmakefile +++ b/testcases/open_posix_testsuite/functional/semaphores/GNUmakefile @@ -11,3 +11,6 @@ all: $(TARGETS) clean: rm -f $(TARGETS) + +test: + ./run.sh diff --git a/testcases/open_posix_testsuite/functional/semaphores/run.sh b/testcases/open_posix_testsuite/functional/semaphores/run.sh index 955b5b8..282c64e 100755 --- a/testcases/open_posix_testsuite/functional/semaphores/run.sh +++ b/testcases/open_posix_testsuite/functional/semaphores/run.sh @@ -11,7 +11,7 @@ RunTest() { echo "TEST: " $1 - TOTAL=$TOTAL+1 + : $(( TOTAL += 1 )) ./$1 if [ $? -eq 0 ]; then : $(( PASS += 1 )) diff --git a/testcases/open_posix_testsuite/functional/semaphores/sem_lock.c b/testcases/open_posix_testsuite/functional/semaphores/sem_lock.c index d35a180..be95d08 100644 --- a/testcases/open_posix_testsuite/functional/semaphores/sem_lock.c +++ b/testcases/open_posix_testsuite/functional/semaphores/sem_lock.c @@ -30,8 +30,8 @@ int main(int argc, char *argv[]) sem_t *sem_lock; int shared = 1; int value = 1; - pid_t pid=0; - int i, num=0; + pid_t pid = 0; + int i, num = 0; char buf[BUF_SIZE]; char *c; @@ -40,29 +40,40 @@ int main(int argc, char *argv[]) return PTS_UNRESOLVED; #endif if ( (2 != argc) || (( num = atoi(argv[1])) <= 0)) { - fprintf(stdout, "Usage: %s number_of_processes\n", argv[0]); - printf("Set num_of_processes to default value %d \n", DEFAULT_THREADS); + printf("Setting num_of_processes to default value: %d\n", + DEFAULT_THREADS); num = DEFAULT_THREADS; } - sem_lock = (sem_t *)malloc(sizeof(sem_t)); - if (-1 == sem_init(sem_lock, shared, value)) { + if ((sem_lock = (sem_t *)malloc(sizeof(sem_t))) == NULL) { + perror("malloc"); + return PTS_UNRESOLVED; + } + if (sem_init(sem_lock, shared, value) == -1) { perror("sem_init didn't return success\n"); return PTS_UNRESOLVED; } - for (i=1; i<num; i++) - if ((pid = fork())!=0) - { + for (i = 1; i < num; i++) + switch ((pid = fork())) { + case -1: + perror("fork"); + return PTS_UNRESOLVED; + case 0: + break; + default: sleep(2); break; } - sprintf(buf, "%d process_ID:%ld parent_process_ID:%ld child_process_ID:%ld \n", i, (long)getpid(), (long)getppid(), (long)pid); - if (-1 == sem_wait(sem_lock)) { + sprintf(buf, "%d process_ID: %ld parent_process_ID: %ld " + "child_process_ID: %ld\n", i, (long)getpid(), + (long)getppid(), (long)pid); + + if (sem_wait(sem_lock) == -1) { perror("sem_wait didn't return success\n"); return PTS_UNRESOLVED; } - for (i = 1; i<= 10; i++) { - c=buf; + for (i = 1; i <= 10; i++) { + c = buf; while (*c != '\n') { fputc(*c, stdout); c++; @@ -70,7 +81,7 @@ int main(int argc, char *argv[]) fputc('\n', stdout); } - if (-1 == sem_post(sem_lock)) { + if (sem_post(sem_lock) == -1) { perror("sem_wait didn't return success\n"); return PTS_UNRESOLVED; } diff --git a/testcases/open_posix_testsuite/functional/threads/GNUmakefile b/testcases/open_posix_testsuite/functional/threads/GNUmakefile deleted file mode 100644 index 04e94df..0000000 --- a/testcases/open_posix_testsuite/functional/threads/GNUmakefile +++ /dev/null @@ -1,12 +0,0 @@ -SUBDIRS= robust_test pi_test - -all install: - for d in $(SUBDIRS); do \ - $(MAKE) -C $$d $@; \ - done - -clean: - rm -f *~ - for d in $(SUBDIRS); do \ - $(MAKE) -C $$d $@; \ - done diff --git a/testcases/open_posix_testsuite/functional/threads/Makefile b/testcases/open_posix_testsuite/functional/threads/Makefile new file mode 100644 index 0000000..e8cc701 --- /dev/null +++ b/testcases/open_posix_testsuite/functional/threads/Makefile @@ -0,0 +1,12 @@ +SUBDIRS= robust_test pi_test + +all test: + for d in $(SUBDIRS); do \ + $(MAKE) -C $$d $@; \ + done + +clean: + rm -f *~ + for d in $(SUBDIRS); do \ + $(MAKE) -C $$d $@; \ + done diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/GNUmakefile b/testcases/open_posix_testsuite/functional/threads/pi_test/GNUmakefile deleted file mode 100644 index 7423b04..0000000 --- a/testcases/open_posix_testsuite/functional/threads/pi_test/GNUmakefile +++ /dev/null @@ -1,8 +0,0 @@ -CFLAGS+= -I../include -LDLIBS= -lpthread -TARGETS= pitest-1 pitest-2 pitest-3 pitest-4 pitest-5 pitest-6 - -all: $(TARGETS) - -clean: - -rm -rf $(TARGETS) diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/Makefile b/testcases/open_posix_testsuite/functional/threads/pi_test/Makefile new file mode 100644 index 0000000..c887ef2 --- /dev/null +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/Makefile @@ -0,0 +1,11 @@ +CFLAGS+= -I../include +LDLIBS= -lpthread +TARGETS= pitest-1 pitest-2 pitest-3 pitest-4 pitest-5 pitest-6 + +all: $(TARGETS) + +clean: + -rm -rf $(TARGETS) + +test: + ./run.sh diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/run.sh b/testcases/open_posix_testsuite/functional/threads/pi_test/run.sh index 7300cb8..1f95c55 100755 --- a/testcases/open_posix_testsuite/functional/threads/pi_test/run.sh +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh PRIORITY=20 # If users run pi tests from sshd, they need to improve the priority # sshd using the following command. @@ -12,23 +12,26 @@ PRIORITY=20 killall -9 watchdogtimer.sh rm -rf output.* -chrt -f $PRIORITY ../tools/watchdogtimer.sh & +../tools/watchdogtimer.sh & + +TOTAL=0 +FAIL=0 +PASS=0 -declare -i TOTAL=0 -declare -i FAIL=0 -declare -i PASS=0 Run() { - echo "TEST: " $1 - TOTAL=$TOTAL+1 - ./$1 > output.$1 - if [ $? == 0 ]; then - PASS=$PASS+1 - echo -ne "\t\t\t***TEST PASSED***\n\n" - else - FAIL=$FAIL+1 - echo -ne "\t\t\t***TEST FAILED***\n\n" - fi + echo "TEST: " $1 + : $(( TOTAL += 1 )) + ./$1 > output.$1 + if [ $? -eq 0 ]; then + : $(( PASS += 1 )) + echo " ***TEST PASSED***" + echo "" + else + : $(( FAIL += 1 )) + echo " ***TEST FAILED***" + echo "" + fi } TESTS="pitest-1 pitest-2 pitest-3 pitest-4 pitest-5 pitest-6" @@ -37,10 +40,10 @@ for test in $TESTS; do Run $test done -echo -ne "\t\t*****************\n" -echo -ne "\t\t* TOTAL: " $TOTAL *"\n" -echo -ne "\t\t* PASSED: " $PASS *"\n" -echo -ne "\t\t* FAILED: " $FAIL *"\n" -echo -ne "\t\t*****************\n" - - +cat <<EOF + ***************** + * TOTAL: $TOTAL * + * PASSED: $PASS * + * FAILED: $FAIL * + ***************** +EOF diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/GNUmakefile b/testcases/open_posix_testsuite/functional/threads/robust_test/GNUmakefile deleted file mode 100644 index e4490cf..0000000 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/GNUmakefile +++ /dev/null @@ -1,9 +0,0 @@ -CFLAGS+= -I../include -LDLIBS= -lpthread -TARGETS= robust1-mode2 robust1-sun robust2-mode2 robust2-sun \ - robust3-mode2 - -all: $(TARGETS) - -clean: - -rm -rf $(TARGETS) diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/Makefile b/testcases/open_posix_testsuite/functional/threads/robust_test/Makefile new file mode 100644 index 0000000..0c3ba1b --- /dev/null +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/Makefile @@ -0,0 +1,12 @@ +CFLAGS+= -I../include +LDLIBS= -lpthread +TARGETS= robust1-mode2 robust1-sun robust2-mode2 robust2-sun \ + robust3-mode2 + +all: $(TARGETS) + +clean: + -rm -rf $(TARGETS) + +test: + ./run.sh diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-mode2.c b/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-mode2.c index b75f319..9d2e4c4 100644 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-mode2.c +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-mode2.c @@ -55,6 +55,7 @@ void *thread_2(void *arg) rc, strerror(rc)); exit(UNRESOLVED); } +#if __linux__ rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL: pthread_mutex_lock didn't return EOWNERDEAD"); @@ -62,7 +63,7 @@ void *thread_2(void *arg) } DPRINTF(stdout,"Thread 2 lock the mutex and return EOWNERDEAD\n"); pthread_mutex_unlock(&mutex); - + rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL:The mutex shall remain the state EOWNERDEAD " @@ -70,6 +71,7 @@ void *thread_2(void *arg) pthread_mutex_unlock(&mutex); exit(FAIL); } +#endif pthread_exit(NULL); return NULL; } @@ -87,6 +89,7 @@ int main() rc, strerror(rc)); return UNRESOLVED; } +#if __linux__ rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); if (rc != 0) { @@ -94,6 +97,7 @@ int main() rc, strerror(rc)); return UNRESOLVED; } +#endif rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-sun.c b/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-sun.c index b71b650..50dbb13 100644 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-sun.c +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/robust1-sun.c @@ -56,11 +56,12 @@ void *thread_2(void *arg) exit(UNRESOLVED); } +#if __linux__ if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL: pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); } - DPRINTF(stdout,"Thread 2 lock the mutex and return EOWNERDEAD\n"); + DPRINTF(stdout, "Thread 2 lock the mutex and return EOWNERDEAD\n"); pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != ENOTRECOVERABLE) { @@ -69,6 +70,7 @@ void *thread_2(void *arg) pthread_mutex_unlock(&mutex); exit(FAIL); } +#endif pthread_exit(NULL); return NULL; } @@ -86,12 +88,14 @@ int main() rc, strerror(rc)); return UNRESOLVED; } +#if __linux__ rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_SUN_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } +#endif rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-mode2.c b/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-mode2.c index a54cf38..0559c19 100644 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-mode2.c +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-mode2.c @@ -55,6 +55,7 @@ void *thread_2(void *arg) rc, strerror(rc)); exit(UNRESOLVED); } +#if __linux__ if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL:pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); @@ -97,7 +98,8 @@ void *thread_2(void *arg) "(why fails?) in x-mode\n"); pthread_mutex_unlock(&mutex); } - } + } +#endif pthread_exit(NULL); return NULL; } @@ -115,12 +117,14 @@ int main() rc, strerror(rc)); return UNRESOLVED; } +#if __linux__ rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } +#endif rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-sun.c b/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-sun.c index 2532194..690306e 100644 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-sun.c +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/robust2-sun.c @@ -57,12 +57,13 @@ void *thread_2(void *arg) rc, strerror(rc)); exit(UNRESOLVED); } +#if __linux__ if (pthread_mutex_lock(&mutex) != EOWNERDEAD) { EPRINTF("FAIL:pthread_mutex_lock didn't return EOWNERDEAD"); exit(FAIL); } DPRINTF(stdout,"Thread 2 locked the mutex and return EOWNERDEAD\n"); - + if (pthread_mutex_consistent_np(&mutex) == 0) { pthread_mutex_unlock(&mutex); if (pthread_mutex_lock(&mutex) != 0) { @@ -96,6 +97,7 @@ void *thread_2(void *arg) pthread_mutex_unlock(&mutex); } } +#endif pthread_exit(NULL); return NULL; } @@ -113,12 +115,14 @@ int main() rc, strerror(rc)); return UNRESOLVED; } +#if __linux__ rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_SUN_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } +#endif rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/robust3-mode2.c b/testcases/open_posix_testsuite/functional/threads/robust_test/robust3-mode2.c index 8facd26..a3d0669 100644 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/robust3-mode2.c +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/robust3-mode2.c @@ -58,6 +58,7 @@ void *thread_2(void *arg) exit(UNRESOLVED); } +#if __linux__ rc = pthread_mutex_lock(&mutex); if (rc != EOWNERDEAD) { EPRINTF("FAIL:pthread_mutex_lock didn't return EOWNERDEAD \n"); @@ -102,6 +103,7 @@ void *thread_2(void *arg) pthread_mutex_unlock(&mutex); } } +#endif pthread_exit(NULL); return NULL; } @@ -119,12 +121,14 @@ int main() rc, strerror(rc)); return UNRESOLVED; } +#if __linux__ rc = pthread_mutexattr_setrobust_np(&attr, PTHREAD_MUTEX_ROBUST_NP); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutexattr_setrobust_np %d %s", rc, strerror(rc)); return UNRESOLVED; } +#endif rc = pthread_mutex_init(&mutex, &attr); if (rc != 0) { EPRINTF("UNRESOLVED: pthread_mutex_init %d %s", @@ -144,7 +148,7 @@ int main() return UNRESOLVED; } pthread_join(threads[0], NULL); - DPRINTF(stdout,"Thread 1 exit without unlock the mutex...\n "); + DPRINTF(stdout, "Thread 1 exit without unlock the mutex...\n"); rc = pthread_create(&threads[1], &threadattr, thread_2, NULL); if (rc != 0) { @@ -153,7 +157,7 @@ int main() return UNRESOLVED; } pthread_join(threads[1], NULL ); - DPRINTF(stdout,"Thread 2 exit ...\n "); + DPRINTF(stdout, "Thread 2 exit ...\n"); DPRINTF(stdout,"PASS: Test PASSED\n"); return PASS; diff --git a/testcases/open_posix_testsuite/functional/threads/robust_test/run.sh b/testcases/open_posix_testsuite/functional/threads/robust_test/run.sh index 85df8a3..bb04519 100755 --- a/testcases/open_posix_testsuite/functional/threads/robust_test/run.sh +++ b/testcases/open_posix_testsuite/functional/threads/robust_test/run.sh @@ -1,20 +1,22 @@ -#!/bin/bash +#!/bin/sh -declare -i TOTAL=0 -declare -i FAIL=0 -declare -i PASS=0 +TOTAL=0 +FAIL=0 +PASS=0 Run() { - echo "TEST: " $1 - TOTAL=$TOTAL+1 - ./$1 - if [ $? == 0 ]; then - PASS=$PASS+1 - echo -ne "\t\t\t***TEST PASSED***\n\n" - else - FAIL=$FAIL+1 - echo -ne "\t\t\t***TEST FAILED***\n\n" - fi + echo "TEST: " $1 + : $(( TOTAL += 1 )) + ./$1 + if [ $? -eq 0 ]; then + : $(( PASS += 1 )) + echo " ***TEST PASSED***" + echo "" + else + : $(( FAIL += 1 )) + echo " ***TEST FAILED***" + echo "" + fi } TESTS="robust1-sun robust2-sun robust1-mode2 robust2-mode2 robust3-mode2" @@ -22,10 +24,10 @@ for test in $TESTS; do Run $test done -echo -ne "\t\t*****************\n" -echo -ne "\t\t* TOTAL: " $TOTAL *"\n" -echo -ne "\t\t* PASSED: " $PASS *"\n" -echo -ne "\t\t* FAILED: " $FAIL *"\n" -echo -ne "\t\t*****************\n" - - +cat <<EOF + ***************** + * TOTAL: $TOTAL * + * PASSED: $PASS * + * FAILED: $FAIL * + ***************** +EOF diff --git a/testcases/open_posix_testsuite/functional/threads/run.sh b/testcases/open_posix_testsuite/functional/threads/run.sh deleted file mode 100755 index eaf3313..0000000 --- a/testcases/open_posix_testsuite/functional/threads/run.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -CURRENT_DIR=$(pwd) -TEST_DIRS="robust_test pi_test" - -for test_dir in $TEST_DIRS; do - -echo "" -echo "Run $test_dir tests" -echo "===============" -echo "" - cd $CURRENT_DIR/$test_dir; - ./run.sh -done - diff --git a/testcases/open_posix_testsuite/functional/timers/GNUmakefile b/testcases/open_posix_testsuite/functional/timers/GNUmakefile index 0d484da..653fe64 100644 --- a/testcases/open_posix_testsuite/functional/timers/GNUmakefile +++ b/testcases/open_posix_testsuite/functional/timers/GNUmakefile @@ -11,3 +11,6 @@ all clean: for d in $(SUBDIRS); do \ $(MAKE) -C $$d $@; \ done + +test: + ./run.sh diff --git a/testcases/open_posix_testsuite/locate-test b/testcases/open_posix_testsuite/locate-test index 3d8c8ee..47386c9 100755 --- a/testcases/open_posix_testsuite/locate-test +++ b/testcases/open_posix_testsuite/locate-test @@ -61,22 +61,6 @@ do execs="( ( -name [0-9]*-[0-9]*.c -o -name [0-9]*-[0-9]*.sh ) -a ! -name *-buildonly* )"; shift; ;; - "--fmake") - find functional/ -maxdepth 2 -mindepth 2 -type f -name $MAKEFILE -exec dirname '{}' ';' - exit 0; - ;; - "--frun") - find functional/ -maxdepth 2 -mindepth 2 -type f -name "run.sh" -exec dirname '{}' ';' - exit 0; - ;; - "--smake") - find stress/ -maxdepth 2 -mindepth 2 -type f -name $MAKEFILE -exec dirname '{}' ';' - exit 0; - ;; - "--srun") - find stress/ -maxdepth 2 -mindepth 2 -type f -name "run.sh" -exec dirname '{}' ';' - exit 0; - ;; "--help") usage; exit 0; diff --git a/testcases/open_posix_testsuite/stress/Makefile b/testcases/open_posix_testsuite/stress/Makefile new file mode 100644 index 0000000..6b989fc --- /dev/null +++ b/testcases/open_posix_testsuite/stress/Makefile @@ -0,0 +1,6 @@ +SUBDIRS= mqueues semaphores + +all clean test: + for d in $(SUBDIRS); do \ + $(MAKE) -C $$d $@; \ + done diff --git a/testcases/open_posix_testsuite/stress/mqueues/GNUmakefile b/testcases/open_posix_testsuite/stress/mqueues/GNUmakefile index e014ea9..40380d6 100644 --- a/testcases/open_posix_testsuite/stress/mqueues/GNUmakefile +++ b/testcases/open_posix_testsuite/stress/mqueues/GNUmakefile @@ -1,13 +1,18 @@ -INCLUDE = -I../../include -LIB=-lrt +CFLAGS+= -I../../include +LDLIBS+= -lrt -CFLAGS=-Wall -O2 -g +TARGETS= multi_send_rev_1.test multi_send_rev_2.test -all: multi_send_rev_1.test multi_send_rev_2.test +all: $(TARGETS) + +multi_send_rev_1.test: multi_send_rev_1.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) + +multi_send_rev_2.test: multi_send_rev_2.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) -%.test : %.c - $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ $(LIB) clean: - rm *.test + rm -f $(TARGETS) - +test: + @./run.sh diff --git a/testcases/open_posix_testsuite/stress/semaphores/GNUmakefile b/testcases/open_posix_testsuite/stress/semaphores/GNUmakefile index 017c014..da410b0 100644 --- a/testcases/open_posix_testsuite/stress/semaphores/GNUmakefile +++ b/testcases/open_posix_testsuite/stress/semaphores/GNUmakefile @@ -1,12 +1,15 @@ -INCLUDE = -I../../include +CFLAGS+= -I../../include +LDLIBS+= -lpthread -CFLAGS=-Wall -O2 -g +TARGETS+= multi_con_pro.test -all: multi_con_pro.test +all: $(TARGETS) + +multi_con_pro.test: multi_con_pro.c + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LDLIBS) -%.test : %.c - $(CC) $(CFLAGS) $(INCLUDE) $< -o $@ -lpthread clean: - rm *.test + rm -f $(TARGETS) - +test: + @./run.sh hooks/post-receive -- ltp |