public inbox for archer-commits@sourceware.org
help / color / mirror / Atom feed
* [SCM] archer-sergiodj-stap: added basic tests
@ 2011-02-14 20:46 tromey
0 siblings, 0 replies; only message in thread
From: tromey @ 2011-02-14 20:46 UTC (permalink / raw)
To: archer-commits
The branch, archer-sergiodj-stap has been updated
via f80fe6c9120b317fbff2bbeb70cc1d36bec5574b (commit)
from 48cea42ca3cfe0e8eba444b2a70ba5b7342c5c60 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email.
- Log -----------------------------------------------------------------
commit f80fe6c9120b317fbff2bbeb70cc1d36bec5574b
Author: Tom Tromey <tromey@redhat.com>
Date: Mon Feb 14 13:46:32 2011 -0700
added basic tests
-----------------------------------------------------------------------
Summary of changes:
gdb/testsuite/gdb.base/stap-probe.c | 49 +++++++++++++++++++++++++++
gdb/testsuite/gdb.base/stap-probe.exp | 60 +++++++++++++++++++++++++++++++++
2 files changed, 109 insertions(+), 0 deletions(-)
create mode 100644 gdb/testsuite/gdb.base/stap-probe.c
create mode 100644 gdb/testsuite/gdb.base/stap-probe.exp
First 500 lines of diff:
diff --git a/gdb/testsuite/gdb.base/stap-probe.c b/gdb/testsuite/gdb.base/stap-probe.c
new file mode 100644
index 0000000..c540ac9
--- /dev/null
+++ b/gdb/testsuite/gdb.base/stap-probe.c
@@ -0,0 +1,49 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2011 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
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#if USE_PROBES
+
+#define _SDT_HAS_SEMAPHORES
+__extension__ unsigned short teste_user_semaphore __attribute__ ((unused)) __attribute__ ((section (".probes")));
+#define TEST teste_user_semaphore
+
+#else
+
+#define TEST 1
+
+#endif
+
+#include <sdt.h>
+
+/* We only support SystemTap and only the v3 form. */
+#if _SDT_NOTE_TYPE != 3
+#error "not using SystemTap v3 probes"
+#endif
+
+int
+f (int x)
+{
+ if (TEST)
+ STAP_PROBE1(teste, user, x);
+ return x+5;
+}
+
+int
+main()
+{
+ f(f(23));
+}
diff --git a/gdb/testsuite/gdb.base/stap-probe.exp b/gdb/testsuite/gdb.base/stap-probe.exp
new file mode 100644
index 0000000..0b36320
--- /dev/null
+++ b/gdb/testsuite/gdb.base/stap-probe.exp
@@ -0,0 +1,60 @@
+# Copyright (C) 2011 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
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# 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
+
+# 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 {{arg ""}} {
+ global testfile hex
+
+ if {$arg != ""} {
+ set arg "additional_flags=$arg"
+ set addendum ", with semaphore"
+ } else {
+ set addendum ", no semaphore"
+ }
+
+ if {[prepare_for_testing ${testfile}.exp ${testfile} ${testfile}.c $arg]} {
+ return -1
+ }
+
+ if ![runto_main] {
+ return -1
+ }
+
+ gdb_test "info probes" \
+ "teste *user *$hex .*" \
+ "info probes$addendum"
+
+ if {[runto "probe:teste:user"]} {
+ pass "run to probe:teste:user$addendum"
+ } else {
+ fail "run to probe:teste:user$addendum"
+ }
+
+ # Pending the implementation of this feature.
+ # gdb_test "print \$_probe_argc" " = 1" "print \$_probe_argc$addendum"
+ # gdb_test "print \$_probe_arg0 == x" " = 1" "check \$_probe_arg0$addendum"
+
+ return 0
+}
+
+if {[stap_test] == -1} {
+ untested stap-probe.exp
+ return -1
+}
+stap_test "-DUSE_PROBES"
hooks/post-receive
--
Repository for Project Archer.
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-02-14 20:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-14 20:46 [SCM] archer-sergiodj-stap: added basic tests tromey
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).