aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/perftest.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/lib/perftest.exp')
-rw-r--r--gdb/testsuite/lib/perftest.exp56
1 files changed, 37 insertions, 19 deletions
diff --git a/gdb/testsuite/lib/perftest.exp b/gdb/testsuite/lib/perftest.exp
index 7c334ac..e5398e3 100644
--- a/gdb/testsuite/lib/perftest.exp
+++ b/gdb/testsuite/lib/perftest.exp
@@ -42,14 +42,13 @@ namespace eval PerfTest {
# actual compilation. Return zero if compilation is successful,
# otherwise return non-zero.
proc compile {body} {
- global GDB_PERFTEST_MODE
-
- if { [info exists GDB_PERFTEST_MODE]
- && [string compare $GDB_PERFTEST_MODE "run"] } {
- return [uplevel 2 $body]
- }
+ return [uplevel 2 $body]
+ }
- return 0
+ # Run the startup code. Return zero if startup is successful,
+ # otherwise return non-zero.
+ proc startup {body} {
+ return [uplevel 2 $body]
}
# Start up GDB.
@@ -57,7 +56,8 @@ namespace eval PerfTest {
uplevel 2 $body
}
- # Run the performance test.
+ # Run the performance test. Return zero if the run is successful,
+ # otherwise return non-zero.
proc run {body} {
global timeout
global GDB_PERFTEST_TIMEOUT
@@ -68,36 +68,56 @@ namespace eval PerfTest {
} else {
set timeout 3000
}
- uplevel 2 $body
+ set result [uplevel 2 $body]
set timeout $oldtimeout
+ return $result
}
# The top-level interface to PerfTest.
# COMPILE is the tcl code to generate and compile source files.
- # Return zero if compilation is successful, otherwise return
- # non-zero.
# STARTUP is the tcl code to start up GDB.
# RUN is the tcl code to drive GDB to do some operations.
+ # Each of COMPILE, STARTUP, and RUN return zero if successful, and
+ # non-zero if there's a failure.
+
proc assemble {compile startup run} {
global GDB_PERFTEST_MODE
- if { [eval compile {$compile}] } {
- untested "Could not compile source files."
+ if ![info exists GDB_PERFTEST_MODE] {
return
}
+ if { [string compare $GDB_PERFTEST_MODE "run"] != 0 } {
+ if { [eval compile {$compile}] } {
+ untested "Could not compile source files."
+ return
+ }
+ }
+
# Don't execute the run if GDB_PERFTEST_MODE=compile.
- if { [info exists GDB_PERFTEST_MODE]
- && [string compare $GDB_PERFTEST_MODE "compile"] == 0} {
+ if { [string compare $GDB_PERFTEST_MODE "compile"] == 0} {
+ return
+ }
+
+ verbose -log "PerfTest::assemble, startup ..."
+
+ if [eval startup {$startup}] {
+ fail "startup"
return
}
- eval $startup
+ verbose -log "PerfTest::assemble, done startup"
_setup_perftest
- eval run {$run}
+ verbose -log "PerfTest::assemble, run ..."
+
+ if [eval run {$run}] {
+ fail "run"
+ }
+
+ verbose -log "PerfTest::assemble, run complete."
_teardown_perftest
}
@@ -109,11 +129,9 @@ proc skip_perf_tests { } {
global GDB_PERFTEST_MODE
if [info exists GDB_PERFTEST_MODE] {
-
if { "$GDB_PERFTEST_MODE" != "compile"
&& "$GDB_PERFTEST_MODE" != "run"
&& "$GDB_PERFTEST_MODE" != "both" } {
- # GDB_PERFTEST_MODE=compile|run|both is allowed.
error "Unknown value of GDB_PERFTEST_MODE."
return 1
}