diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-04-07 11:30:07 +0100 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-04-07 11:30:07 +0100 |
commit | 337532fab150dc531c92a31e179df96b98a619c0 (patch) | |
tree | 0f862fcb81284e5f28106ed7bfdd7d8b421fbd90 /gdb/testsuite | |
parent | ffa547701bec5b3fb92acf049e5442cbbfc95b2c (diff) | |
download | gdb-337532fab150dc531c92a31e179df96b98a619c0.zip gdb-337532fab150dc531c92a31e179df96b98a619c0.tar.gz gdb-337532fab150dc531c92a31e179df96b98a619c0.tar.bz2 |
Properly set alarm value in gdb.threads/non-stop-fair-events.exp
Nowadays, the alarm value is 60, and alarm is generated on some slow
boards. This patch is to pass DejaGNU timeout value to the program,
and move the alarm call before going to infinite loop. If any thread
has activities, the alarm is reset.
gdb/testsuite:
2015-04-07 Yao Qi <yao.qi@linaro.org>
* gdb.threads/non-stop-fair-events.c (SECONDS): New macro.
(child_function): Call alarm.
(main): Move call to alarm into the loop.
* gdb.threads/non-stop-fair-events.exp: Build program with
-DTIMEOUT=$timeout.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/non-stop-fair-events.c | 9 | ||||
-rw-r--r-- | gdb/testsuite/gdb.threads/non-stop-fair-events.exp | 3 |
3 files changed, 17 insertions, 3 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 8c179f9..723bfd1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,11 @@ +2015-04-07 Yao Qi <yao.qi@linaro.org> + + * gdb.threads/non-stop-fair-events.c (SECONDS): New macro. + (child_function): Call alarm. + (main): Move call to alarm into the loop. + * gdb.threads/non-stop-fair-events.exp: Build program with + -DTIMEOUT=$timeout. + 2015-04-06 Doug Evans <xdje42@gmail.com> * lib/pascal.exp (gpc_compile): Rename dest arg to destfile. diff --git a/gdb/testsuite/gdb.threads/non-stop-fair-events.c b/gdb/testsuite/gdb.threads/non-stop-fair-events.c index 6a9d31d..f82c366 100644 --- a/gdb/testsuite/gdb.threads/non-stop-fair-events.c +++ b/gdb/testsuite/gdb.threads/non-stop-fair-events.c @@ -22,6 +22,9 @@ #define NUM_THREADS 10 const int num_threads = NUM_THREADS; +/* Allow for as much timeout as DejaGnu wants, plus a bit of + slack. */ +#define SECONDS (TIMEOUT + 20) pthread_t child_thread[NUM_THREADS]; volatile pthread_t signal_thread; @@ -53,6 +56,8 @@ child_function (void *arg) while (1) { + /* Reset the timer before going to INF_LOOP. */ + alarm (SECONDS); INF_LOOP; /* set thread breakpoint here */ loop_broke (); } @@ -64,8 +69,6 @@ main (void) int res; int i; - alarm (60); - signal (SIGUSR1, handler); for (i = 0; i < NUM_THREADS; i++) @@ -76,6 +79,8 @@ main (void) while (1) { pthread_kill (signal_thread, SIGUSR1); /* set kill breakpoint here */ + /* Reset the timer before going to INF_LOOP. */ + alarm (SECONDS); INF_LOOP; loop_broke (); } diff --git a/gdb/testsuite/gdb.threads/non-stop-fair-events.exp b/gdb/testsuite/gdb.threads/non-stop-fair-events.exp index 9b7b9ca..e2d3f7d 100644 --- a/gdb/testsuite/gdb.threads/non-stop-fair-events.exp +++ b/gdb/testsuite/gdb.threads/non-stop-fair-events.exp @@ -24,7 +24,8 @@ if [target_info exists gdb,nosignals] { return -1 } -if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug pthreads}] == -1} { +set options { "additional_flags=-DTIMEOUT=$timeout" debug pthreads } +if {[prepare_for_testing "failed to prepare" $testfile $srcfile $options] == -1} { return -1 } |