-# Copyright (C) 2012 Free Software Foundation, Inc.
+# Copyright (C) 2012-2020 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-set testfile stap-probe
+standard_testfile
# Run the tests. We run the tests two different ways: once with a
# plain probe, and once with a probe that has an associated semaphore.
# This returns -1 on failure to compile or start, 0 otherwise.
proc stap_test {exec_name {arg ""}} {
- global testfile hex
+ global testfile hex srcfile
- if {[prepare_for_testing ${testfile}.exp ${exec_name} ${testfile}.c \
- [concat $arg debug]]} {
+ if {[prepare_for_testing "failed to prepare" ${exec_name} $srcfile \
+ [concat additional_flags=$arg debug]]} {
return -1
}
return -1
}
- gdb_test "print \$_probe_argc" "No SystemTap probe at PC $hex" \
+ gdb_test "print \$_probe_argc" "No probe at PC $hex" \
"check argument not at probe point"
- gdb_test "info probes stap" \
- "test *user *$hex .*" \
- "info probes stap"
-
+ if {[string first "-DUSE_SEMAPHORES" $arg] != -1} {
+ gdb_test "info probes stap" \
+ "test *user *$hex *$hex .*"
+ } else {
+ gdb_test "info probes stap" \
+ "test *user *$hex .*"
+ }
+
if {[runto "-pstap test:user"]} {
pass "run to -pstap test:user"
} else {
proc stap_test_no_debuginfo {exec_name {arg ""}} {
global testfile hex
- if {[prepare_for_testing ${testfile}.exp ${exec_name} ${testfile}.c \
- {$arg nodebug optimize=-O2}]} {
+ if {[prepare_for_testing "failed to prepare" ${exec_name} ${testfile}.c \
+ [concat additional_flags=$arg nodebug optimize=-O2]]} {
return -1
}
with_test_prefix "without semaphore, not optimized" {
if {[stap_test "stap-probe-nosem-noopt"] == -1} {
- untested stap-probe.exp
+ untested "stap probe test failed"
return -1
}
}
with_test_prefix "with semaphore, not optimized" {
- stap_test "stap-probe-sem-noopt" "-DUSE_PROBES"
+ stap_test "stap-probe-sem-noopt" "-DUSE_SEMAPHORES"
}
with_test_prefix "without semaphore, optimized" {
}
with_test_prefix "with semaphore, optimized" {
- stap_test_no_debuginfo "stap-probe-sem-opt" "-DUSE_PROBES"
+ stap_test_no_debuginfo "stap-probe-sem-opt" "-DUSE_SEMAPHORES"
}