From: Garrett C. <su...@li...> - 2011-01-14 07:04:51
|
The branch, master, has been updated via 99c4f25c4723c6c1cbf47f4e7306134f18e01656 (commit) via 21488886543e52e15b140eb0a84dd8a189784af8 (commit) via 150cc00122f09d718dbfbb491d86d2cf3ef16dea (commit) via c240d1c5aa58dada99bf9c4b6ebbdd044afccca3 (commit) via 1a2678b1e18a7169ac564c64b3c1c6bb271b73a2 (commit) via c8c2e13750087c911787d3376183a7ba79a1c8b8 (commit) via 8732528a6de497e366fdeee628b0274b58495d47 (commit) via f1757187272c0cf3a6b2e6264003d48556a9dbb9 (commit) from cd72458cab983e7955362055a5cc9335e3a9ffb9 (commit) - Log ----------------------------------------------------------------- commit 99c4f25c4723c6c1cbf47f4e7306134f18e01656 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 23:04:11 2011 -0800 Fix test compilation. Signed-off-by: Peng Haitao <pe...@cn...> commit 21488886543e52e15b140eb0a84dd8a189784af8 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 23:02:46 2011 -0800 Readd newline so gcc won't whine. Signed-off-by: Garrett Cooper <yan...@gm...> commit 150cc00122f09d718dbfbb491d86d2cf3ef16dea Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 23:02:10 2011 -0800 Remove conflict markers. Reported-by: Peng Haitao <pe...@cn...> Signed-off-by: Garrett Cooper <yan...@gm...> commit c240d1c5aa58dada99bf9c4b6ebbdd044afccca3 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 22:57:49 2011 -0800 Readd newline at the EOF so gcc doesn't whine. Signed-off-by: Garrett Cooper <yan...@gm...> commit 1a2678b1e18a7169ac564c64b3c1c6bb271b73a2 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 22:57:02 2011 -0800 Remove conflict marker. Reported-by: Peng Haitao <pe...@cn...> Signed-off-by: Garrett Cooper <yan...@gm...> commit c8c2e13750087c911787d3376183a7ba79a1c8b8 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 22:55:29 2011 -0800 Fix test. Message catalog generation was out broken because the wrong values were being tested via fopen, fclose, and fputs. Signed-off-by: Garrett Cooper <yan...@gm...> commit 8732528a6de497e366fdeee628b0274b58495d47 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 22:40:59 2011 -0800 Fix test. 1. Remove race condition in executing the thread by adding a sleep in main. 2. Report all pthread(3) related errors properly with the return value and strerror, not perror.. Signed-off-by: Garrett Cooper <yan...@gm...> commit f1757187272c0cf3a6b2e6264003d48556a9dbb9 Author: Garrett Cooper <yan...@gm...> Date: Thu Jan 13 22:14:33 2011 -0800 Fix improperly merged code. Signed-off-by: Garrett Cooper <yan...@gm...> ----------------------------------------------------------------------- Summary of changes: .../conformance/interfaces/fork/21-1.c | 66 +++++------------ .../conformance/interfaces/fork/7-1.c | 29 ++++---- .../conformance/interfaces/fork/8-1.c | 79 ++++--------------- .../conformance/interfaces/fork/testfrmw.c | 2 +- .../conformance/interfaces/pthread_join/3-1.c | 66 +++++++++-------- .../interfaces/pthread_join/threads_scenarii.c | 71 ++++++++---------- .../functional/threads/pi_test/pitest-4.c | 4 +- testcases/open_posix_testsuite/tools/t0.c | 2 +- 8 files changed, 124 insertions(+), 195 deletions(-) diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/21-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/21-1.c index 70f29d1..0924274 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/21-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/21-1.c @@ -33,24 +33,22 @@ /********************************************************************************************/ /****************************** standard includes *****************************************/ /********************************************************************************************/ -#include <pthread.h> - #include <stdarg.h> - #include <stdio.h> - #include <stdlib.h> - #include <string.h> - #include <unistd.h> - #include <sys/wait.h> - #include <errno.h> - -#include <semaphore.h> +#include <errno.h> #include <fcntl.h> +#include <pthread.h> +#include <semaphore.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <unistd.h> /********************************************************************************************/ /****************************** Test framework *****************************************/ /********************************************************************************************/ #include "testfrmw.h" - #include "testfrmw.c" +#include "testfrmw.c" /* This header is responsible for defining the following macros: * UNRESOLVED(ret, descr); * where descr is a description of the error and ret is an int (error code for example) @@ -83,26 +81,19 @@ sem_t * sem; /* Thread function */ -void * threaded(void * arg) +void * threaded(void *arg) { int ret = 0; - do - { + do { ret = sem_wait(sem); - } - while ((ret != 0) && (errno == EINTR)); + } while (ret != 0 && errno == EINTR); if (ret != 0) - { UNRESOLVED(errno, "failed to wait for the semaphore in child"); - } - if (*(pid_t *) arg != getpid()) ->>>>>>> origin - { + if (*((pid_t *) arg) != getpid()) FAILED("The thread is executing in the child process"); - } return NULL; } @@ -122,10 +113,8 @@ int main(int argc, char * argv[]) /* Initialize the semaphore */ sem = sem_open("/fork_21_1", O_CREAT, O_RDWR, 0); - if (sem == (sem_t*) SEM_FAILED) - { + if (sem == SEM_FAILED) UNRESOLVED(errno, "Failed to open the semaphore"); - } sem_unlink("/fork_21_1"); @@ -133,33 +122,24 @@ int main(int argc, char * argv[]) ret = pthread_create(&th, NULL, threaded, &ctl); if (ret != 0) - { UNRESOLVED(ret, "Failed to create the thread"); - } /* Create the child */ child = fork(); if (child == -1) - { UNRESOLVED(errno, "Failed to fork"); - } /* We post the semaphore twice */ - do - { + do { ret = sem_post(sem); - } - while ((ret != 0) && (errno == EINTR)); + } while (ret != 0 && errno == EINTR); if (ret != 0) - { UNRESOLVED(errno, "Failed to post the semaphore"); - } /* child */ - if (child == 0) - { + if (child == 0) { /* sleep a little while to let the thread execute in case it exists */ sleep(1); @@ -171,29 +151,21 @@ int main(int argc, char * argv[]) ctl = waitpid(child, &status, 0); if (ctl != child) - { UNRESOLVED(errno, "Waitpid returned the wrong PID"); - } - if (!WIFEXITED(status) || (WEXITSTATUS(status) != PTS_PASS)) - { + if (!WIFEXITED(status) || WEXITSTATUS(status) != PTS_PASS) FAILED("Child exited abnormally"); - } /* Destroy everything */ ret = sem_close(sem); if (ret != 0) - { UNRESOLVED(errno, "Failed to close the semaphore"); - } ret = pthread_join(th, NULL); if (ret != 0) - { UNRESOLVED(ret, "Failed to join the thread in parent"); - } /* Test passed */ #if VERBOSE > 0 @@ -201,4 +173,4 @@ int main(int argc, char * argv[]) #endif PASSED; -} \ No newline at end of file +} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c index 09f229e..acbee77 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/7-1.c @@ -31,6 +31,9 @@ /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ #define _POSIX_C_SOURCE 200112L +#include <sys/wait.h> +#include <errno.h> +#include <nl_types.h> #include <pthread.h> #include <stdarg.h> #include <stdio.h> @@ -38,11 +41,6 @@ #include <string.h> #include <unistd.h> -#include <sys/wait.h> -#include <errno.h> - -#include <nl_types.h> - #include "testfrmw.h" #include "testfrmw.c" @@ -87,16 +85,22 @@ static char *messcat_in = static int create_catalog(void) { - FILE *f = fopen(MESSCAT_IN, "w"); + FILE *f; - if (f == NULL) + if ((f = fopen(MESSCAT_IN, "w")) == NULL) { + perror("fopen"); return 1; + } - if (fputs(messcat_in, f) <= 0) + if (fputs(messcat_in, f) == EOF) { + perror("fputs"); return 1; + } - if (fclose(f)) + if (fclose(f) == EOF) { + perror("fclose"); return 1; + } return 0; } @@ -112,14 +116,11 @@ int main(int argc, char * argv[]) /* Generate the message catalog file from the text sourcefile */ if (system(NULL)) { - if (create_catalog() != 0) { + if (create_catalog() != 0) UNRESOLVED(errno, "Can't create "MESSCAT_IN); - } ret = system("gencat "MESSCAT_OUT" "MESSCAT_IN); - if (messcat == -1) - { if (ret != 0) output("Could not find the source file for message catalog.\n" \ "You may need to execute gencat yourself.\n"); @@ -161,4 +162,4 @@ int main(int argc, char * argv[]) output("Test passed\n"); #endif PASSED; -} \ No newline at end of file +} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/8-1.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/8-1.c index 086dc33..f5035a9 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/8-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/8-1.c @@ -32,9 +32,6 @@ /* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ #define _POSIX_C_SOURCE 200112L -/********************************************************************************************/ -/****************************** standard includes *****************************************/ -/********************************************************************************************/ #include <pthread.h> #include <stdarg.h> #include <stdio.h> @@ -47,9 +44,6 @@ #include <sys/times.h> -/********************************************************************************************/ -/****************************** Test framework *****************************************/ -/********************************************************************************************/ #include "testfrmw.h" #include "testfrmw.c" /* This header is responsible for defining the following macros: @@ -70,107 +64,75 @@ * Those may be used to output information. */ -/********************************************************************************************/ -/********************************** Configuration ******************************************/ -/********************************************************************************************/ #ifndef VERBOSE #define VERBOSE 1 #endif -/********************************************************************************************/ -/*********************************** Test case *****************************************/ -/********************************************************************************************/ - -/* The main test function. */ int main(int argc, char * argv[]) { + struct tms ini_tms, parent_tms, child_tms; + int status; pid_t child, ctl; clock_t st_time, cur_time; - struct tms ini_tms, parent_tms, child_tms; - - /* Initialize output */ output_init(); - /* Initialize first times */ st_time = times(&ini_tms); if (st_time == -1) - { UNRESOLVED(errno, "times failed"); - } - if ((ini_tms.tms_cutime != 0) || (ini_tms.tms_cstime != 0)) - { - FAILED("The process is created with non-zero tms_cutime or tms_cstime"); - } + if (ini_tms.tms_cutime != 0 || ini_tms.tms_cstime != 0) + FAILED("The process is created with non-zero tms_cutime or " + "tms_cstime"); #if VERBOSE > 1 output("Starting loop...\n"); - #endif /* Busy loop for some times */ - do - { + do { cur_time = times(&parent_tms); if (cur_time == (clock_t) -1) - { UNRESOLVED(errno, "times failed"); - } - } - while ((cur_time - st_time) < sysconf(_SC_CLK_TCK)); + } while ((cur_time - st_time) < sysconf(_SC_CLK_TCK)); #if VERBOSE > 1 - output("Busy loop terminated\n"); - output(" Real time: %ld, User Time %ld, System Time %ld, Ticks per sec %ld\n", (long) (cur_time - st_time), (long) (parent_tms.tms_utime - ini_tms.tms_utime), (long) (parent_tms.tms_stime - ini_tms.tms_stime), sysconf(_SC_CLK_TCK)); - #endif /* Create the child */ child = fork(); if (child == -1) - { UNRESOLVED(errno, "Failed to fork"); - } /* child */ - if (child == 0) - { + if (child == 0) { cur_time = times(&child_tms); if (cur_time == (clock_t) -1) - { UNRESOLVED(errno, "times failed"); - } if ((child_tms.tms_utime + child_tms.tms_stime) >= sysconf(_SC_CLK_TCK)) - { - FAILED("The tms struct was not reset during fork() operation"); - } + FAILED("The tms struct was not reset during fork " + "operation"); - do - { + do { cur_time = times(&child_tms); if (cur_time == -1) - { UNRESOLVED(errno, "times failed"); - } - } - while ((child_tms.tms_utime + child_tms.tms_stime) <= 0); ->>>>>>> origin + } while ((child_tms.tms_utime + child_tms.tms_stime) <= 0); /* We're done */ exit(PTS_PASS); @@ -180,14 +142,10 @@ int main(int argc, char * argv[]) ctl = waitpid(child, &status, 0); if (ctl != child) - { UNRESOLVED(errno, "Waitpid returned the wrong PID"); - } - if (!WIFEXITED(status) || (WEXITSTATUS(status) != PTS_PASS)) - { + if (!WIFEXITED(status) || WEXITSTATUS(status) != PTS_PASS) FAILED("Child exited abnormally"); - } /* Check the children times were reported as expected */ cur_time = times(&parent_tms); @@ -209,14 +167,11 @@ int main(int argc, char * argv[]) #endif if (cur_time == -1) - { UNRESOLVED(errno, "times failed"); - } - if ((parent_tms.tms_cutime == 0) && (parent_tms.tms_cstime == 0)) - { - FAILED("The process is created with non-zero tms_cutime or tms_cstime"); - } + if (parent_tms.tms_cutime == 0 && parent_tms.tms_cstime == 0) + FAILED("The process is created with non-zero tms_cutime or " + "tms_cstime"); /* Test passed */ #if VERBOSE > 0 @@ -226,4 +181,4 @@ int main(int argc, char * argv[]) #endif PASSED; -} \ No newline at end of file +} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/fork/testfrmw.c b/testcases/open_posix_testsuite/conformance/interfaces/fork/testfrmw.c index f0d9f03..0539635 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/fork/testfrmw.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/fork/testfrmw.c @@ -66,4 +66,4 @@ void output_fini() /*do nothing */ return; } -#endif \ No newline at end of file +#endif diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/3-1.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/3-1.c index efdf88f..df61c25 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/3-1.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/3-1.c @@ -23,6 +23,7 @@ #include <pthread.h> #include <stdio.h> +#include <string.h> #include <unistd.h> #include "posixtest.h" @@ -33,29 +34,38 @@ int cleanup_flag; /* Flag to indicate the thread's cleanup handler was called */ * cleanup_flag is 1, it means that the thread was canceled. */ void a_cleanup_func() { - cleanup_flag=1; - return; + cleanup_flag = 1; } /* Thread's function. */ void *a_thread_func() { - pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL); - pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL); + int err; + + if ((err = pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL)) != 0) { + fprintf(stderr, "pthread_setcancelstate: %s", strerror(err)); + goto thread_exit_failure; + } + + if ((err = pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, NULL)) != 0) { + fprintf(stderr, "pthread_setcanceltype: %s", strerror(err)); + goto thread_exit_failure; + } /* Set up the cleanup handler */ - pthread_cleanup_push(a_cleanup_func,NULL); + pthread_cleanup_push(a_cleanup_func, NULL); /* Wait for a timeout period for the cancel request to be sent. */ sleep(TIMEOUT); - /* Should not get here, but just in case pthread_testcancel() didn't work. */ - /* Cancel request timed out. */ + /* Should not get here, but just in case pthread_testcancel() didn't + * work -- the cancel request timed out. */ pthread_cleanup_pop(0); - cleanup_flag=-1; - pthread_exit(0); +thread_exit_failure: + cleanup_flag = -1; + return NULL; } @@ -63,43 +73,39 @@ int main() { pthread_t new_th; - /* Initialize flag */ - cleanup_flag = 0; + int err; - /* Create a new thread. */ - if (pthread_create(&new_th, NULL, a_thread_func, NULL) != 0) - { - perror("Error creating thread\n"); + if ((err = pthread_create(&new_th, NULL, a_thread_func, NULL)) != 0) { + fprintf(stderr, "pthread_create: %s\n", strerror(err)); return PTS_UNRESOLVED; } - /* Send cancel request to the thread. */ - if (pthread_cancel(new_th) != 0) - { - perror("Couldn't cancel thread\n"); + /* Remove potential for race */ + sleep(TIMEOUT / 2); + + if ((err = pthread_cancel(new_th)) != 0) { + fprintf(stderr, "pthread_cancel: %s\n", strerror(err)); return PTS_UNRESOLVED; } - /* Wait for thread to return */ - if (pthread_join(new_th, NULL) != 0) - { - perror("Error in pthread_join()\n"); + if ((err = pthread_join(new_th, NULL)) != 0) { + fprintf(stderr, "pthread_join: %s\n", strerror(err)); return PTS_UNRESOLVED; } - if (cleanup_flag == 0) - { - printf("Test FAILED: Thread did not finish execution when pthread_join returned. \n"); + if (cleanup_flag == 0) { + printf("Test FAILED: Thread did not finish execution when " + "pthread_join returned.\n"); return PTS_FAIL; } - if (cleanup_flag == -1) - { - perror("Error in pthread_testcancel(). Cancel request timed out.\n"); + if (cleanup_flag == -1) { + printf("Error in pthread_testcancel. Cancel request timed " + "out.\n"); return PTS_UNRESOLVED; } printf("Test PASSED\n"); return PTS_PASS; -} \ No newline at end of file +} diff --git a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/threads_scenarii.c b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/threads_scenarii.c index 479b28c..cf0bfa7 100644 --- a/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/threads_scenarii.c +++ b/testcases/open_posix_testsuite/conformance/interfaces/pthread_join/threads_scenarii.c @@ -137,10 +137,10 @@ void scenar_init() for (i = 0; i < NSCENAR; i++) { #if VERBOSE > 2 - output("Initializing attribute for scenario %i: %s\n", i, scenarii[ i ].descr); + output("Initializing attribute for scenario %i: %s\n", i, scenarii[i].descr); #endif - ret = pthread_attr_init(&scenarii[ i ].ta); + ret = pthread_attr_init(&scenarii[i].ta); if (ret != 0) { @@ -151,7 +151,7 @@ void scenar_init() if (tps > 0) /* This routine is dependent on the Thread Execution Scheduling option */ { - if (scenarii[ i ].explicitsched == 1) + if (scenarii[i].explicitsched == 1) ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_EXPLICIT_SCHED); else ret = pthread_attr_setinheritsched(&scenarii[i].ta, PTHREAD_INHERIT_SCHED); @@ -175,14 +175,14 @@ void scenar_init() if (tps > 0) /* This routine is dependent on the Thread Execution Scheduling option */ { - if (scenarii[ i ].schedpolicy == 1) + if (scenarii[i].schedpolicy == 1) { - ret = pthread_attr_setschedpolicy(&scenarii[ i ].ta, SCHED_FIFO); + ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_FIFO); } - if (scenarii[ i ].schedpolicy == 2) + if (scenarii[i].schedpolicy == 2) { - ret = pthread_attr_setschedpolicy(&scenarii[ i ].ta, SCHED_RR); + ret = pthread_attr_setschedpolicy(&scenarii[i].ta, SCHED_RR); } if (ret != 0) @@ -191,7 +191,7 @@ void scenar_init() } #if VERBOSE > 4 - if (scenarii[ i ].schedpolicy) + if (scenarii[i].schedpolicy) output("Sched policy was set sucessfully\n"); else output("Sched policy untouched\n"); @@ -204,30 +204,25 @@ void scenar_init() #endif - if (scenarii[ i ].schedparam != 0) + if (scenarii[i].schedparam != 0) { struct sched_param sp; - ret = pthread_attr_getschedpolicy(&scenarii[ i ].ta, &old); + ret = pthread_attr_getschedpolicy(&scenarii[i].ta, &old); if (ret != 0) { UNRESOLVED(ret, "Unable to get sched policy from attribute"); } - if (scenarii[ i ].schedparam == 1) + if (scenarii[i].schedparam == 1) sp.sched_priority = sched_get_priority_max( old ); - if (scenarii[ i ].schedparam == -1) - sp.sched_priority = sched_get_priority_min( old ); - sp.sched_priority = sched_get_priority_max(old); - - if (scenarii[ i ].schedparam == -1) + if (scenarii[i].schedparam == -1) sp.sched_priority = sched_get_priority_min(old); ->>>>>>> origin - ret = pthread_attr_setschedparam(&scenarii[ i ].ta, &sp); + ret = pthread_attr_setschedparam(&scenarii[i].ta, &sp); if (ret != 0) { @@ -246,21 +241,21 @@ void scenar_init() if (tps > 0) /* This routine is dependent on the Thread Execution Scheduling option */ { - ret = pthread_attr_getscope(&scenarii[ i ].ta, &old); + ret = pthread_attr_getscope(&scenarii[i].ta, &old); if (ret != 0) { UNRESOLVED(ret, "Failed to get contension scope from thread attribute"); } - if (scenarii[ i ].altscope != 0) + if (scenarii[i].altscope != 0) { if (old == PTHREAD_SCOPE_PROCESS) old = PTHREAD_SCOPE_SYSTEM; else old = PTHREAD_SCOPE_PROCESS; - ret = pthread_attr_setscope(&scenarii[ i ].ta, old); + ret = pthread_attr_setscope(&scenarii[i].ta, old); //if (ret != 0) { UNRESOLVED(ret, "Failed to set contension scope"); } if (ret != 0) @@ -301,7 +296,7 @@ void scenar_init() UNRESOLVED(errno, "Unable to alloc enough memory for alternative stack"); } - ret = pthread_attr_setstack(&scenarii[i].ta, scenarii[ i ].bottom, minstacksize); + ret = pthread_attr_setstack(&scenarii[i].ta, scenarii[i].bottom, minstacksize); if (ret != 0) { @@ -309,7 +304,7 @@ void scenar_init() } #if VERBOSE > 1 - output("Alternate stack created successfully. Bottom=%p, Size=%i\n", scenarii[ i ].bottom, minstacksize); + output("Alternate stack created successfully. Bottom=%p, Size=%i\n", scenarii[i].bottom, minstacksize); #endif @@ -323,17 +318,17 @@ void scenar_init() #endif #ifndef WITHOUT_XOPEN - if (scenarii[ i ].guard != 0) + if (scenarii[i].guard != 0) { - if (scenarii[ i ].guard == 1) - ret = pthread_attr_setguardsize( &scenarii[ i ].ta, 0 ); + if (scenarii[i].guard == 1) + ret = pthread_attr_setguardsize( &scenarii[i].ta, 0 ); - if (scenarii[ i ].guard == 2) - ret = pthread_attr_setguardsize( &scenarii[ i ].ta, pagesize ); - ret = pthread_attr_setguardsize(&scenarii[ i ].ta, 0); + if (scenarii[i].guard == 2) + ret = pthread_attr_setguardsize( &scenarii[i].ta, pagesize ); + ret = pthread_attr_setguardsize(&scenarii[i].ta, 0); - if (scenarii[ i ].guard == 2) - ret = pthread_attr_setguardsize(&scenarii[ i ].ta, pagesize); + if (scenarii[i].guard == 2) + ret = pthread_attr_setguardsize(&scenarii[i].ta, pagesize); if (ret != 0) { @@ -341,7 +336,7 @@ void scenar_init() } #if VERBOSE > 4 - output("Guard size set to %i\n", (scenarii[ i ].guard == 1) ? 1 : pagesize); + output("Guard size set to %i\n", (scenarii[i].guard == 1) ? 1 : pagesize); #endif @@ -352,9 +347,9 @@ void scenar_init() if (tss > 0) /* This routine is dependent on the Thread Stack Size Attribute option */ { - if (scenarii[ i ].altsize != 0) + if (scenarii[i].altsize != 0) { - ret = pthread_attr_setstacksize(&scenarii[ i ].ta, minstacksize); + ret = pthread_attr_setstacksize(&scenarii[i].ta, minstacksize); if (ret != 0) { @@ -390,10 +385,10 @@ void scenar_fini(void) for (i = 0; i < NSCENAR; i++) { - if (scenarii[ i ].bottom != NULL) - free(scenarii[ i ].bottom); + if (scenarii[i].bottom != NULL) + free(scenarii[i].bottom); - ret = pthread_attr_destroy(&scenarii[ i ].ta); + ret = pthread_attr_destroy(&scenarii[i].ta); if (ret != 0) { @@ -487,4 +482,4 @@ int main (int argc, char *argv[]) PASSED; } -#endif \ No newline at end of file +#endif diff --git a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c index dca4f07..ad940dc 100644 --- a/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c +++ b/testcases/open_posix_testsuite/functional/threads/pi_test/pitest-4.c @@ -217,7 +217,7 @@ void *thread_tb2(void *arg) DPRINTF(stdout, "#EVENT %f Thread TB2 Started\n", seconds_read() - base_time); - boost_time.tv_sec = time(NULL) + *(time_t *)timeoutsec; + boost_time.tv_sec = time(NULL) + *(time_t *)arg; boost_time.tv_nsec = 0; t0 = seconds_read(); @@ -341,4 +341,4 @@ int main(int argc, char **argv) ts_stop = 1; DPRINTF(stderr,"Main Thread: stop sampler thread\n"); return 0; -} \ No newline at end of file +} diff --git a/testcases/open_posix_testsuite/tools/t0.c b/testcases/open_posix_testsuite/tools/t0.c index 2041465..4fd719d 100644 --- a/testcases/open_posix_testsuite/tools/t0.c +++ b/testcases/open_posix_testsuite/tools/t0.c @@ -83,4 +83,4 @@ int main (int argc, char * argv[]) /* Application was not launched */ perror("Unable to run child application"); return 1; -} \ No newline at end of file +} hooks/post-receive -- ltp |