From 8d5d041590ab37e766ebf16828cc193424d6a15c Mon Sep 17 00:00:00 2001 From: Martin Cermak Date: Tue, 10 May 2022 09:56:18 +0200 Subject: [PATCH] Include downstream/RHEL tests Find new home for downstream RHEL tests. Upstream them. The set of tests used for fedora gating stays intact: The gating tests are only those having the tier1 tag set in their main.fmf file. The testplan plans/ci.fmf filters the others out from gating. The set of Fedora gating tests stays the same as it was before this change. --- plans/ci.fmf | 1 + tests/Regression/PR16166/main.fmf | 16 + tests/Regression/PR16166/runtest.sh | 67 +++ tests/Regression/PR16166/towers.c | 155 ++++++ .../RHEL6Feature-cpp-backtraces/README | 31 ++ .../backtrackator.stp | 15 + .../RHEL6Feature-cpp-backtraces/classes.cpp | 43 ++ .../RHEL6Feature-cpp-backtraces/classes.hpp | 16 + .../golden-ppc64-17.out | 142 ++++++ .../golden-ppc64.out | 76 +++ .../golden-s390x.out | 65 +++ .../golden.el9.aarch64.out | 153 ++++++ .../golden.el9.ppc64le.out | 142 ++++++ .../golden.el9.s390x.out | 153 ++++++ .../golden.el9.x86_64.out | 153 ++++++ .../RHEL6Feature-cpp-backtraces/golden.out | 142 ++++++ .../RHEL6Feature-cpp-backtraces/main.cpp | 10 + .../RHEL6Feature-cpp-backtraces/main.fmf | 14 + .../RHEL6Feature-cpp-backtraces/runtest.sh | 116 +++++ .../classes.cpp | 39 ++ .../golden.out | 16 + .../RHEL6Feature-cpp-ctors-and-dtors/main.fmf | 13 + .../runtest.sh | 52 ++ .../tracker.stp | 23 + .../RHEL6Feature-cpp-inheritance/classes.cpp | 56 +++ .../RHEL6Feature-cpp-inheritance/main.fmf | 13 + .../RHEL6Feature-cpp-inheritance/runtest.sh | 56 +++ .../RHEL6Feature-cpp-inheritance/tracker.stp | 6 + .../RHEL6Feature-cpp-methods/classes.cpp | 71 +++ .../RHEL6Feature-cpp-methods/golden.el7.out | 70 +++ .../RHEL6Feature-cpp-methods/golden.el8.out | 83 ++++ .../RHEL6Feature-cpp-methods/golden.out | 70 +++ .../golden_summary.out | 13 + .../RHEL6Feature-cpp-methods/main.fmf | 13 + .../RHEL6Feature-cpp-methods/runtest.sh | 72 +++ .../RHEL6Feature-cpp-methods/tracker.stp | 162 +++++++ .../main.fmf | 14 + .../runtest.sh | 49 ++ .../bz544960-no-cfa_ops-supplied/README | 63 +++ .../bz544960-no-cfa_ops-supplied/bdflush.stp | 8 + .../bz544960-no-cfa_ops-supplied/main.fmf | 14 + .../readpages.stp | 19 + .../bz544960-no-cfa_ops-supplied/runtest.sh | 48 ++ .../tcp.sendmsg.stp | 7 + .../bz706185-various-build-and-run/main.fmf | 15 + .../bz706185-various-build-and-run/runtest.sh | 87 ++++ .../softirq.run | 1 + .../softirq.stp | 3 + .../main.fmf | 15 + .../runtest.sh | 57 +++ .../dotest.sh | 28 ++ .../main.fmf | 14 + .../runtest.sh | 52 ++ .../hellotrace.stp | 8 + .../main.fmf | 14 + .../runtest.sh | 47 ++ tests/Regression/ipv6-tapset-support/main.fmf | 16 + .../ipv6-tapset-support/nfsd.proc.lookup.stp | 12 + .../Regression/ipv6-tapset-support/runtest.sh | 76 +++ .../irq-vector-tracepoints/main.fmf | 15 + .../irq-vector-tracepoints/runtest.sh | 74 +++ tests/Regression/netdev-receive/main.fmf | 14 + tests/Regression/netdev-receive/runtest.sh | 44 ++ .../main.fmf | 16 + .../runtest.sh | 55 +++ tests/Regression/python-probing/main.fmf | 8 +- .../second-command-not-captured/main.fmf | 16 + .../ruby-exercise.stp | 7 + .../second-command-not-captured/runtest.sh | 42 ++ .../second-command-not-captured/test.sh | 7 + .../main.fmf | 23 + .../runtest.sh | 184 +++++++ .../main.fmf | 14 + .../nfs.proc.read_setup.stp | 5 + .../runtest.sh | 45 ++ .../semantic-errors-bz1062076/main.fmf | 14 + .../semantic-errors-bz1062076/runtest.sh | 40 ++ .../semantic-errors-bz1062076/script.stp | 3 + .../semantic-errors-bz953776/main.fmf | 17 + .../semantic-errors-bz953776/runtest.sh | 161 +++++++ tests/Regression/small-tests/main.fmf | 3 +- tests/Regression/small-tests/runtest.sh | 39 ++ .../main.fmf | 14 + .../runtest.sh | 43 ++ .../main.fmf | 15 + .../runtest.sh | 74 +++ .../Regression/suspicious-RCU-usage/main.fmf | 14 + .../suspicious-RCU-usage/runtest.sh | 49 ++ .../main.fmf | 15 + .../runtest.sh | 76 +++ .../main.fmf | 14 + .../reproducer.stp | 10 + .../runtest.sh | 46 ++ .../trigger.sh | 7 + .../main.fmf | 14 + .../reproducer.stp | 6 + .../reproducer2.stp | 5 + .../runtest.sh | 45 ++ .../trigger.sh | 7 + .../testsuite-upstream-raw/check_BPF.sh | 158 ++++++ .../testsuite-upstream-raw/check_DEFAULT.sh | 55 +++ .../dg-extract-results.sh | 453 ++++++++++++++++++ .../helpers/createreport.sh | 49 ++ .../helpers/report-helper.sh | 130 +++++ .../testsuite-upstream-raw/helpers/wikiup | 22 + .../internal-watchdog.sh | 21 + .../testsuite-upstream-raw/main.fmf | 50 ++ .../testsuite-upstream-raw/runtest.sh | 282 +++++++++++ .../testsuite-upstream-raw/stap-prep | 150 ++++++ .../utrace-taskfinder-misses-events/main.fmf | 16 + .../pthreadtestcase.cpp | 35 ++ .../pthreadtestcase.stp | 28 ++ .../runtest.sh | 77 +++ .../main.fmf | 14 + .../runtest.sh | 73 +++ .../testpro/Makefile | 11 + .../testpro/nfs.proc.commit_done.c | 84 ++++ .../testpro/nfs.proc.commit_done.stp | 3 + .../testpro/test-for-nfs | 111 +++++ 119 files changed, 6120 insertions(+), 7 deletions(-) create mode 100644 tests/Regression/PR16166/main.fmf create mode 100755 tests/Regression/PR16166/runtest.sh create mode 100644 tests/Regression/PR16166/towers.c create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/README create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/backtrackator.stp create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/classes.cpp create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/classes.hpp create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64-17.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden-s390x.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.aarch64.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.ppc64le.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.s390x.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.x86_64.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/golden.out create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/main.cpp create mode 100644 tests/Regression/RHEL6Feature-cpp-backtraces/main.fmf create mode 100755 tests/Regression/RHEL6Feature-cpp-backtraces/runtest.sh create mode 100644 tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/classes.cpp create mode 100644 tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/golden.out create mode 100644 tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/main.fmf create mode 100755 tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/runtest.sh create mode 100644 tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/tracker.stp create mode 100644 tests/Regression/RHEL6Feature-cpp-inheritance/classes.cpp create mode 100644 tests/Regression/RHEL6Feature-cpp-inheritance/main.fmf create mode 100755 tests/Regression/RHEL6Feature-cpp-inheritance/runtest.sh create mode 100644 tests/Regression/RHEL6Feature-cpp-inheritance/tracker.stp create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/classes.cpp create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/golden.el7.out create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/golden.el8.out create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/golden.out create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/golden_summary.out create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/main.fmf create mode 100755 tests/Regression/RHEL6Feature-cpp-methods/runtest.sh create mode 100644 tests/Regression/RHEL6Feature-cpp-methods/tracker.stp create mode 100644 tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/main.fmf create mode 100755 tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/runtest.sh create mode 100644 tests/Regression/bz544960-no-cfa_ops-supplied/README create mode 100644 tests/Regression/bz544960-no-cfa_ops-supplied/bdflush.stp create mode 100644 tests/Regression/bz544960-no-cfa_ops-supplied/main.fmf create mode 100644 tests/Regression/bz544960-no-cfa_ops-supplied/readpages.stp create mode 100755 tests/Regression/bz544960-no-cfa_ops-supplied/runtest.sh create mode 100644 tests/Regression/bz544960-no-cfa_ops-supplied/tcp.sendmsg.stp create mode 100644 tests/Regression/bz706185-various-build-and-run/main.fmf create mode 100755 tests/Regression/bz706185-various-build-and-run/runtest.sh create mode 100644 tests/Regression/bz706185-various-build-and-run/softirq.run create mode 100644 tests/Regression/bz706185-various-build-and-run/softirq.stp create mode 100644 tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/main.fmf create mode 100755 tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/runtest.sh create mode 100644 tests/Regression/elfutils-debuginfod-client-not-being-called/dotest.sh create mode 100644 tests/Regression/elfutils-debuginfod-client-not-being-called/main.fmf create mode 100755 tests/Regression/elfutils-debuginfod-client-not-being-called/runtest.sh create mode 100644 tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/hellotrace.stp create mode 100644 tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/main.fmf create mode 100755 tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/runtest.sh create mode 100644 tests/Regression/ipv6-tapset-support/main.fmf create mode 100755 tests/Regression/ipv6-tapset-support/nfsd.proc.lookup.stp create mode 100755 tests/Regression/ipv6-tapset-support/runtest.sh create mode 100644 tests/Regression/irq-vector-tracepoints/main.fmf create mode 100755 tests/Regression/irq-vector-tracepoints/runtest.sh create mode 100644 tests/Regression/netdev-receive/main.fmf create mode 100755 tests/Regression/netdev-receive/runtest.sh create mode 100644 tests/Regression/pass-4-failure-netfilter-examples/main.fmf create mode 100755 tests/Regression/pass-4-failure-netfilter-examples/runtest.sh create mode 100644 tests/Regression/second-command-not-captured/main.fmf create mode 100644 tests/Regression/second-command-not-captured/ruby-exercise.stp create mode 100755 tests/Regression/second-command-not-captured/runtest.sh create mode 100755 tests/Regression/second-command-not-captured/test.sh create mode 100644 tests/Regression/selected-parts-of-upstream-testsuite/main.fmf create mode 100755 tests/Regression/selected-parts-of-upstream-testsuite/runtest.sh create mode 100644 tests/Regression/semantic-error-nfs-proc-read_setup/main.fmf create mode 100644 tests/Regression/semantic-error-nfs-proc-read_setup/nfs.proc.read_setup.stp create mode 100755 tests/Regression/semantic-error-nfs-proc-read_setup/runtest.sh create mode 100644 tests/Regression/semantic-errors-bz1062076/main.fmf create mode 100755 tests/Regression/semantic-errors-bz1062076/runtest.sh create mode 100644 tests/Regression/semantic-errors-bz1062076/script.stp create mode 100644 tests/Regression/semantic-errors-bz953776/main.fmf create mode 100755 tests/Regression/semantic-errors-bz953776/runtest.sh create mode 100644 tests/Regression/stap-ERROR-Build-id-mismatch-with/main.fmf create mode 100755 tests/Regression/stap-ERROR-Build-id-mismatch-with/runtest.sh create mode 100644 tests/Regression/stapio-possible-circular-locking-dependency/main.fmf create mode 100755 tests/Regression/stapio-possible-circular-locking-dependency/runtest.sh create mode 100644 tests/Regression/suspicious-RCU-usage/main.fmf create mode 100755 tests/Regression/suspicious-RCU-usage/runtest.sh create mode 100644 tests/Regression/syscall-get-arguments-returning-wrong-value/main.fmf create mode 100755 tests/Regression/syscall-get-arguments-returning-wrong-value/runtest.sh create mode 100644 tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/main.fmf create mode 100644 tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/reproducer.stp create mode 100755 tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/runtest.sh create mode 100755 tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/trigger.sh create mode 100644 tests/Regression/task-exe-file-results-in-an-file-struct-leak/main.fmf create mode 100644 tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer.stp create mode 100644 tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer2.stp create mode 100755 tests/Regression/task-exe-file-results-in-an-file-struct-leak/runtest.sh create mode 100755 tests/Regression/task-exe-file-results-in-an-file-struct-leak/trigger.sh create mode 100755 tests/Regression/testsuite-upstream-raw/check_BPF.sh create mode 100755 tests/Regression/testsuite-upstream-raw/check_DEFAULT.sh create mode 100755 tests/Regression/testsuite-upstream-raw/dg-extract-results.sh create mode 100755 tests/Regression/testsuite-upstream-raw/helpers/createreport.sh create mode 100755 tests/Regression/testsuite-upstream-raw/helpers/report-helper.sh create mode 100755 tests/Regression/testsuite-upstream-raw/helpers/wikiup create mode 100755 tests/Regression/testsuite-upstream-raw/internal-watchdog.sh create mode 100644 tests/Regression/testsuite-upstream-raw/main.fmf create mode 100755 tests/Regression/testsuite-upstream-raw/runtest.sh create mode 100755 tests/Regression/testsuite-upstream-raw/stap-prep create mode 100644 tests/Regression/utrace-taskfinder-misses-events/main.fmf create mode 100644 tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.cpp create mode 100644 tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.stp create mode 100755 tests/Regression/utrace-taskfinder-misses-events/runtest.sh create mode 100644 tests/Regression/wrong-data-returned-by-nfs-commit-done/main.fmf create mode 100755 tests/Regression/wrong-data-returned-by-nfs-commit-done/runtest.sh create mode 100644 tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/Makefile create mode 100644 tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.c create mode 100644 tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.stp create mode 100755 tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/test-for-nfs diff --git a/plans/ci.fmf b/plans/ci.fmf index e1aad9b..a9301ab 100644 --- a/plans/ci.fmf +++ b/plans/ci.fmf @@ -2,6 +2,7 @@ summary: CI Gating Plan discover: how: fmf directory: tests + filter: 'tier: 1' prepare: how: install exclude: diff --git a/tests/Regression/PR16166/main.fmf b/tests/Regression/PR16166/main.fmf new file mode 100644 index 0000000..9a85d18 --- /dev/null +++ b/tests/Regression/PR16166/main.fmf @@ -0,0 +1,16 @@ +summary: Test for BZ#1054962 (Backport PR16166 stap -vvv causes SIGSEGV when) +description: Backport PR16166 +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +require: +recommend: + - valgrind + - systemtap +duration: 15m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1054962 +extra-summary: /tools/systemtap/Regression/PR16166 +extra-task: /tools/systemtap/Regression/PR16166 diff --git a/tests/Regression/PR16166/runtest.sh b/tests/Regression/PR16166/runtest.sh new file mode 100755 index 0000000..b2b2258 --- /dev/null +++ b/tests/Regression/PR16166/runtest.sh @@ -0,0 +1,67 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/PR16166 +# Description: Test for BZ#1054962 (Backport PR16166 stap -vvv causes SIGSEGV when) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "TMPDIR=\$(mktemp -d)" + rlRun "cp towers.c $TMPDIR/" + rlRun "pushd $TMPDIR" + + rlRun "gcc -g towers.c -o towers.x" + + cat > script.stp <<-EOF +global x + +probe perf.hw.cpu_cycles.process("towers.x").counter("a") {} + +probe process("towers.x").function("main") +{ + # wrong type + x = "b" . @perf("a") +} +EOF + rlRun "which valgrind" + rlRun "valgrind --version" + rlPhaseEnd + + rlPhaseStartTest + # following is expected to fail + rlRun "valgrind --log-file=output.txt stap -vvv script.stp" 1 + # ... but not to segfault + rlRun "grep SIGSEGV output.txt" 1 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/PR16166/towers.c b/tests/Regression/PR16166/towers.c new file mode 100644 index 0000000..6465bc4 --- /dev/null +++ b/tests/Regression/PR16166/towers.c @@ -0,0 +1,155 @@ +# include +# include + +#define towersbase 2.39 + +/* Towers */ +#define maxcells 18 +#define stackrange 3 +#define true 1 +#define false 0 + +struct element +{ + int discsize; + int next; +}; + +/* Towers */ +int stack[stackrange + 1]; +struct element cellspace[maxcells + 1]; +int freelist, movesdone; + +/* Program to Solve the Towers of Hanoi */ + +void +error (emsg) + char *emsg; +{ + printf ("Error in Towers: %s\n", emsg); +} + +void +makenull (s) +{ + stack[s] = 0; +} + +int +get_element () +{ + int temp; + if (freelist > 0) + { + temp = freelist; + freelist = cellspace[freelist].next; + } + else + error ("out of space "); + return (temp); +} + +void +push (i, s) + int i, s; +{ + int errorfound, localel; + errorfound = false; + if (stack[s] > 0) + if (cellspace[stack[s]].discsize <= i) + { + errorfound = true; + error ("disc size error"); + }; + if (!errorfound) + { + localel = get_element (); + cellspace[localel].next = stack[s]; + stack[s] = localel; + cellspace[localel].discsize = i; + } +} + +void +init (s, n) + int s, n; +{ + int discctr; + makenull (s); + for (discctr = n; discctr >= 1; discctr--) + push (discctr, s); +} + +int +pop (s) + int s; +{ + int temp, temp1; + if (stack[s] > 0) + { + temp1 = cellspace[stack[s]].discsize; + temp = cellspace[stack[s]].next; + cellspace[stack[s]].next = freelist; + freelist = stack[s]; + stack[s] = temp; + return (temp1); + } + else + error ("nothing to pop "); + return 0; +} + +void +move (s1, s2) + int s1, s2; +{ + push (pop (s1), s2); + movesdone = movesdone + 1; +} + +void +tower (i, j, k) + int i, j, k; +{ + int other; + if (k == 1) + move (i, j); + else + { + other = 6 - i - j; + tower (i, other, k - 1); + move (i, j); + tower (other, j, k - 1); + } +} + + +void +towers () +{ + int i; + for (i = 1; i <= maxcells; i++) + cellspace[i].next = i - 1; + freelist = maxcells; + init (1, 14); + makenull (2); + makenull (3); + movesdone = 0; + tower (1, 2, 14); + if (movesdone != 16383) + printf (" error in Towers.\n"); +} + +#ifndef LOOP +#define LOOP 500 +#endif + +int +main () +{ + int i; + for (i= 0; i < LOOP; i++) + towers(); + return 0; +} + diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/README b/tests/Regression/RHEL6Feature-cpp-backtraces/README new file mode 100644 index 0000000..3211489 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/README @@ -0,0 +1,31 @@ + +With 5.18.0-0.rc5.20220504git107c948d1d3e61d.42.fc37.x86_64 we have + + + +---------------------8<-------------------------------------------------------- +:: [ 08:26:39 ] :: [ BEGIN ] :: Running 'stap --skip-badvars --ldd backtrackator.stp -c ./classes > output.out' +In file included from /usr/share/systemtap/runtime/linux/../regs.c:20, + from /usr/share/systemtap/runtime/linux/runtime.h:270, + from /usr/share/systemtap/runtime/runtime.h:26, + from /tmp/stap7hYYpn/stap_9beffd9064cc2c18ddd2daf7f47a7e44_5966_src.c:21: +/usr/share/systemtap/runtime/stack.c: In function ‘_stp_stack_unwind_one_kernel’: +/usr/share/systemtap/runtime/linux/../linux/regs.c:23:32: error: ‘struct kretprobe_instance’ has no member named ‘ret_addr’ + 23 | #define _stp_ret_addr_r(ri) (ri->ret_addr) + | ^~ +/usr/share/systemtap/runtime/stack.c:358:47: note: in expansion of macro ‘_stp_ret_addr_r’ + 358 | return (unsigned long)_stp_ret_addr_r(c->ips.krp.pi); + | ^~~~~~~~~~~~~~~ +make[1]: *** [scripts/Makefile.build:288: /tmp/stap7hYYpn/stap_9beffd9064cc2c18ddd2daf7f47a7e44_5966_src.o] Error 1 +make[1]: *** Waiting for unfinished jobs.... +make: *** [Makefile:1844: /tmp/stap7hYYpn] Error 2 +WARNING: kbuild exited with status: 2 +Pass 4: compilation failed. [man error::pass4] +:: [ 08:26:59 ] :: [ FAIL ] :: Command 'stap --skip-badvars --ldd backtrackator.stp -c ./classes > output.out' (Expected 0, got 1) +---------------------8<-------------------------------------------------------- + + +Related to CONFIG_KRETPROBE_ON_RETHOOK https://elixir.bootlin.com/linux/v5.18-rc5/source/include/linux/kprobes.h#L163 + + +Needs fixing on the stap side. diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/backtrackator.stp b/tests/Regression/RHEL6Feature-cpp-backtraces/backtrackator.stp new file mode 100644 index 0000000..18a4248 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/backtrackator.stp @@ -0,0 +1,15 @@ +function mypr:long(){ + printf("================================================================================\n"); + printf("Probed function: [%s]\n\n", probefunc()); + printf ("Backtrace:\n"); + + print_ubacktrace(); + return 0; +} + + + +probe process("classes").function("public*") { mypr(); } +probe process("classes").function("private*") { mypr(); } +probe process("classes").function("recursive*") { mypr(); } +probe process("classes").function("main*") { mypr(); } diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/classes.cpp b/tests/Regression/RHEL6Feature-cpp-backtraces/classes.cpp new file mode 100644 index 0000000..1c42084 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/classes.cpp @@ -0,0 +1,43 @@ +#include "classes.hpp" +#include + +void A::privateA1(){ + std::cout << "privateA1" << std::endl; + this->privateA2(); + +} + +void A::privateA2(){ + std::cout << "privateA2" << std::endl; + this->recursiveA1(3); + +} + +void A::recursiveA1(int count){ + std::cout << "recursiveA1: " << count << std::endl; + if (count == 0) + return; + this->recursiveA1(count-1); + return; +} + +void A::publicA1(){ + std::cout << "publicA1" << std::endl; + this->publicA2(); +} + +void A::publicA2(){ + std::cout << "publicA2" << std::endl; + this->privateA1(); +} + + +void B::privateB1(A a){ + std::cout << "privateB1" << std::endl; + a.publicA1(); +} + +void B::publicB1(A a){ + std::cout << "publicB1" << std::endl; + this->privateB1(a); +} diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/classes.hpp b/tests/Regression/RHEL6Feature-cpp-backtraces/classes.hpp new file mode 100644 index 0000000..0846ae2 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/classes.hpp @@ -0,0 +1,16 @@ +class A{ + private: + void privateA1(); + void privateA2(); + void recursiveA1(int); + public: + void publicA1(); + void publicA2(); +}; + +class B{ + private: + void privateB1(A); + public: + void publicB1(A); +}; diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64-17.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64-17.out new file mode 100644 index 0000000..1a9d1ce --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64-17.out @@ -0,0 +1,142 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : generic_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64.out new file mode 100644 index 0000000..0f98c88 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden-ppc64.out @@ -0,0 +1,76 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +[ADDRESS] [ADDRESS] ADDRESS (inexact) diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden-s390x.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden-s390x.out new file mode 100644 index 0000000..1f5f902 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden-s390x.out @@ -0,0 +1,65 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.aarch64.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.aarch64.out new file mode 100644 index 0000000..15c7b1e --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.aarch64.out @@ -0,0 +1,153 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.ppc64le.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.ppc64le.out new file mode 100644 index 0000000..64f2232 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.ppc64le.out @@ -0,0 +1,142 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.17+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.s390x.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.s390x.out new file mode 100644 index 0000000..c0c1262 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.s390x.out @@ -0,0 +1,153 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.x86_64.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.x86_64.out new file mode 100644 index 0000000..ac8d8c9 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.el9.x86_64.out @@ -0,0 +1,153 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_call_main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main@GLIBC_2.2.5+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/golden.out b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.out new file mode 100644 index 0000000..5013977 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/golden.out @@ -0,0 +1,142 @@ +publicB1 +privateB1 +publicA1 +publicA2 +privateA1 +privateA2 +recursiveA1: 3 +recursiveA1: 2 +recursiveA1: 1 +recursiveA1: 0 +================================================================================ +Probed function: [main] + +Backtrace: + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicB1] + +Backtrace: + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateB1] + +Backtrace: + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA1] + +Backtrace: + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [publicA2] + +Backtrace: + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA1] + +Backtrace: + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [privateA2] + +Backtrace: + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] +================================================================================ +Probed function: [recursiveA1] + +Backtrace: + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : recursiveA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA2+ADDRESS/ADDRESS [PATH] + ADDRESS : privateA1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA2+ADDRESS/ADDRESS [PATH] + ADDRESS : publicA1+ADDRESS/ADDRESS [PATH] + ADDRESS : privateB1+ADDRESS/ADDRESS [PATH] + ADDRESS : publicB1+ADDRESS/ADDRESS [PATH] + ADDRESS : main+ADDRESS/ADDRESS [PATH] + ADDRESS : __libc_start_main+ADDRESS/ADDRESS [PATH] + ADDRESS : _start+ADDRESS/ADDRESS [PATH] diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/main.cpp b/tests/Regression/RHEL6Feature-cpp-backtraces/main.cpp new file mode 100644 index 0000000..69ae514 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/main.cpp @@ -0,0 +1,10 @@ +#include "classes.hpp" + +int main(){ + A a; + B b; + + b.publicB1(a); + return 0; +} + diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/main.fmf b/tests/Regression/RHEL6Feature-cpp-backtraces/main.fmf new file mode 100644 index 0000000..3600214 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/main.fmf @@ -0,0 +1,14 @@ +summary: Tests backtracking in C++ programs +description: '' +contact: Petr Muller +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - gcc-c++ + - glibc-debuginfo +duration: 10m +extra-summary: /tools/systemtap/Regression/RHEL6Feature-cpp-backtraces +extra-task: /tools/systemtap/Regression/RHEL6Feature-cpp-backtraces diff --git a/tests/Regression/RHEL6Feature-cpp-backtraces/runtest.sh b/tests/Regression/RHEL6Feature-cpp-backtraces/runtest.sh new file mode 100755 index 0000000..eddbc83 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-backtraces/runtest.sh @@ -0,0 +1,116 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/RHEL6Feature-cpp-backtraces +# Description: Tests backtracking in C++ programs +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +inputAs_rlLog(){ + while read line + do + rlLog "$line" + done +} + +compareAndLog(){ + rlAssertNotDiffer "$1" "$2" + if [ "$?" != "0" ] + then + rlLog "Difference:" + diff -u "$1" "$2" | inputAs_rlLog + fi +} + +rlJournalStart + +rlPhaseStartSetup + rlRun "g++ classes.cpp main.cpp -g -o classes" + rlAssertRpm glibc # show NVR + rlAssertRpm glibc-debuginfo + rlRun "stap-prep" 0-255 +rlPhaseEnd + +rlPhaseStartTest + rlRun "stap --ldd backtrackator.stp -c ./classes > output.out" + rlRun "cp output.out unprocessed.out" + rlLog "Processing output" + rlRun "sed -i -r -e 's/0x[0-9a-f]+/ADDRESS/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*publicA1[A-Za-z0-9]*/publicA1/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*publicA2[A-Za-z0-9]*/publicA2/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*privateA1[A-Za-z0-9]*/privateA1/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*privateA2[A-Za-z0-9]*/privateA2/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*recursiveA1[A-Za-z0-9]*/recursiveA1/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*publicB1[A-Za-z0-9]*/publicB1/g' output.out" + rlRun "sed -i -r -e 's/_[_A-Za-z0-9]*privateB1[A-Za-z0-9]*/privateB1/g' output.out" + rlRun "sed -i -r -e 's!\[((.*\/.*)|(classes))\]!\[PATH\]!g' output.out" + # http://stackoverflow.com/questions/13963150/what-does-the-gcc-function-suffix-isra-mean + rlIsRHEL '>=' 7 && arch | grep -q ppc && \ + rlRun "sed -i 's/generic_start_main.isra.0/generic_start_main/' output.out" + + if rlIsRHEL '>=' 9; then + [[ "`uname -m`" =~ "ppc64" ]] && \ + rlRun "cat golden.el9.`arch`.out > golden-ppc64-17.out" || \ + rlRun "cat golden.el9.`arch`.out > golden.out" + fi + + # RHEL-9 s390x runtime/stack-s390.c:63:52: error: ‘ASYNC_SIZE’ undeclared + # (PAGE_SIZE << 1) on stap side seems to work it around + + + if [ "`uname -m`" == "s390x" ] && ( rlIsRHEL 5 || rlIsRHEL 4 ) + then + rlLog "Detected we are running on: s390x && RHEL <= 5" + rlLog "Using special expected output" + compareAndLog golden-s390x.out output.out + elif [ "`uname -m`" == "ppc64" ] && ( rlIsRHEL 5 || rlIsRHEL 4 ) + then + rlLog "Detected we are running on: ppc64 && RHEL <= 5" + rlLog "Using special expected output" + compareAndLog golden-ppc64.out output.out + elif [[ "`uname -m`" =~ "ppc64" ]] + then + rlLog "Detected we are running on: ppc64" + rlLog "Using special expected output" + compareAndLog golden-ppc64-17.out output.out + else + rlLog "Detected we are running on: nothing special" + rlLog "Using generic expected output" + compareAndLog golden.out output.out + fi +rlPhaseEnd + +rlPhaseStartCleanup + rlFileSubmit output.out + rlFileSubmit golden.out + rlFileSubmit unprocessed.out + rlRun "rm -f classes output.out unprocessed.out" +rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/classes.cpp b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/classes.cpp new file mode 100644 index 0000000..cd488c5 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/classes.cpp @@ -0,0 +1,39 @@ +#include + +class Explicit{ + public: + int data; + Explicit(); + Explicit(int argument); + Explicit(const Explicit &original); + ~Explicit(); +}; + +class Implicit{ + public: + int data; +}; + +Explicit::Explicit() { this->data=0; } +Explicit::Explicit(int a) {this->data=0; } +Explicit::Explicit(const Explicit &orig){this->data = orig.data;} +Explicit::~Explicit(){} + +int main(){ + Explicit e1; //static ctor call + Explicit *e2; + + e2 = new Explicit(); //dynamic ctor call + delete e2; //dynamic dtor call + + e2 = new Explicit(2); //dynamic ctor call + Explicit e3 = *e2; //copy ctor + delete e2; //dtor + + Implicit i1; //ctor + Implicit *i2 = new Implicit(); //ctor + Implicit i3 = *i2; //implicit copy ctor + delete i2; //dtor + + return 0; // dtor e1, e3, i1, i3 +} diff --git a/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/golden.out b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/golden.out new file mode 100644 index 0000000..f45ff90 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/golden.out @@ -0,0 +1,16 @@ +Explicit constructor start +Explicit constructor end +Explicit constructor start +Explicit constructor end +Explicit destructor start +Explicit destructor end +Explicit constructor start +Explicit constructor end +Explicit constructor start +Explicit constructor end +Explicit destructor start +Explicit destructor end +Explicit destructor start +Explicit destructor end +Explicit destructor start +Explicit destructor end diff --git a/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/main.fmf b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/main.fmf new file mode 100644 index 0000000..ba18df9 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/main.fmf @@ -0,0 +1,13 @@ +summary: Tests probing constructors and destructors +description: '' +contact: Petr Muller +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - gcc-c++ +duration: 5m +extra-summary: /tools/systemtap/Regression/RHEL6Feature-cpp-ctors-and-dtors +extra-task: /tools/systemtap/Regression/RHEL6Feature-cpp-ctors-and-dtors diff --git a/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/runtest.sh b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/runtest.sh new file mode 100755 index 0000000..fc72f6b --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/runtest.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/RHEL6Feature-cpp-ctors-and-dtors +# Description: Tests probing constructors and destructors +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + +rlPhaseStartSetup + rlRun "g++ classes.cpp -g -o classes" +rlPhaseEnd + +rlPhaseStartTest + rlRun "stap -c ./classes tracker.stp -o output.out" + rlAssertNotDiffer golden.out output.out +rlPhaseEnd + +rlPhaseStartCleanup + rlFileSubmit "output.out" + rlFileSubmit "golden.out" + rlRun "rm -rf classes output.out" +rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/tracker.stp b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/tracker.stp new file mode 100644 index 0000000..8ff0bb1 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-ctors-and-dtors/tracker.stp @@ -0,0 +1,23 @@ +probe process("classes").function("Explicit::Explicit"){ + printf("Explicit constructor start\n"); +} + +probe process("classes").function("Explicit::~Explicit"){ + printf("Explicit destructor start\n"); +} + +probe process("classes").function("Explicit::Explicit").return{ + printf("Explicit constructor end\n"); +} + +probe process("classes").function("Explicit::~Explicit").return{ + printf("Explicit destructor end\n"); +} + +//probe process("classes").function("Implicit::Implicit"){ +// printf("Implicitconstructor\n"); +//} + +//probe process("classes").function("Implicit::Implicit"){ +// printf("Implicit constructor\n"); +//} diff --git a/tests/Regression/RHEL6Feature-cpp-inheritance/classes.cpp b/tests/Regression/RHEL6Feature-cpp-inheritance/classes.cpp new file mode 100644 index 0000000..2ab3e54 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-inheritance/classes.cpp @@ -0,0 +1,56 @@ +#include + +class A{ + public: + void one(){ std::cout << "A::one" << std::endl; } + void two(){ std::cout << "A::two" << std::endl; } + virtual void three() { std::cout << "A::three" << std::endl; } + virtual void four() { std::cout << "A::four" << std::endl; } +}; + +class B : public A{ + public: + void one() { std::cout << "B::one" << std::endl; } + int one(int a) { std::cout << "B::one" << std::endl; } + + virtual void three() { std::cout << "B::three" << std::endl; } +}; + +int main(){ + A a; + B b; + + A *ap = new A(); + A *apb = new B(); + + B *bp = new B(); + + + a.one(); + a.two(); + a.three(); + a.four(); + + b.one(); + b.two(); + b.three(); + b.four(); + + ap->one(); + ap->two(); + ap->three(); + ap->four(); + + apb->one(); + apb->two(); + apb->three(); + apb->four(); + + bp->one(); + bp->two(); + bp->three(); + bp->four(); + + + return 0; +} diff --git a/tests/Regression/RHEL6Feature-cpp-inheritance/main.fmf b/tests/Regression/RHEL6Feature-cpp-inheritance/main.fmf new file mode 100644 index 0000000..dba249b --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-inheritance/main.fmf @@ -0,0 +1,13 @@ +summary: Tests systemtap handling inheritance +description: '' +contact: Petr Muller +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - gcc-c++ +duration: 10m +extra-summary: /tools/systemtap/Regression/RHEL6Feature-cpp-inheritance +extra-task: /tools/systemtap/Regression/RHEL6Feature-cpp-inheritance diff --git a/tests/Regression/RHEL6Feature-cpp-inheritance/runtest.sh b/tests/Regression/RHEL6Feature-cpp-inheritance/runtest.sh new file mode 100755 index 0000000..deec9ce --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-inheritance/runtest.sh @@ -0,0 +1,56 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/RHEL6Feature-cpp-inheritance +# Description: Tests systemtap handling inheritance +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +# if this testcase caused kernel crash and reboot, don't try to rerun it +[[ $REBOOTCOUNT -gt 0 ]] && exit 1 + +PACKAGE="systemtap" + +rlJournalStart + +rlPhaseStartSetup + rlRun "g++ classes.cpp -o classes -g" + rlRun "./classes > program.out" 0 "Preparing the golden output" +rlPhaseEnd + +rlPhaseStartTest + rlRun "stap -c ./classes tracker.stp -o stap.out" + rlAssertNotDiffer program.out stap.out +rlPhaseEnd + +rlPhaseStartCleanup + rlFileSubmit program.out + rlFileSubmit stap.out + rlRun "rm -f classes stap.out program.out" +rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/RHEL6Feature-cpp-inheritance/tracker.stp b/tests/Regression/RHEL6Feature-cpp-inheritance/tracker.stp new file mode 100644 index 0000000..525ced5 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-inheritance/tracker.stp @@ -0,0 +1,6 @@ +probe process("classes").function("A::one"){printf("A::one\n");} +probe process("classes").function("A::two"){printf("A::two\n");} +probe process("classes").function("A::three"){printf("A::three\n");} +probe process("classes").function("A::four"){printf("A::four\n");} +probe process("classes").function("B::one"){printf("B::one\n");} +probe process("classes").function("B::three"){printf("B::three\n");} diff --git a/tests/Regression/RHEL6Feature-cpp-methods/classes.cpp b/tests/Regression/RHEL6Feature-cpp-methods/classes.cpp new file mode 100644 index 0000000..e947234 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/classes.cpp @@ -0,0 +1,71 @@ +__attribute__((noinline)) void StandaloneFunction(){ + +} + +class CLASS1{ + private: + void prMethod() {}; + public: + void puMethod() {this->prMethod();}; + static void stMethod() {}; +}; + +namespace inner{ + void StandaloneFunction(){ + } + + class CLASS1{ + private: + void prMethod() {}; + public: + void puMethod() {this->prMethod();}; + static void stMethod() {}; + }; +}; + +namespace moreinner{ + void StandaloneFunction(){ + } + + class CLASS1{ + private: + __attribute__((noinline)) void prMethod() {}; + public: + __attribute__((noinline)) void puMethod() {this->prMethod();}; + __attribute__((noinline)) static void stMethod() {}; + }; +}; + +int main(){ + StandaloneFunction(); + inner::StandaloneFunction(); + moreinner::StandaloneFunction(); + + CLASS1 A; + inner::CLASS1 B; + moreinner::CLASS1 C; + + CLASS1* pA = new CLASS1(); + inner::CLASS1 *pB = new inner::CLASS1(); + moreinner::CLASS1 *pC = new moreinner::CLASS1(); + + A.puMethod(); + A.stMethod(); + + B.puMethod(); + B.stMethod(); + + C.puMethod(); + C.stMethod(); + + pA->puMethod(); + pA->stMethod(); + + pB->puMethod(); + pB->stMethod(); + + pC->puMethod(); + pC->stMethod(); + + return 0; +} diff --git a/tests/Regression/RHEL6Feature-cpp-methods/golden.el7.out b/tests/Regression/RHEL6Feature-cpp-methods/golden.el7.out new file mode 100644 index 0000000..d7cff12 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/golden.el7.out @@ -0,0 +1,70 @@ +StandaloneFunction start: _Z18StandaloneFunctionv +StandaloneFunction end: main +StandaloneFunction start: _ZN5inner18StandaloneFunctionEv +inner::StandaloneFunction start: _ZN5inner18StandaloneFunctionEv +StandaloneFunction end: main +inner::StandaloneFunction end: main +StandaloneFunction start: _ZN9moreinner18StandaloneFunctionEv +moreinner::StandaloneFunction start: _ZN9moreinner18StandaloneFunctionEv +StandaloneFunction end: main +moreinner::StandaloneFunction end: main +puMethod start: _ZN6CLASS18puMethodEv +prMethod start: _ZN6CLASS18prMethodEv +prMethod end: _ZN6CLASS18puMethodEv +puMethod end: main +stMethod start: _ZN6CLASS18stMethodEv +stMethod end: main +puMethod start: _ZN5inner6CLASS18puMethodEv +inner::puMethod start: _ZN5inner6CLASS18puMethodEv +prMethod start: _ZN5inner6CLASS18prMethodEv +inner::prMethod start: _ZN5inner6CLASS18prMethodEv +prMethod end: _ZN5inner6CLASS18puMethodEv +inner::prMethod end: _ZN5inner6CLASS18puMethodEv +puMethod end: main +inner::puMethod end: main +stMethod start: _ZN5inner6CLASS18stMethodEv +inner::stMethod start: _ZN5inner6CLASS18stMethodEv +stMethod end: main +inner::stMethod end: main +puMethod start: _ZN9moreinner6CLASS18puMethodEv +moreinner::puMethod start: _ZN9moreinner6CLASS18puMethodEv +prMethod start: _ZN9moreinner6CLASS18prMethodEv +moreinner::prMethod start: _ZN9moreinner6CLASS18prMethodEv +prMethod end: _ZN9moreinner6CLASS18puMethodEv +moreinner::prMethod end: _ZN9moreinner6CLASS18puMethodEv +puMethod end: main +moreinner::puMethod end: main +stMethod start: _ZN9moreinner6CLASS18stMethodEv +moreinner::stMethod start: _ZN9moreinner6CLASS18stMethodEv +stMethod end: main +moreinner::stMethod end: main +puMethod start: _ZN6CLASS18puMethodEv +prMethod start: _ZN6CLASS18prMethodEv +prMethod end: _ZN6CLASS18puMethodEv +puMethod end: main +stMethod start: _ZN6CLASS18stMethodEv +stMethod end: main +puMethod start: _ZN5inner6CLASS18puMethodEv +inner::puMethod start: _ZN5inner6CLASS18puMethodEv +prMethod start: _ZN5inner6CLASS18prMethodEv +inner::prMethod start: _ZN5inner6CLASS18prMethodEv +prMethod end: _ZN5inner6CLASS18puMethodEv +inner::prMethod end: _ZN5inner6CLASS18puMethodEv +puMethod end: main +inner::puMethod end: main +stMethod start: _ZN5inner6CLASS18stMethodEv +inner::stMethod start: _ZN5inner6CLASS18stMethodEv +stMethod end: main +inner::stMethod end: main +puMethod start: _ZN9moreinner6CLASS18puMethodEv +moreinner::puMethod start: _ZN9moreinner6CLASS18puMethodEv +prMethod start: _ZN9moreinner6CLASS18prMethodEv +moreinner::prMethod start: _ZN9moreinner6CLASS18prMethodEv +prMethod end: _ZN9moreinner6CLASS18puMethodEv +moreinner::prMethod end: _ZN9moreinner6CLASS18puMethodEv +puMethod end: main +moreinner::puMethod end: main +stMethod start: _ZN9moreinner6CLASS18stMethodEv +moreinner::stMethod start: _ZN9moreinner6CLASS18stMethodEv +stMethod end: main +moreinner::stMethod end: main diff --git a/tests/Regression/RHEL6Feature-cpp-methods/golden.el8.out b/tests/Regression/RHEL6Feature-cpp-methods/golden.el8.out new file mode 100644 index 0000000..6ba6bc9 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/golden.el8.out @@ -0,0 +1,83 @@ +StandaloneFunction start: _Z18StandaloneFunctionv +StandaloneFunction end: main +StandaloneFunction start: _ZN5inner18StandaloneFunctionEv +inner::StandaloneFunction start: _ZN5inner18StandaloneFunctionEv +StandaloneFunction end: main +inner::StandaloneFunction end: main +StandaloneFunction start: _ZN9moreinner18StandaloneFunctionEv +moreinner::StandaloneFunction start: _ZN9moreinner18StandaloneFunctionEv +StandaloneFunction end: main +moreinner::StandaloneFunction end: main +puMethod start: _ZN6CLASS18puMethodEv +prMethod start: _ZN6CLASS18prMethodEv +prMethod end: _ZN6CLASS18puMethodEv +puMethod end: main +stMethod start: _ZN6CLASS18stMethodEv +stMethod end: main +puMethod start: _ZN5inner6CLASS18puMethodEv +inner::puMethod start: _ZN5inner6CLASS18puMethodEv +prMethod start: _ZN5inner6CLASS18prMethodEv +inner::prMethod start: _ZN5inner6CLASS18prMethodEv +prMethod end: _ZN5inner6CLASS18puMethodEv +inner::prMethod end: _ZN5inner6CLASS18puMethodEv +puMethod end: main +inner::puMethod end: main +stMethod start: _ZN5inner6CLASS18stMethodEv +inner::stMethod start: _ZN5inner6CLASS18stMethodEv +stMethod end: main +inner::stMethod end: main +puMethod start: _ZN9moreinner6CLASS18puMethodEv +moreinner::puMethod start: _ZN9moreinner6CLASS18puMethodEv +prMethod start: _ZN9moreinner6CLASS18prMethodEv +moreinner::prMethod start: _ZN9moreinner6CLASS18prMethodEv +prMethod end: _ZN9moreinner6CLASS18puMethodEv +moreinner::prMethod end: _ZN9moreinner6CLASS18puMethodEv +puMethod end: main +moreinner::puMethod end: main +stMethod start: _ZN9moreinner6CLASS18stMethodEv +moreinner::stMethod start: _ZN9moreinner6CLASS18stMethodEv +stMethod end: main +moreinner::stMethod end: main +puMethod start: _ZN6CLASS18puMethodEv +prMethod start: _ZN6CLASS18prMethodEv +prMethod end: _ZN6CLASS18puMethodEv +puMethod end: main +stMethod start: _ZN6CLASS18stMethodEv +stMethod end: main +puMethod start: _ZN5inner6CLASS18puMethodEv +inner::puMethod start: _ZN5inner6CLASS18puMethodEv +prMethod start: _ZN5inner6CLASS18prMethodEv +inner::prMethod start: _ZN5inner6CLASS18prMethodEv +prMethod end: _ZN5inner6CLASS18puMethodEv +inner::prMethod end: _ZN5inner6CLASS18puMethodEv +puMethod end: main +inner::puMethod end: main +stMethod start: _ZN5inner6CLASS18stMethodEv +inner::stMethod start: _ZN5inner6CLASS18stMethodEv +stMethod end: main +inner::stMethod end: main +puMethod start: _ZN9moreinner6CLASS18puMethodEv +moreinner::puMethod start: _ZN9moreinner6CLASS18puMethodEv +prMethod start: _ZN9moreinner6CLASS18prMethodEv +moreinner::prMethod start: _ZN9moreinner6CLASS18prMethodEv +prMethod end: _ZN9moreinner6CLASS18puMethodEv +moreinner::prMethod end: _ZN9moreinner6CLASS18puMethodEv +puMethod end: main +moreinner::puMethod end: main +stMethod start: _ZN9moreinner6CLASS18stMethodEv +moreinner::stMethod start: _ZN9moreinner6CLASS18stMethodEv +stMethod end: main +moreinner::stMethod end: main +__StandaloneFunction=0 +__hitcount=70 +__inner_StandaloneFunction=0 +__moreinner_StandaloneFunction=0 +__stMethod=0 +__inner_CLASS1_stMethod=0 +__moreinner_star_stMethod=0 +__prMethod=0 +__inner_CLASS1_prMethod=0 +__moreinner_star_prMethod=0 +__puMethod=0 +__inner_CLASS1_puMethod=0 +__moreinner_star_puMethod=0 diff --git a/tests/Regression/RHEL6Feature-cpp-methods/golden.out b/tests/Regression/RHEL6Feature-cpp-methods/golden.out new file mode 100644 index 0000000..fe9c7bb --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/golden.out @@ -0,0 +1,70 @@ +StandaloneFunction start: StandaloneFunction +StandaloneFunction end: StandaloneFunction +StandaloneFunction start: StandaloneFunction +inner::StandaloneFunction start: inner::StandaloneFunction +inner::StandaloneFunction end: inner::StandaloneFunction +StandaloneFunction end: StandaloneFunction +StandaloneFunction start: StandaloneFunction +moreinner::StandaloneFunction start: moreinner::StandaloneFunction +moreinner::StandaloneFunction end: moreinner::StandaloneFunction +StandaloneFunction end: StandaloneFunction +puMethod start: puMethod +prMethod start: prMethod +prMethod end: prMethod +puMethod end: puMethod +stMethod start: stMethod +stMethod end: stMethod +puMethod start: puMethod +inner::puMethod start: inner::CLASS1::puMethod +prMethod start: prMethod +inner::prMethod start: inner::CLASS1::prMethod +inner::prMethod end: inner::CLASS1::prMethod +prMethod end: prMethod +inner::puMethod end: inner::CLASS1::puMethod +puMethod end: puMethod +stMethod start: stMethod +inner::stMethod start: inner::CLASS1::stMethod +inner::stMethod end: inner::CLASS1::stMethod +stMethod end: stMethod +puMethod start: puMethod +moreinner::puMethod start: moreinner::CLASS1::puMethod +prMethod start: prMethod +moreinner::prMethod start: moreinner::CLASS1::prMethod +moreinner::prMethod end: moreinner::CLASS1::prMethod +prMethod end: prMethod +moreinner::puMethod end: moreinner::CLASS1::puMethod +puMethod end: puMethod +stMethod start: stMethod +moreinner::stMethod start: moreinner::CLASS1::stMethod +moreinner::stMethod end: moreinner::CLASS1::stMethod +stMethod end: stMethod +puMethod start: puMethod +prMethod start: prMethod +prMethod end: prMethod +puMethod end: puMethod +stMethod start: stMethod +stMethod end: stMethod +puMethod start: puMethod +inner::puMethod start: inner::CLASS1::puMethod +prMethod start: prMethod +inner::prMethod start: inner::CLASS1::prMethod +inner::prMethod end: inner::CLASS1::prMethod +prMethod end: prMethod +inner::puMethod end: inner::CLASS1::puMethod +puMethod end: puMethod +stMethod start: stMethod +inner::stMethod start: inner::CLASS1::stMethod +inner::stMethod end: inner::CLASS1::stMethod +stMethod end: stMethod +puMethod start: puMethod +moreinner::puMethod start: moreinner::CLASS1::puMethod +prMethod start: prMethod +moreinner::prMethod start: moreinner::CLASS1::prMethod +moreinner::prMethod end: moreinner::CLASS1::prMethod +prMethod end: prMethod +moreinner::puMethod end: moreinner::CLASS1::puMethod +puMethod end: puMethod +stMethod start: stMethod +moreinner::stMethod start: moreinner::CLASS1::stMethod +moreinner::stMethod end: moreinner::CLASS1::stMethod +stMethod end: stMethod diff --git a/tests/Regression/RHEL6Feature-cpp-methods/golden_summary.out b/tests/Regression/RHEL6Feature-cpp-methods/golden_summary.out new file mode 100644 index 0000000..4072ed7 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/golden_summary.out @@ -0,0 +1,13 @@ +__hitcount=70 +__inner_CLASS1_prMethod=0 +__inner_CLASS1_puMethod=0 +__inner_CLASS1_stMethod=0 +__inner_StandaloneFunction=0 +__moreinner_StandaloneFunction=0 +__moreinner_star_prMethod=0 +__moreinner_star_puMethod=0 +__moreinner_star_stMethod=0 +__prMethod=0 +__puMethod=0 +__StandaloneFunction=0 +__stMethod=0 diff --git a/tests/Regression/RHEL6Feature-cpp-methods/main.fmf b/tests/Regression/RHEL6Feature-cpp-methods/main.fmf new file mode 100644 index 0000000..56ac081 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/main.fmf @@ -0,0 +1,13 @@ +summary: Tests C++ methods +description: '' +contact: Petr Muller +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - gcc-c++ +duration: 120m +extra-summary: /tools/systemtap/Regression/RHEL6Feature-cpp-methods +extra-task: /tools/systemtap/Regression/RHEL6Feature-cpp-methods diff --git a/tests/Regression/RHEL6Feature-cpp-methods/runtest.sh b/tests/Regression/RHEL6Feature-cpp-methods/runtest.sh new file mode 100755 index 0000000..443ff56 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/runtest.sh @@ -0,0 +1,72 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/RHEL6Feature-cpp-methods +# Description: Tests C++ methods +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2010 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include rhts environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + +rlPhaseStartSetup + rlRun "stap-prep" 0-255 + rlRun "g++ -O0 classes.cpp -o classes -g" + + rlIsRHEL 6 && COMPAT='--compatible=1.8' + # rlIsRHEL 7 && cp -f golden.el7.out golden.out + # rlIsRHEL 8 && cp -f golden.el8.out golden.out +rlPhaseEnd + +rlPhaseStartTest + rlRun "stap $COMPAT -c ./classes tracker.stp -o output.out" + # Stop comparing literally against a golden file, + # do a sanity check instead. The literal golden file check + # sort of regressed between rhel-8.2 and rhel-8.3 + # rlRun "diff golden.out output.out" + rlRun "grep ^__ output.out | sort > summary.out" + + # RHEL6: covert hex to dec: + rlRun "sed -i 's/0x0/0/' summary.out" + rlRun "sed -i 's/0x46/70/' summary.out" + + # Sanity check + rlRun "diff golden_summary.out summary.out" || ( + rlRun "cat golden_summary.out" + rlRun "cat summary.out" + ) +rlPhaseEnd + +rlPhaseStartCleanup + rlFileSubmit golden.out + rlFileSubmit output.out + + rlRun "rm -f output.out classes" +rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/RHEL6Feature-cpp-methods/tracker.stp b/tests/Regression/RHEL6Feature-cpp-methods/tracker.stp new file mode 100644 index 0000000..54e15b3 --- /dev/null +++ b/tests/Regression/RHEL6Feature-cpp-methods/tracker.stp @@ -0,0 +1,162 @@ +global __hitcount = 0 +global __StandaloneFunction = 0 +global __inner_StandaloneFunction = 0 +global __moreinner_StandaloneFunction = 0 +global __stMethod = 0 +global __inner_CLASS1_stMethod = 0 +global __moreinner_star_stMethod = 0 +global __prMethod = 0 +global __inner_CLASS1_prMethod = 0 +global __moreinner_star_prMethod = 0 +global __puMethod = 0 +global __inner_CLASS1_puMethod = 0 +global __moreinner_star_puMethod = 0 + +probe process("classes").function("StandaloneFunction").call{ + __StandaloneFunction++ + __hitcount++ + printf("StandaloneFunction start: %s\n", probefunc()); +} + +probe process("classes").function("StandaloneFunction").return{ + __StandaloneFunction-- + __hitcount++ + printf("StandaloneFunction end: %s\n", probefunc()); +} + +probe process("classes").function("inner::StandaloneFunction").call{ + __inner_StandaloneFunction++ + __hitcount++ + printf("inner::StandaloneFunction start: %s\n", probefunc()); +} + +probe process("classes").function("inner::StandaloneFunction").return{ + __inner_StandaloneFunction-- + __hitcount++ + printf("inner::StandaloneFunction end: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::StandaloneFunction").call{ + __moreinner_StandaloneFunction++ + __hitcount++ + printf("moreinner::StandaloneFunction start: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::StandaloneFunction").return{ + __moreinner_StandaloneFunction-- + __hitcount++ + printf("moreinner::StandaloneFunction end: %s\n", probefunc()); +} +// ============================================================================ +probe process("classes").function("stMethod").call{ + __stMethod++ + __hitcount++ + printf("stMethod start: %s\n", probefunc()); +} + +probe process("classes").function("stMethod").return{ + __stMethod-- + __hitcount++ + printf("stMethod end: %s\n", probefunc()); +} + +probe process("classes").function("inner::CLASS1::stMethod").call{ + __inner_CLASS1_stMethod++ + __hitcount++ + printf("inner::stMethod start: %s\n", probefunc()); +} + +probe process("classes").function("inner::CLASS1::stMethod").return{ + __inner_CLASS1_stMethod-- + __hitcount++ + printf("inner::stMethod end: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::*::stMethod").call{ + __moreinner_star_stMethod++ + __hitcount++ + printf("moreinner::stMethod start: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::*::stMethod").return{ + __moreinner_star_stMethod-- + __hitcount++ + printf("moreinner::stMethod end: %s\n", probefunc()); +} +//============================================================================= + +probe process("classes").function("prMethod").call{ + __prMethod++ + __hitcount++ + printf("prMethod start: %s\n", probefunc()); +} + +probe process("classes").function("prMethod").return{ + __prMethod-- + __hitcount++ + printf("prMethod end: %s\n", probefunc()); +} + +probe process("classes").function("inner::CLASS1::prMethod").call{ + __inner_CLASS1_prMethod++ + __hitcount++ + printf("inner::prMethod start: %s\n", probefunc()); +} + +probe process("classes").function("inner::CLASS1::prMethod").return{ + __inner_CLASS1_prMethod-- + __hitcount++ + printf("inner::prMethod end: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::*::prMethod").call{ + __moreinner_star_prMethod++ + __hitcount++ + printf("moreinner::prMethod start: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::*::prMethod").return{ + __moreinner_star_prMethod-- + __hitcount++ + printf("moreinner::prMethod end: %s\n", probefunc()); +} + +//============================================================================= + +probe process("classes").function("puMethod").call{ + __puMethod++ + __hitcount++ + printf("puMethod start: %s\n", probefunc()); +} + +probe process("classes").function("puMethod").return{ + __puMethod-- + __hitcount++ + printf("puMethod end: %s\n", probefunc()); +} + +probe process("classes").function("inner::CLASS1::puMethod").call{ + __inner_CLASS1_puMethod++ + __hitcount++ + printf("inner::puMethod start: %s\n", probefunc()); +} + +probe process("classes").function("inner::CLASS1::puMethod").return{ + __inner_CLASS1_puMethod-- + __hitcount++ + printf("inner::puMethod end: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::*::puMethod").call{ + __moreinner_star_puMethod++ + __hitcount++ + printf("moreinner::puMethod start: %s\n", probefunc()); +} + +probe process("classes").function("moreinner::*::puMethod").return{ + __moreinner_star_puMethod-- + __hitcount++ + printf("moreinner::puMethod end: %s\n", probefunc()); +} + + diff --git a/tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/main.fmf b/tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/main.fmf new file mode 100644 index 0000000..33847c6 --- /dev/null +++ b/tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/main.fmf @@ -0,0 +1,14 @@ +summary: Test for BZ#1572501 (RHEL7.5 - backtraces no longer work with systemtap) +description: Test for BZ#1572501 +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1572501 +extra-summary: /tools/systemtap/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap +extra-task: /tools/systemtap/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap diff --git a/tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/runtest.sh b/tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/runtest.sh new file mode 100755 index 0000000..a4b1a26 --- /dev/null +++ b/tests/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap/runtest.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/RHEL7-5-backtraces-no-longer-work-with-systemtap +# Description: Test for BZ#1572501 (RHEL7.5 - backtraces no longer work with systemtap) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartTest + if arch | grep -q s390x; then + rlLogWarning "Test not relevant" + else + TEMPFILE=$(mktemp) + rlRun "stap --all-modules -vwe 'probe kernel.function(\"kmem_cache_alloc\") { print_backtrace(); exit() }' >& $TEMPFILE" + # since it's hard to find some reasonable pattern to grep for across arches in the backrtrace + # we'll simply count the lines. We'll want at least 9 lines of output (6 as the results of -v, + # and another at least three coming from the backtrace itself. + rlRun "cat $TEMPFILE" + rlRun "test 9 -le $(wc -l $TEMPFILE | awk '{print $1}')" + rm $TEMPFILE + fi + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/bz544960-no-cfa_ops-supplied/README b/tests/Regression/bz544960-no-cfa_ops-supplied/README new file mode 100644 index 0000000..f1152ea --- /dev/null +++ b/tests/Regression/bz544960-no-cfa_ops-supplied/README @@ -0,0 +1,63 @@ +Kernel porting needed. + +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: +:: Test +:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: + +:: [ 09:22:47 ] :: [ INFO ] :: Checking whether we might want to try prologue search. +:: [ 09:23:10 ] :: [ BEGIN ] :: Running 'stap -P -vp4 readpages.stp' +Pass 1: parsed user script and 484 library scripts using 122428virt/95036res/15532shr/79120data kb, in 200usr/110sys/315real ms. +WARNING: never-assigned local variable 'nr_pages' (similar: rpages, __page, dev, name, file): identifier 'nr_pages' at readpages.stp:5:26 + source: printf("nr_pages=%d\n", nr_pages); + ^ +WARNING: never-assigned local variable 'rpages' (similar: nr_pages, __page, dev, name, rsize): identifier 'rpages' at :7:24 + source: printf("rpages=%d\n", rpages); + ^ +Pass 2: analyzed script: 2 probes, 17 functions, 3 embeds, 0 globals using 351676virt/327836res/19060shr/308368data kb, in 2880usr/1970sys/4927real ms. +Pass 3: translated to C into "/tmp/stapWU958g/stap_f189533513b6d61221ada924fedfc9c4_6369_src.c" using 351692virt/327964res/19188shr/308384data kb, in 490usr/800sys/1301real ms. +In file included from /usr/share/systemtap/runtime/linux/../regs.c:16, + from /usr/share/systemtap/runtime/linux/runtime.h:270, + from /usr/share/systemtap/runtime/runtime.h:26, + from /tmp/stapWU958g/stap_f189533513b6d61221ada924fedfc9c4_6369_src.c:21: +/tmp/stapWU958g/stap_f189533513b6d61221ada924fedfc9c4_6369_src.c: In function ‘enter_kretprobe_common’: +/tmp/stapWU958g/stap_f189533513b6d61221ada924fedfc9c4_6369_src.c:2499:45: error: ‘struct kretprobe_instance’ has no member named ‘ret_addr’ + 2499 | SET_REG_IP(regs, (unsigned long)inst->ret_addr); + | ^~ +/usr/share/systemtap/runtime/linux/../regs.h:85:44: note: in definition of macro ‘SET_REG_IP’ + 85 | #define SET_REG_IP(regs, x) REG_IP(regs) = x + | ^ +make[1]: *** [scripts/Makefile.build:288: /tmp/stapWU958g/stap_f189533513b6d61221ada924fedfc9c4_6369_src.o] Error 1 +make: *** [Makefile:1844: /tmp/stapWU958g] Error 2 +WARNING: kbuild exited with status: 2 +Pass 4: compiled C into "stap_f189533513b6d61221ada924fedfc9c4_6369.ko" in 1150usr/1910sys/2659real ms. +Pass 4: compilation failed. [man error::pass4] +:: [ 09:23:20 ] :: [ FAIL ] :: Command 'stap -P -vp4 readpages.stp' (Expected 0, got 1) +:: [ 09:23:20 ] :: [ BEGIN ] :: Running 'stap -P -vp4 tcp.sendmsg.stp' +Pass 1: parsed user script and 484 library scripts using 122428virt/95044res/15536shr/79120data kb, in 180usr/130sys/316real ms. +Pass 2: analyzed script: 5 probes, 2 functions, 4 embeds, 3 globals using 202292virt/178300res/19224shr/158984data kb, in 1720usr/1750sys/3531real ms. +Pass 3: translated to C into "/tmp/stapzXlpka/stap_c98d0598383a49c9b0a715336e876a54_18911_src.c" using 202308virt/178492res/19416shr/159000data kb, in 160usr/720sys/899real ms. +In file included from /usr/share/systemtap/runtime/linux/../regs.c:16, + from /usr/share/systemtap/runtime/linux/runtime.h:270, + from /usr/share/systemtap/runtime/runtime.h:26, + from /tmp/stapzXlpka/stap_c98d0598383a49c9b0a715336e876a54_18911_src.c:21: +/tmp/stapzXlpka/stap_c98d0598383a49c9b0a715336e876a54_18911_src.c: In function ‘enter_kretprobe_common’: +/tmp/stapzXlpka/stap_c98d0598383a49c9b0a715336e876a54_18911_src.c:2190:45: error: ‘struct kretprobe_instance’ has no member named ‘ret_addr’ + 2190 | SET_REG_IP(regs, (unsigned long)inst->ret_addr); + | ^~ +/usr/share/systemtap/runtime/linux/../regs.h:85:44: note: in definition of macro ‘SET_REG_IP’ + 85 | #define SET_REG_IP(regs, x) REG_IP(regs) = x + | ^ +make[1]: *** [scripts/Makefile.build:288: /tmp/stapzXlpka/stap_c98d0598383a49c9b0a715336e876a54_18911_src.o] Error 1 +make: *** [Makefile:1844: /tmp/stapzXlpka] Error 2 +WARNING: kbuild exited with status: 2 +Pass 4: compiled C into "stap_c98d0598383a49c9b0a715336e876a54_18911.ko" in 1250usr/1900sys/2762real ms. +Pass 4: compilation failed. [man error::pass4] +:: [ 09:23:28 ] :: [ FAIL ] :: Command 'stap -P -vp4 tcp.sendmsg.stp' (Expected 0, got 1) +:: [ 09:23:28 ] :: [ BEGIN ] :: Running 'stap -P -vp4 bdflush.stp' +Pass 1: parsed user script and 484 library scripts using 122428virt/94968res/15468shr/79120data kb, in 180usr/130sys/317real ms. +Pass 2: analyzed script: 3 probes, 5 functions, 98 embeds, 4 globals using 198116virt/174376res/18956shr/154808data kb, in 1930usr/2660sys/4689real ms. +/root/.systemtap/cache/87/stap_8728db2fdfe761c96d8963fd0c4fffd2_71969.ko +Pass 3: using cached /root/.systemtap/cache/87/stap_8728db2fdfe761c96d8963fd0c4fffd2_71969.c +Pass 4: using cached /root/.systemtap/cache/87/stap_8728db2fdfe761c96d8963fd0c4fffd2_71969.ko +:: [ 09:23:33 ] :: [ PASS ] :: Command 'stap -P -vp4 bdflush.stp' (Expected 0, got 0) + diff --git a/tests/Regression/bz544960-no-cfa_ops-supplied/bdflush.stp b/tests/Regression/bz544960-no-cfa_ops-supplied/bdflush.stp new file mode 100644 index 0000000..e38c685 --- /dev/null +++ b/tests/Regression/bz544960-no-cfa_ops-supplied/bdflush.stp @@ -0,0 +1,8 @@ +probe syscall.bdflush { + printf("%s\n", name) + printf("%s\n", argstr) +} + +probe syscall.bdflush.return { + printf("%s\n", name) +} diff --git a/tests/Regression/bz544960-no-cfa_ops-supplied/main.fmf b/tests/Regression/bz544960-no-cfa_ops-supplied/main.fmf new file mode 100644 index 0000000..bab475f --- /dev/null +++ b/tests/Regression/bz544960-no-cfa_ops-supplied/main.fmf @@ -0,0 +1,14 @@ +summary: bz544960-no-cfa_ops-supplied +description: '' +contact: Martin Hatina +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 30m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=544960 +extra-summary: /tools/systemtap/Regression/bz544960-no-cfa_ops-supplied +extra-task: /tools/systemtap/Regression/bz544960-no-cfa_ops-supplied diff --git a/tests/Regression/bz544960-no-cfa_ops-supplied/readpages.stp b/tests/Regression/bz544960-no-cfa_ops-supplied/readpages.stp new file mode 100644 index 0000000..7ff57b4 --- /dev/null +++ b/tests/Regression/bz544960-no-cfa_ops-supplied/readpages.stp @@ -0,0 +1,19 @@ +probe nfs.aop.readpages !, nfs.aop.readpage { + log(name); + printf("dev=%d\n", dev); + printf("ino=%d\n", ino); + printf("nr_pages=%d\n", nr_pages); + printf("file=%d\n", file); + printf("rpages=%d\n", rpages); + printf("rsize=%d\n", rsize); + printf("argstr=%s\n", argstr); + printf("size=%d\n", size); + printf("units=%s\n", units); +} + +probe nfs.aop.readpages.return !, nfs.aop.readpage.return { + log(name); + printf("retstr=%s\n", retstr); + printf("size=%d\n", size); + printf("units=%s\n", units); +} diff --git a/tests/Regression/bz544960-no-cfa_ops-supplied/runtest.sh b/tests/Regression/bz544960-no-cfa_ops-supplied/runtest.sh new file mode 100755 index 0000000..4be6581 --- /dev/null +++ b/tests/Regression/bz544960-no-cfa_ops-supplied/runtest.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/bz544960-no-cfa_ops-supplied +# Description: What the test does +# Author: Martin Hatina +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" +_SCRIPTS="readpages.stp tcp.sendmsg.stp bdflush.stp" + +rlJournalStart + rlPhaseStartTest + rlLogInfo "Checking whether we might want to try prologue search." + p="" + for s in $_SCRIPTS; do + stap -vp4 $s >& /dev/null || p="-P" + done + + for s in $_SCRIPTS; do + rlRun "stap $p -vp4 $s" + done + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/bz544960-no-cfa_ops-supplied/tcp.sendmsg.stp b/tests/Regression/bz544960-no-cfa_ops-supplied/tcp.sendmsg.stp new file mode 100644 index 0000000..1cb95b3 --- /dev/null +++ b/tests/Regression/bz544960-no-cfa_ops-supplied/tcp.sendmsg.stp @@ -0,0 +1,7 @@ +probe tcp.sendmsg { + printf("%d\n", size) +} + +probe tcp.sendmsg.return { + printf("%d\n", size) +} diff --git a/tests/Regression/bz706185-various-build-and-run/main.fmf b/tests/Regression/bz706185-various-build-and-run/main.fmf new file mode 100644 index 0000000..3d6770a --- /dev/null +++ b/tests/Regression/bz706185-various-build-and-run/main.fmf @@ -0,0 +1,15 @@ +summary: bz706185-various-build-and-run +description: bz706185-various-build-and-run +contact: Petr Muller +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +require: +recommend: + - systemtap +duration: 20m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=706185 +extra-summary: /tools/systemtap/Regression/bz706185-various-build-and-run +extra-task: /tools/systemtap/Regression/bz706185-various-build-and-run diff --git a/tests/Regression/bz706185-various-build-and-run/runtest.sh b/tests/Regression/bz706185-various-build-and-run/runtest.sh new file mode 100755 index 0000000..447c049 --- /dev/null +++ b/tests/Regression/bz706185-various-build-and-run/runtest.sh @@ -0,0 +1,87 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/bz706185-various-build-and-run +# Description: Test containing several build and run testcases. +# Author: Petr Muller +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2011 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh + +PACKAGE="systemtap" + +rlJournalStart +rlPhaseStartSetup + rlRun "rpm -qf $(which stap)" + rlRun "uname -r" +rlPhaseEnd + +rlPhaseStartTest "Build testcases" + export STAPOUT=`mktemp` + export TRACOUT=`mktemp` + for testcase in *.stp + do + rlLog "Testcase: $testcase" + rlRun "stap -v -p4 $testcase -m testcase --poison-cache &>$STAPOUT" 0 "Building testcase: $testcase" + if [ $? -ne 0 ] + then + rlLog "=== systemtap output start" + while read line + do + rlLog "$line" + done < $STAPOUT + rlLog "=== systemtap output end" + fi + rm -f testcase.ko + rm -f $STAPOUT + done +rlPhaseEnd + +rlPhaseStartTest "Run testcases" + for testcase in *.run + do + rlLog "Testcase: $testcase" + COMMAND="`cat $testcase`" + COMMAND="$COMMAND -o $TRACOUT $testcase --poison-cache &>$STAPOUT" + rlLog "Assembled command: [$COMMAND]" + rlRun "$COMMAND" 0 "Running testcase: $testcase" + if [ $? -ne 0 ] + then + rlLog "=== systemtap output start" + while read line; do rlLog "$line"; done < $STAPOUT + rlLog "=== systemtap output end" + rlLog "" + rlLog "=== tracing output start" + while read line; do rlLog "$line"; done < $TRACOUT + rlLog "=== tracing output end" + fi + rm -f $STAPOUT $TRACOUT + done +rlPhaseEnd + +rlPhaseStartCleanup + rlRun "rm -f $STAPOUT $TRACOUT" +rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/bz706185-various-build-and-run/softirq.run b/tests/Regression/bz706185-various-build-and-run/softirq.run new file mode 100644 index 0000000..e609cd5 --- /dev/null +++ b/tests/Regression/bz706185-various-build-and-run/softirq.run @@ -0,0 +1 @@ +stap -v softirq.stp diff --git a/tests/Regression/bz706185-various-build-and-run/softirq.stp b/tests/Regression/bz706185-various-build-and-run/softirq.stp new file mode 100644 index 0000000..347b840 --- /dev/null +++ b/tests/Regression/bz706185-various-build-and-run/softirq.stp @@ -0,0 +1,3 @@ +probe softirq.entry { println(">>> softirq") } +probe softirq.exit { println("<<< softirq")} +probe timer.ms(5000) { exit() } diff --git a/tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/main.fmf b/tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/main.fmf new file mode 100644 index 0000000..05c4212 --- /dev/null +++ b/tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/main.fmf @@ -0,0 +1,15 @@ +summary: dtrace-create-Wall-Wextra-pedantic-clean-code +description: dtrace-create-Wall-Wextra-pedantic-clean-code +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - systemtap-sdt-devel +duration: 5m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=902739 +extra-summary: /tools/systemtap/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code +extra-task: /tools/systemtap/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code diff --git a/tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/runtest.sh b/tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/runtest.sh new file mode 100755 index 0000000..d76f4c5 --- /dev/null +++ b/tests/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code/runtest.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/dtrace-create-Wall-Wextra-pedantic-clean-code +# Description: dtrace-create-Wall-Wextra-pedantic-clean-code +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "TMPDIR=$(mktemp -d)" + rlRun "pushd $TMPDIR" + rlPhaseEnd + + rlPhaseStart WARN "Info" + rlRun "which dtrace" + rlPhaseEnd + + rlPhaseStartTest + rlRun "printf \"provider xxx { probe xxx(); };\n\" > xxx" + rlRun "dtrace -G -k -s xxx &> dtrace.out" + rlRun "cat dtrace.out" + rlRun "CF=$( awk '/^source:/ {print $2}' dtrace.out )" + rlRun "gcc -c -Wall -Wextra -pedantic $CF 2>&1 | tee gcc.out" + rlRun "grep -i warning gcc.out" 1 + rlRun "grep -i error gcc.out" 1 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/elfutils-debuginfod-client-not-being-called/dotest.sh b/tests/Regression/elfutils-debuginfod-client-not-being-called/dotest.sh new file mode 100644 index 0000000..02970b4 --- /dev/null +++ b/tests/Regression/elfutils-debuginfod-client-not-being-called/dotest.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -xe + +rm -rf ~/.debuginfod_client_cache ~/.systemtap ||: + +debuginfod -p 8008 -d $(mktemp) -vvvvv >& debuginfod.log & +PID=$! + +sleep 5 + +export SYSTEMTAP_DEBUGINFO_PATH=/tmp +export DEBUGINFOD_URLS="http://127.0.0.1:8008" + +# The following doesn't work on aarch64 and s390x because of: +# https://sourceware.org/bugzilla/show_bug.cgi?id=25498 +# stap -p2 -e 'probe kernel.function("vfs_read") {println(pp())}' ||: + +stap -p2 -e 'probe process("/bin/true").function("main") {println(pp())}' -c /bin/true ||: + +sleep 5 + +kill -9 $PID + +grep 'started http server on' debuginfod.log +grep 'searching for buildid=[a-z0-9]* artifacttype=debuginfo' debuginfod.log + + diff --git a/tests/Regression/elfutils-debuginfod-client-not-being-called/main.fmf b/tests/Regression/elfutils-debuginfod-client-not-being-called/main.fmf new file mode 100644 index 0000000..2ae6333 --- /dev/null +++ b/tests/Regression/elfutils-debuginfod-client-not-being-called/main.fmf @@ -0,0 +1,14 @@ +summary: elfutils-debuginfod-client-not-being-called +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - elfutils-debuginfod +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1778921 +extra-summary: /tools/systemtap/Regression/elfutils-debuginfod-client-not-being-called +extra-task: /tools/systemtap/Regression/elfutils-debuginfod-client-not-being-called diff --git a/tests/Regression/elfutils-debuginfod-client-not-being-called/runtest.sh b/tests/Regression/elfutils-debuginfod-client-not-being-called/runtest.sh new file mode 100755 index 0000000..79d9197 --- /dev/null +++ b/tests/Regression/elfutils-debuginfod-client-not-being-called/runtest.sh @@ -0,0 +1,52 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/elfutils-debuginfod-client-not-being-called +# Description: elfutils-debuginfod-client-not-being-called +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlRun "TMP=$(mktemp -d)" + rlRun "cp dotest.sh $TMP/" + rlRun "pushd $TMP" + rlPhaseEnd + + rlPhaseStartTest + rlRun "bash dotest.sh" || + rlRun "cat debuginfod.log" + rlFileSubmit debuginfod.log + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMP" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/hellotrace.stp b/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/hellotrace.stp new file mode 100644 index 0000000..e390200 --- /dev/null +++ b/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/hellotrace.stp @@ -0,0 +1,8 @@ +probe begin +{ + printf ( "hello trace : printf\n") + printk (20,"hello trace : printk") + ftrace ( "hello trace : ftrace\n") + exit () +} + diff --git a/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/main.fmf b/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/main.fmf new file mode 100644 index 0000000..96bcab2 --- /dev/null +++ b/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/main.fmf @@ -0,0 +1,14 @@ +summary: ftrace-logging-tapset-not-working-as-expected-in +description: ftrace-logging-tapset-not-working-as-expected-in +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1810216 +extra-summary: /tools/systemtap/Regression/ftrace-logging-tapset-not-working-as-expected-in +extra-task: /tools/systemtap/Regression/ftrace-logging-tapset-not-working-as-expected-in diff --git a/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/runtest.sh b/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/runtest.sh new file mode 100755 index 0000000..4d3a759 --- /dev/null +++ b/tests/Regression/ftrace-logging-tapset-not-working-as-expected-in/runtest.sh @@ -0,0 +1,47 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/ftrace-logging-tapset-not-working-as-expected-in +# Description: ftrace-logging-tapset-not-working-as-expected-in +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +LOG1=$(mktemp) +LOG2=$(mktemp) + +rlJournalStart + rlPhaseStartTest + rlRun "mount | fgrep -i 'debugfs on'" + rlRun "cat /sys/kernel/debug/tracing/tracing_on | grep '^1$'" + rlRun "journalctl > $LOG1" + rlRun "stap -g -k -v hellotrace.stp" + rlRun "journalctl > $LOG2" + rlRun "diff $LOG1 $LOG2 | grep '^>.*hello trace : printk'" + rlRun "rm $LOG1 $LOG2" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/ipv6-tapset-support/main.fmf b/tests/Regression/ipv6-tapset-support/main.fmf new file mode 100644 index 0000000..9d08d89 --- /dev/null +++ b/tests/Regression/ipv6-tapset-support/main.fmf @@ -0,0 +1,16 @@ +summary: Test for BZ#822503 (ipv6 tapset support) +description: ipv6 tapset support +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - nfs-utils + - setup +duration: 50m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=822503 +extra-summary: /tools/systemtap/Regression/ipv6-tapset-support +extra-task: /tools/systemtap/Regression/ipv6-tapset-support diff --git a/tests/Regression/ipv6-tapset-support/nfsd.proc.lookup.stp b/tests/Regression/ipv6-tapset-support/nfsd.proc.lookup.stp new file mode 100755 index 0000000..86db264 --- /dev/null +++ b/tests/Regression/ipv6-tapset-support/nfsd.proc.lookup.stp @@ -0,0 +1,12 @@ +#!/usr/bin/stap + +# http://sourceware.org/systemtap/examples/network/nfsdtop.stp + +probe nfsd.proc.lookup { + printf("%s %s\n", client_ip, filename); +} + +probe timer.ms(100000) { + exit (); +} + diff --git a/tests/Regression/ipv6-tapset-support/runtest.sh b/tests/Regression/ipv6-tapset-support/runtest.sh new file mode 100755 index 0000000..62fa775 --- /dev/null +++ b/tests/Regression/ipv6-tapset-support/runtest.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/ipv6-tapset-support +# Description: Test for BZ#822503 (ipv6 tapset support) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm nfs-utils + rlRun "uname -r" + rlRun "which stap" + + rlRun "TMPD=$(mktemp -d --tmpdir=$HOME tmp.XXXXXXX)" + rlRun "mkdir $TMPD/{A,B}" + rlRun "chmod --recursive 0777 $TMPD" + rlRun "STAPLOG=$(mktemp)" + + rlServiceStart rpcbind + sleep 5 + NFS_SERVICE=nfs + rlIsRHEL '>=8' && NFS_SERVICE=nfs-server + rlServiceStart $NFS_SERVICE + sleep 10 + rlRun "exportfs -ua" + rlRun "exportfs -i -o 'rw,no_root_squash' *:$TMPD/A" + rlPhaseEnd + + rlPhaseStartTest + # ======= work around bz1605574 + rlLogInfo "Let's check if we can compile the module." + rlLogInfo "In case we can't, we'll go ahead with prologue searching." + set -x + EXTRA_SWITCHES='' + stap -p4 nfsd.proc.lookup.stp || EXTRA_SWITCHES="-P" + set +x + # ============================= + + # mount is sufficient to invoke nfsd.proc.lookup + rlRun "stap $EXTRA_SWITCHES -v -c 'mount -t nfs -v [::1]:$TMPD/A $TMPD/B' nfsd.proc.lookup.stp |& tee $STAPLOG" + rlRun "umount $TMPD/B" + rlRun "grep 'Unsupported Address Family' $STAPLOG" 1 + rlRun "egrep '^\[0000:0000:0000:0000:0000:0000:0000:0001\]:[0-9]+.*$(basename $TMPD)' $STAPLOG" + rlPhaseEnd + + rlPhaseStartCleanup + rlServiceRestore $NFS_SERVICE + rlServiceRestore rpcbind + rlRun "rm -rf $TMPD $STAPLOG" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/irq-vector-tracepoints/main.fmf b/tests/Regression/irq-vector-tracepoints/main.fmf new file mode 100644 index 0000000..c9ec663 --- /dev/null +++ b/tests/Regression/irq-vector-tracepoints/main.fmf @@ -0,0 +1,15 @@ +summary: irq-vector-tracepoints +description: irq-vector-tracepoints +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap-devel + - kernel-debuginfo +duration: 15m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1020437 +extra-summary: /tools/systemtap/Regression/irq-vector-tracepoints +extra-task: /tools/systemtap/Regression/irq-vector-tracepoints diff --git a/tests/Regression/irq-vector-tracepoints/runtest.sh b/tests/Regression/irq-vector-tracepoints/runtest.sh new file mode 100755 index 0000000..9b88712 --- /dev/null +++ b/tests/Regression/irq-vector-tracepoints/runtest.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/irq-vector-tracepoints +# Description: irq-vector-tracepoints +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "TMPDIR=$(mktemp -d)" + rlRun "pushd $TMPDIR" + rlRun "mount -t debugfs /dev/null /sys/kernel/debug" 0-255 + rlRun "test -d /sys/kernel/debug/tracing/events" + rlPhaseEnd + + rlPhaseStart FAIL "Systemtap sanity check" + rlRun "stap --version" + rlRun "stap -v -e 'probe kernel.function(\"vfs_read\"){ exit() }'" + rlPhaseEnd + + rlPhaseStart FAIL "Create list of all kernel tracepoints known to stap" + rlRun "stap -l 'kernel.trace(\"*\")' > tracepoints" + rlFileSubmit tracepoints + rlPhaseEnd + + rlPhaseStart FAIL "Check irq_vectors" + dir='/sys/kernel/debug/tracing/events/irq_vectors' + if test -d $dir; then + for p in $( find $dir -mindepth 1 -type d | awk -F\/ '{print $NF}' ); do + rlLogInfo "Checking $p" + rlRun "grep -q $p tracepoints" + done + # additional checks + rlRun "stap -vp4 -e 'probe kernel.trace(\"local_timer_entry\") {println(pp())}'" + rlRun "stap -vp4 -e 'probe kernel.trace(\"reschedule_entry\") {println(pp())}'" + else + if arch | egrep 'x86_64|i[36]86'; then + rlLogError "$dir does not exist" + else + rlLogInfo "$dir does not exist" + fi + fi + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/netdev-receive/main.fmf b/tests/Regression/netdev-receive/main.fmf new file mode 100644 index 0000000..78ec038 --- /dev/null +++ b/tests/Regression/netdev-receive/main.fmf @@ -0,0 +1,14 @@ +summary: netdev.receive +description: bz1518462 netdev.receive +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 15m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1518462 +extra-summary: /tools/systemtap/Regression/netdev-receive +extra-task: /tools/systemtap/Regression/netdev-receive diff --git a/tests/Regression/netdev-receive/runtest.sh b/tests/Regression/netdev-receive/runtest.sh new file mode 100755 index 0000000..b184941 --- /dev/null +++ b/tests/Regression/netdev-receive/runtest.sh @@ -0,0 +1,44 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/netdev-receive +# Description: netdev.receive +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" +TMPFILE=$(mktemp) + +rlJournalStart + rlPhaseStartTest + # Here we rely on that netdev.receive gets hit immediately without us explicitly triggering it. + # Not all rhel-7 stap versions have -T already, so we use -E instead. + rlRun "stap -o $TMPFILE -ve 'probe netdev.receive{log(\"HIT\") exit()}' -E 'probe timer.s(10) {log(\"TIMEOUT\") exit()}'" + rlRun "cat $TMPFILE" + rlRun "grep HIT $TMPFILE" + rlRun "grep TIMEOUT $TMPFILE" 1 + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/pass-4-failure-netfilter-examples/main.fmf b/tests/Regression/pass-4-failure-netfilter-examples/main.fmf new file mode 100644 index 0000000..5244e99 --- /dev/null +++ b/tests/Regression/pass-4-failure-netfilter-examples/main.fmf @@ -0,0 +1,16 @@ +summary: Test for BZ#1055778 (Pass 4 failure on RHEL7 for examples) +description: Test for BZ#1055778 (Pass 4 failure on RHEL7 for examples) +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - valgrind + - systemtap + - systemtap-testsuite +duration: 30m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1055778 +extra-summary: /tools/systemtap/Regression/pass-4-failure-netfilter-examples +extra-task: /tools/systemtap/Regression/pass-4-failure-netfilter-examples diff --git a/tests/Regression/pass-4-failure-netfilter-examples/runtest.sh b/tests/Regression/pass-4-failure-netfilter-examples/runtest.sh new file mode 100755 index 0000000..2eed9af --- /dev/null +++ b/tests/Regression/pass-4-failure-netfilter-examples/runtest.sh @@ -0,0 +1,55 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/pass-4-failure-netfilter-examples +# Description: Test for BZ#1055778 (Pass 4 failure on RHEL7 for examples) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartSetup + TESTS=$(mktemp) + rlRun "rpm -qa | fgrep systemtap-testsuite" + rlPhaseEnd + + rpm -qa | grep systemtap-testsuite | xargs rpm -ql \ + | egrep 'netfilter_drop.stp|netfilter_summary.stp' \ + | while read line; do + rlPhaseStart FAIL "Testing $line" + rlRun "stap -p4 $line -v -g TCP 1" && \ + echo $line >> $TESTS + rlPhaseEnd + done + + rlPhaseStart FAIL "Check what was tested" + rlRun "grep netfilter_drop.stp $TESTS" + rlRun "grep netfilter_summary.stp $TESTS" + rm -f $TESTS + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/python-probing/main.fmf b/tests/Regression/python-probing/main.fmf index 1a5ec22..55b3281 100644 --- a/tests/Regression/python-probing/main.fmf +++ b/tests/Regression/python-probing/main.fmf @@ -1,10 +1,5 @@ summary: Systemtap static probes test -description: | - This test checks basic functionality of Python's systemtap static - probes. It runs list & top systemtap scripts (examples from the - python rpm) and then a python script using the "random" module. - Finally it checks that the "random" module is correctly listed in - the output of both systemtap scripts. +description: Systemtap static probes test contact: Petr Splichal component: - python @@ -21,3 +16,4 @@ recommend: duration: 15m extra-summary: /CoreOS/python/Sanity/systemtap extra-task: /CoreOS/python/Sanity/systemtap +tier: 1 diff --git a/tests/Regression/second-command-not-captured/main.fmf b/tests/Regression/second-command-not-captured/main.fmf new file mode 100644 index 0000000..7b88ecc --- /dev/null +++ b/tests/Regression/second-command-not-captured/main.fmf @@ -0,0 +1,16 @@ +summary: second-command-not-captured +description: second-command-not-captured +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - ruby + - ruby-libs +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1857749 +extra-summary: /tools/systemtap/Regression/second-command-not-captured +extra-task: /tools/systemtap/Regression/second-command-not-captured diff --git a/tests/Regression/second-command-not-captured/ruby-exercise.stp b/tests/Regression/second-command-not-captured/ruby-exercise.stp new file mode 100644 index 0000000..404fdd1 --- /dev/null +++ b/tests/Regression/second-command-not-captured/ruby-exercise.stp @@ -0,0 +1,7 @@ +probe ruby.method.entry, ruby.cmethod.entry { + printf("%d -> %s::%s %s:%d\n", tid(), classname, methodname, file, line); +} + +probe ruby.method.return, ruby.cmethod.return { + printf("%d <- %s::%s %s:%d\n", tid(), classname, methodname, file, line); +} diff --git a/tests/Regression/second-command-not-captured/runtest.sh b/tests/Regression/second-command-not-captured/runtest.sh new file mode 100755 index 0000000..fddabd1 --- /dev/null +++ b/tests/Regression/second-command-not-captured/runtest.sh @@ -0,0 +1,42 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/second-command-not-captured +# Description: second-command-not-captured +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartTest + rlLog "`which stap`" + rlLog "`stap -V`" + rlRun "stap -s 100 -v ./ruby-exercise.stp -c ./test.sh -o stap.log" + rlRun "grep 'Array::push' stap.log" || + rlFileSubmit "stap.log" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/second-command-not-captured/test.sh b/tests/Regression/second-command-not-captured/test.sh new file mode 100755 index 0000000..d308ba2 --- /dev/null +++ b/tests/Regression/second-command-not-captured/test.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -e + +ruby -e 'puts "ABC"' +ruby -e '[1, 2, 3].push(4)' +sleep 10 diff --git a/tests/Regression/selected-parts-of-upstream-testsuite/main.fmf b/tests/Regression/selected-parts-of-upstream-testsuite/main.fmf new file mode 100644 index 0000000..a1d57ec --- /dev/null +++ b/tests/Regression/selected-parts-of-upstream-testsuite/main.fmf @@ -0,0 +1,23 @@ +summary: selected-parts-of-upstream-testsuite +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - libstdc++ + - dejagnu + - elfutils-devel + - gettext + - libgcc + - glibc-devel + - gcc-c++ + - libstdc++-devel + - dyninst + - dyninst-devel + - systemtap-testsuite +duration: 48h +extra-summary: /tools/systemtap/Regression/selected-parts-of-upstream-testsuite +extra-task: /tools/systemtap/Regression/selected-parts-of-upstream-testsuite diff --git a/tests/Regression/selected-parts-of-upstream-testsuite/runtest.sh b/tests/Regression/selected-parts-of-upstream-testsuite/runtest.sh new file mode 100755 index 0000000..7c2882b --- /dev/null +++ b/tests/Regression/selected-parts-of-upstream-testsuite/runtest.sh @@ -0,0 +1,184 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/selected-parts-of-upstream-testsuite +# Description: selected-parts-of-upstream-testsuite +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Be tolerant about selinux +export AVC_ERROR='+no_avc_check' + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +DMESG1=$(mktemp) +DMESG2=$(mktemp) + +PACKAGE="systemtap" + +SUBTESTS="\ +attach_detach.exp \ +bz1126645.exp \ +bz1214176.exp \ +bz1252436.exp \ +exelib.exp \ +pr22005.exp \ +server.exp \ +systemtap-service.exp \ +task_dentry_path.exp \ +task_paths.exp \ +tracepoints.exp \ +" + +blacklist_subtest() +{ + token=${1/\//\\/} + SUBTESTS=${SUBTESTS/$token/} +} + +P4TESTS="\ +buildok/nfs-all-probes.stp \ +buildok/nfs-detailed.stp \ +buildok/nfs-fop.check_flags.stp \ +buildok/nfs_proc-detailed.stp \ +buildok/nfsd-all-probes.stp \ +buildok/nfsd-detailed.stp \ +systemtap.examples/io/nfs_func_users.stp \ +systemtap.examples/network/nfsdtop.stp \ +" + +blacklist_p4() +{ + token=${1/\//\\/} + P4TESTS=${P4TESTS/$token/} +} + +if [[ $(rpm --eval '%{rhel}') -ge 8 ]]; then + # mjw authored that testcase - had been notified + arch | fgrep 'x86_64' && blacklist_subtest 'exelib.exp' + + blacklist_p4 'buildok/nfs-fop.check_flags.stp' + blacklist_p4 'buildok/nfs_proc-detailed.stp' + blacklist_p4 'buildok/nfsd-detailed.stp' + # bz1709831 + blacklist_p4 'buildok/nfs-detailed.stp' + arch | fgrep -q ppc64le && blacklist_p4 'buildok/nfs-all-probes.stp' +elif [[ $(rpm --eval '%{rhel}') -eq 7 ]]; then + # RHEL-ALT + if rpm -qi kernel | fgrep -q kernel-alt; then + # at_var.exp is expected to fail on Pegas - https://bugzilla.redhat.com/show_bug.cgi?id=1165848#c7 + blacklist_subtest 'at_var.exp' + fi + + # bz1107616, bz1698737 + blacklist_p4 'buildok/nfsd-detailed.stp' + if arch | fgrep -q ppc64le; then + blacklist_p4 'buildok/nfs-all-probes.stp' + blacklist_p4 'buildok/nfs-detailed.stp' + blacklist_p4 'buildok/nfsd-all-probes.stp' + fi +elif [[ $(rpm --eval '%{rhel}') -le 6 ]]; then + true +fi + +which stap | fgrep -q toolset && blacklist_subtest 'modules_out_of_tree.exp' + +rlJournalStart + rlPhaseStartSetup + TESTSUITERPM="$(rpm --queryformat='%{name}\n' -qf $(which stap) | head -1 | grep -o '.*systemtap')-testsuite" + rlLogInfo "$(rpm -q $TESTSUITERPM)" + TESTSUITEDIR="$(rpm -ql $TESTSUITERPM | grep -o '.*share/systemtap/testsuite/' | head -1)" + rlLogInfo "$TESTSUITEDIR" + + # For devtoolset, compat arch support was dropped for non-x86_64 arches. Ref: bz1493500 + if echo $TESTSUITEDIR | grep -q toolset && arch | egrep -q '^(ppc64|s390x)$'; then + sed -i '/^proc arch_compile_flags/,/^}/d' $TESTSUITEDIR/lib/compile_flags.exp + echo 'proc arch_compile_flags {} { return 1 }' >> $TESTSUITEDIR/lib/compile_flags.exp + fi + + # Need to suppress warnings so that task_dentry_path.exp can pass + # And --skip-badvars to let task_paths.exp pass + rlRun "sed -i 's/--rlimit-cpu=850/-w --skip-badvars \0/' $TESTSUITEDIR/lib/systemtap.exp" + + rlServiceStop firewalld + rlServiceStop iptables + rlServiceStop ip6tables + rlServiceStart avahi-daemon + rlRun "rpm -qa | grep ^kernel | grep -v `uname -r` | xargs rpm -e" 0-255 + rlRun "stap-prep" 0,127 + PKGMGR="yum --skip-broken --nogpgcheck" + rpm -q dnf && PKGMGR="dnf --setopt=strict=0 --nogpgcheck" + rlRun "$PKGMGR -y install --setopt=multilib_policy=all libstdc++ dejagnu elfutils-devel gettext libgcc glibc-devel gcc-c++ libstdc++-devel dyninst dyninst-devel" + rlRun "sysctl -w kernel.panic=1" + rlRun "sysctl -w kernel.panic_on_oops=1" + rlPhaseEnd + + rlPhaseStartTest + rlRun "cd $TESTSUITEDIR" + rlRun "make clean" + rlRun "dmesg > $DMESG1" + rlRun "make installcheck RUNTESTFLAGS=\"${RUNTESTFLAGS:-$SUBTESTS}\"" + rlRun "dmesg > $DMESG2" + rlLogInfo "$SUBTESTS" + rlDejaSum "systemtap.sum" + rlFileSubmit "systemtap.log" + rlFileSubmit "systemtap.sum" + rlPhaseEnd + + rlPhaseStart FAIL "Run selected -p4 tests" + for t in $P4TESTS; do + rlLogInfo "Trying to compile $t without prologue search ..." + ADDSWITCHES='' + stap $ADDSWITCHES -w -o /dev/null -p4 $t || ADDSWITCHES='-P' + rlRun "stap $ADDSWITCHES -w -p4 $t" + done + rlPhaseEnd + + rlPhaseStart FAIL "Check for BUG: in dmesg" + rlRun "diff $DMESG1 $DMESG2" 0-255 + rlRun "diff $DMESG1 $DMESG2 | grep 'BUG:'" 1 + rlPhaseEnd + + rlPhaseStart FAIL "Evaluate test results" + TEMPLOG=$(mktemp) + rlRun "cp systemtap.sum $TEMPLOG" + # BLACKLIST + if which stap | grep -q toolset; then + rlLogInfo "Ignore boot time probing subtest FAILures per bz1121363#c20 for devtoolset" + sed -i '/^FAIL: stap-service::boot probing - install script/d' $TEMPLOG + sed -i '/^FAIL: stap-service::boot probing - check script/d' $TEMPLOG + fi + # check for failures + rlRun "grep ^PASS $TEMPLOG" 0 "Assert a/some PASS" + rlRun "grep ^FAIL $TEMPLOG" 1 "Assert no FAIL" + rm -f $TEMPLOG + rlPhaseEnd + + rlPhaseStartCleanup + rlServiceRestore firewalld + rlServiceRestore iptables + rlServiceRestore ip6tables + rlServiceRestore avahi-daemon + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/semantic-error-nfs-proc-read_setup/main.fmf b/tests/Regression/semantic-error-nfs-proc-read_setup/main.fmf new file mode 100644 index 0000000..72489b4 --- /dev/null +++ b/tests/Regression/semantic-error-nfs-proc-read_setup/main.fmf @@ -0,0 +1,14 @@ +summary: semantic-error-nfs-proc-read_setup +description: semantic-error-nfs-proc-read_setup +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 5m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=884951 +extra-summary: /tools/systemtap/Regression/semantic-error-nfs-proc-read_setup +extra-task: /tools/systemtap/Regression/semantic-error-nfs-proc-read_setup diff --git a/tests/Regression/semantic-error-nfs-proc-read_setup/nfs.proc.read_setup.stp b/tests/Regression/semantic-error-nfs-proc-read_setup/nfs.proc.read_setup.stp new file mode 100644 index 0000000..c6974c7 --- /dev/null +++ b/tests/Regression/semantic-error-nfs-proc-read_setup/nfs.proc.read_setup.stp @@ -0,0 +1,5 @@ +probe nfs.proc.read_setup{ + println("nfs.proc.read_setup server_ip: ", server_ip); + println("nfs.proc.read_setup prot: ", prot); +} + diff --git a/tests/Regression/semantic-error-nfs-proc-read_setup/runtest.sh b/tests/Regression/semantic-error-nfs-proc-read_setup/runtest.sh new file mode 100755 index 0000000..d14e39b --- /dev/null +++ b/tests/Regression/semantic-error-nfs-proc-read_setup/runtest.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/semantic-error-nfs-proc-read_setup +# Description: semantic-error-nfs-proc-read_setup +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "uname -r" + rlRun "rpm -qa | grep ^kernel | sort" + rlRun "rpm -qa | grep systemtap | sort" + rlRun "which stap" + rlPhaseEnd + + rlPhaseStartTest + rlRun "stap -v -p 2 nfs.proc.read_setup.stp" + rlPhaseEnd + +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/semantic-errors-bz1062076/main.fmf b/tests/Regression/semantic-errors-bz1062076/main.fmf new file mode 100644 index 0000000..ca70df0 --- /dev/null +++ b/tests/Regression/semantic-errors-bz1062076/main.fmf @@ -0,0 +1,14 @@ +summary: semantic-errors-bz1062076 +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 30m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1062076 +extra-summary: /tools/systemtap/Regression/semantic-errors-bz1062076 +extra-task: /tools/systemtap/Regression/semantic-errors-bz1062076 diff --git a/tests/Regression/semantic-errors-bz1062076/runtest.sh b/tests/Regression/semantic-errors-bz1062076/runtest.sh new file mode 100755 index 0000000..3f53859 --- /dev/null +++ b/tests/Regression/semantic-errors-bz1062076/runtest.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/semantic-errors-bz1062076 +# Description: semantic-errors-bz1062076 +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartTest + rlLogInfo "Check if we might want to try out prologue search" + p="" + stap -vp4 sript.stp >& /dev/null || p="-P" + rlRun "stap $p -vp4 script.stp" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/semantic-errors-bz1062076/script.stp b/tests/Regression/semantic-errors-bz1062076/script.stp new file mode 100644 index 0000000..7527474 --- /dev/null +++ b/tests/Regression/semantic-errors-bz1062076/script.stp @@ -0,0 +1,3 @@ +probe nfsd.close? { printf("%s\n", filename) } probe never { exit() } +probe sunrpc.clnt.clone_client { print(progname) } +probe scsi.iodone { printf("%d, %d, %d, %d, %d, %d, %d, %d\n", host_no, channel, lun, dev_id, device_state, data_direction, req_addr, scsi_timer_pending ) } diff --git a/tests/Regression/semantic-errors-bz953776/main.fmf b/tests/Regression/semantic-errors-bz953776/main.fmf new file mode 100644 index 0000000..c95eaee --- /dev/null +++ b/tests/Regression/semantic-errors-bz953776/main.fmf @@ -0,0 +1,17 @@ +summary: semantic-errors-bz953776 +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +require: +recommend: + - systemtap + - perf + - gcc +duration: 60m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=953776 +extra-summary: /tools/systemtap/Regression/semantic-errors-bz953776 +extra-task: /tools/systemtap/Regression/semantic-errors-bz953776 diff --git a/tests/Regression/semantic-errors-bz953776/runtest.sh b/tests/Regression/semantic-errors-bz953776/runtest.sh new file mode 100755 index 0000000..28e9359 --- /dev/null +++ b/tests/Regression/semantic-errors-bz953776/runtest.sh @@ -0,0 +1,161 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/semantic-errors-bz953776 +# Description: semantic-errors-bz953776 +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +_rhelmajor=$(rpm --eval '%{rhel}') +_arch=$(arch) + +function perf_probe_failed () +{ + probe=$1 + perf probe -d $probe ||: + perf probe --add $probe + retval=$? + test $retval -eq 0 && \ + rlLogInfo "Running perf probe --add $probe PASSED" || \ + rlLogInfo "Running perf probe --add $probe FAILED" + perf probe -d $probe ||: + if test $retval -eq 0; then + return 1 + else + return 0 + fi +} + +function perf_found_none_of () +{ + ret=0 + for f in "$@"; do + perf_probe_failed $f || ret=1 + done + return $ret +} + +rlJournalStart + # CHECK FOR PERF ---------------------------------------------- + rlPhaseStart FAIL "CHECK FOR PERF" + rlRun "perf --version" + rlPhaseEnd + + rlPhaseStartSetup + rlRun "TMPDIR=$(mktemp -d)" + rlRun "pushd $TMPDIR" + + # prepare sigaltstack for case-5 + cat > sigaltstack.c < +#include +void handler(int sig) +{ + write(2, "stack overflow\n", 15); + _exit(1); +} +unsigned infinite_recursion(unsigned x) { + return infinite_recursion(x)+1; +} +int main() +{ + static char stack[SIGSTKSZ]; + stack_t ss = { + .ss_size = SIGSTKSZ, + .ss_sp = stack, + }; + struct sigaction sa = { + .sa_handler = handler, + .sa_flags = SA_ONSTACK + }; + sigaltstack(&ss, 0); + sigfillset(&sa.sa_mask); + sigaction(SIGSEGV, &sa, 0); + infinite_recursion(0); +} +EOF + rlRun "gcc -o sigaltstack sigaltstack.c" + rlPhaseEnd + + p="" + uname -m | grep -q ^ppc && p="-P" + p="$p -E 'probe timer.s(900){error(\"probe timeout after 15 minutes\")}'" + + export p + + rlPhaseStart FAIL 'case-1' + rlRun "stap $p -v -e 'probe syscall.close { println(fd); exit(); }'" + rlPhaseEnd + + # After fixing bz1657681, this constraint can be removed + if [[ $(rpm --eval %rhel) -le 7 ]]; then + if arch | grep -vq ppc; then + rlPhaseStart FAIL 'case-2' + # https://bugzilla.redhat.com/show_bug.cgi?id=1657681 + rlRun "stap $p -v -e 'probe socket.close { print(protocol); print(family); print(state); print(flags); print(type); exit() }'" + rlPhaseEnd + fi + fi + + ( + test $_rhelmajor -le 8 && exit + perf_found_none_of "sys_read" "__arm64_sys_read" "do_syscall_64" && exit + test $_rhelmajor -ge 9 && test $_arch = ppc64le -o $_arch = aarch64 && p="$p -p4" # no hits + rlPhaseStart FAIL 'case-3' + rlRun "stap $p -v -e 'probe kernel.function(\"sys_read\").return!, kernel.function(\"__arm64_sys_read\").return!, kernel.function(\"do_syscall_64\").return { println(probefunc()) exit()}'" + rlPhaseEnd + ) + + rlPhaseStart FAIL 'case-4' + rlRun "stap $p -v -e 'probe syscall.open, syscall.openat { if (\"open\" == execname()) println(argstr); exit() }'" + rlPhaseEnd + + rlPhaseStart FAIL 'case-5' + rlRun "stap $p -ve 'probe syscall.sigaltstack { println(name); exit() }' -c './sigaltstack || true'" + rlPhaseEnd + + # gcc 8.2.1->8.3.1 change related to systemtap debuginfo regression in rhel-8.1.0, kernel -84 -> -85 + # https://bugzilla.redhat.com/show_bug.cgi?id=1709831#c17 + # ( fgrep RESULT: /tmp/typescript | sort -u ) + rlPhaseStart FAIL 'case-6' + rlRun "stap $p -vp4 -e 'probe sunrpc.clnt.shutdown_client { println(servername) }'" + rlPhaseEnd + + rlPhaseStart FAIL 'case-7' + rlRun "stap $p -vp4 -e 'probe sunrpc.clnt.bind_new_program { println(servername) }'" + rlPhaseEnd + + rlPhaseStart FAIL 'case-8' + rlRun "stap $p -vp4 -e 'probe sunrpc.clnt.bind_new_program { println(servername, vers) }'" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/small-tests/main.fmf b/tests/Regression/small-tests/main.fmf index d659ce8..caa5060 100644 --- a/tests/Regression/small-tests/main.fmf +++ b/tests/Regression/small-tests/main.fmf @@ -1,4 +1,4 @@ -summary: suns small tests +summary: Small tests description: '' contact: Martin Cermak component: @@ -12,3 +12,4 @@ recommend: duration: 10m extra-summary: /tools/systemtap/Regression/small-tests extra-task: /tools/systemtap/Regression/small-tests +tier: 1 diff --git a/tests/Regression/small-tests/runtest.sh b/tests/Regression/small-tests/runtest.sh index 6f3e1c2..3b89566 100755 --- a/tests/Regression/small-tests/runtest.sh +++ b/tests/Regression/small-tests/runtest.sh @@ -179,5 +179,44 @@ rlJournalStart rlPhaseStart FAIL "test 12 bz1940761" rlRun "stap -v /usr/share/systemtap/examples/process/strace.stp -w -c \"echo hello world\"" rlPhaseEnd + + # broken-tapset-print-ubacktrace ------------------------------ + rlPhaseStart FAIL "test 13 broken-tapset-print-ubacktrace" + rlRun "stap -p4 -e 'probe begin { print_ubacktrace() }'" + rlPhaseEnd + + # Protected from elision -------------------------------------- + rlPhaseStart FAIL "test 14 protected from elision" + rlRun "stap -v -e 'probe nfs.fop.fsync {} probe begin {print(\"Protected from elision\")}' -c true |\ + fgrep 'Protected from elision'" + rlPhaseEnd + + # bz544207 ---------------------------------------------------- + rlPhaseStart FAIL "test 15 bz544207" + extra_opts="" + stap -vp4 -e 'probe nfs.proc.write_setup{ println(how) }' || extra_opts="-P" + rlRun "stap $extra_opts -vp4 -e 'probe nfs.proc.write_setup{ println(how) }'" + rlPhaseEnd + + # bz544209 ---------------------------------------------------- + rlPhaseStart FAIL "test 16 bz544209" + rlRun "stap -vp2 -e 'probe sunrpc.clnt.create_client.return {}'" + rlPhaseEnd + + # bz592830 ---------------------------------------------------- + rlPhaseStart FAIL "test 17 bz592830" + rlRun "stap -vp2 -e 'probe signal.check_ignored.return {println(1)}'" + rlPhaseEnd + + # caller-does-not-work ---------------------------------------- + rlPhaseStart FAIL "test 18 caller-does-not-work" + rlRun "stap -ve 'probe kernel.function(\"vfs_read\") \ + { printf(\"%s\n\", caller()); exit() }' 2>&1 | tee strace.log" + rlPhaseEnd + + # missing-rpc-tracepoints ------------------------------------- + rlPhaseStart FAIL "test 19 missing-rpc-tracepoints" + rlRun "stap -L 'kernel.trace(\"rpc*\")'" + rlPhaseEnd rlJournalPrintText rlJournalEnd diff --git a/tests/Regression/stap-ERROR-Build-id-mismatch-with/main.fmf b/tests/Regression/stap-ERROR-Build-id-mismatch-with/main.fmf new file mode 100644 index 0000000..6744a8d --- /dev/null +++ b/tests/Regression/stap-ERROR-Build-id-mismatch-with/main.fmf @@ -0,0 +1,14 @@ +summary: Test for BZ#1566422 (stap ERROR Build-id mismatch with) +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1566422 +extra-summary: /tools/systemtap/Regression/stap-ERROR-Build-id-mismatch-with +extra-task: /tools/systemtap/Regression/stap-ERROR-Build-id-mismatch-with diff --git a/tests/Regression/stap-ERROR-Build-id-mismatch-with/runtest.sh b/tests/Regression/stap-ERROR-Build-id-mismatch-with/runtest.sh new file mode 100755 index 0000000..f026393 --- /dev/null +++ b/tests/Regression/stap-ERROR-Build-id-mismatch-with/runtest.sh @@ -0,0 +1,43 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/stap-ERROR-Build-id-mismatch-with +# Description: Test for BZ#1566422 (stap ERROR Build-id mismatch with) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2018 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartTest + if arch | grep -q s390x; then + rlLogWarning "Test not relevant" + else + rlRun "sudo modprobe igb" + rlRun "stap -e 'probe module(\"igb\").function(\"igb_*_module\") { printf(\"%s: %s.\n\", ctime(gettimeofday_s()), ppfunc()); }' -c \"bash -c 'sudo rmmod igb; sudo modprobe igb'\"" + fi + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/stapio-possible-circular-locking-dependency/main.fmf b/tests/Regression/stapio-possible-circular-locking-dependency/main.fmf new file mode 100644 index 0000000..c1bafab --- /dev/null +++ b/tests/Regression/stapio-possible-circular-locking-dependency/main.fmf @@ -0,0 +1,15 @@ +summary: Test for BZ#1020207 (stapio possible circular locking dependency) +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +require: +recommend: + - systemtap +duration: 4h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1020207 +extra-summary: /tools/systemtap/Regression/stapio-possible-circular-locking-dependency +extra-task: /tools/systemtap/Regression/stapio-possible-circular-locking-dependency diff --git a/tests/Regression/stapio-possible-circular-locking-dependency/runtest.sh b/tests/Regression/stapio-possible-circular-locking-dependency/runtest.sh new file mode 100755 index 0000000..856197c --- /dev/null +++ b/tests/Regression/stapio-possible-circular-locking-dependency/runtest.sh @@ -0,0 +1,74 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/stapio-possible-circular-locking-dependency +# Description: Test for BZ#1020207 (stapio possible circular locking dependency) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "TMPDIR=\$(mktemp -d)" + rlRun "pushd $TMPDIR" + cat > test5.stap < reproduce.sh < /proc/sys/vm/drop_caches + stap test5.stap -c "sleep 2" + if dmesg 2>&1 | grep "possible circular locking dependency detected"; then + dmesg + exit 1 + fi +done +exit 0 +EOF + + rlRun "chmod +x reproduce.sh" + rlPhaseEnd + + rlPhaseStartTest + TO=180 # timeout seconds + # when timeout TO is hit, exitcode 124 is returned + rlRun "timeout $TO ./reproduce.sh" 0,124 + # if issue doesn't get reproduced within TO, the test will pass + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/suspicious-RCU-usage/main.fmf b/tests/Regression/suspicious-RCU-usage/main.fmf new file mode 100644 index 0000000..5e9c792 --- /dev/null +++ b/tests/Regression/suspicious-RCU-usage/main.fmf @@ -0,0 +1,14 @@ +summary: suspicious-RCU-usage +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1788662 +extra-summary: /tools/systemtap/Regression/suspicious-RCU-usage +extra-task: /tools/systemtap/Regression/suspicious-RCU-usage diff --git a/tests/Regression/suspicious-RCU-usage/runtest.sh b/tests/Regression/suspicious-RCU-usage/runtest.sh new file mode 100755 index 0000000..bd11b63 --- /dev/null +++ b/tests/Regression/suspicious-RCU-usage/runtest.sh @@ -0,0 +1,49 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/suspicious-RCU-usage +# Description: suspicious-RCU-usage +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2020 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartTest + dmesg1=$(mktemp) + dmesg2=$(mktemp) + diff=$(mktemp) + dmesg > $dmesg1 + rlRun "stap -e 'probe kernel.trace(\"*\"){}' -t -u -v -c '/bin/true'" + sleep 10 + dmesg > $dmesg2 + rlRun "diff $dmesg1 $dmesg2 |& tee $diff" + # Reproduced on hpe-moonshot-02-c02.hpe1.lab.eng.bos.redhat.com + # using kernel-4.18.0-167.el8.aarch64+debug and systemtap-4.2-1.el8.aarch64. + rlRun "fgrep -i rcu $diff" 1 + rm $dmesg{1,2} $diff + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/syscall-get-arguments-returning-wrong-value/main.fmf b/tests/Regression/syscall-get-arguments-returning-wrong-value/main.fmf new file mode 100644 index 0000000..da42eb6 --- /dev/null +++ b/tests/Regression/syscall-get-arguments-returning-wrong-value/main.fmf @@ -0,0 +1,15 @@ +summary: Test for BZ#1004059 (syscall_get_arguments() returning wrong value) +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - perf +duration: 30m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1004059 +extra-summary: /tools/systemtap/Regression/syscall-get-arguments-returning-wrong-value +extra-task: /tools/systemtap/Regression/syscall-get-arguments-returning-wrong-value diff --git a/tests/Regression/syscall-get-arguments-returning-wrong-value/runtest.sh b/tests/Regression/syscall-get-arguments-returning-wrong-value/runtest.sh new file mode 100755 index 0000000..182d69c --- /dev/null +++ b/tests/Regression/syscall-get-arguments-returning-wrong-value/runtest.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/syscall-get-arguments-returning-wrong-value +# Description: Test for BZ#1004059 (syscall_get_arguments() returning wrong value) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, Inc. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + + +ASMLINKAGE=''; +uname -m | egrep 'i[36]86' && \ + ASMLINKAGE='asmlinkage();' + +SCRIPT=$( mktemp ) +cat > $SCRIPT <<-EOF +probe kernel.function("sys_open") { + $ASMLINKAGE + if (\$filename == pointer_arg(1)) { + exit(); + } else { + error("Possible manifestation of rhbz1004059."); + } +} +EOF + +function perf_probe_failed () +{ + probe=$1 + perf probe -d $probe ||: + perf probe --add $probe + retval=$? + test $retval -eq 0 && \ + rlLogInfo "Running perf probe --add $probe PASSED" || \ + rlLogInfo "Running perf probe --add $probe FAILED" + perf probe -d $probe ||: + if test $retval -eq 0; then + return 1 + else + return 0 + fi +} + +rlJournalStart + rlPhaseStartTest + ( + perf_probe_failed "sys_open" && exit + stap -p4 $SCRIPT >&/dev/null && p="" || p='-P' + rlRun "stap $p -v $SCRIPT -c 'cat /dev/null'" + ) + rm $SCRIPT + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/main.fmf b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/main.fmf new file mode 100644 index 0000000..97ec25b --- /dev/null +++ b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/main.fmf @@ -0,0 +1,14 @@ +summary: task-cwd-path-results-in-an-in-kernel-memory-leak +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1412691 +extra-summary: /tools/systemtap/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak +extra-task: /tools/systemtap/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak diff --git a/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/reproducer.stp b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/reproducer.stp new file mode 100644 index 0000000..ff15bbb --- /dev/null +++ b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/reproducer.stp @@ -0,0 +1,10 @@ +probe kprocess.exit +{ + path=fullpath_struct_path(task_cwd_path(task_current())) + printf("%s\n", path) +} + +#probe timer.s(240) +#{ +# exit() +#} diff --git a/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/runtest.sh b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/runtest.sh new file mode 100755 index 0000000..aa64f4e --- /dev/null +++ b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/runtest.sh @@ -0,0 +1,46 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak +# Description: task-cwd-path-results-in-an-in-kernel-memory-leak +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartTest + EXTRA="" + arch | fgrep ppc64le && EXTRA='-P' + + # We rely on (and check for) units to be kB + rlRun "test \"$( awk '/KernelStack/ {print $3}' /proc/meminfo )\" == \"kB\"" + rlRun "STACK1=$(awk '/KernelStack/ {print $2}' /proc/meminfo)" + rlRun "stap $EXTRA -w reproducer.stp -c 'bash ./trigger.sh' -o /dev/null" + rlRun "STACK2=$(awk '/KernelStack/ {print $2}' /proc/meminfo)" + rlRun "test $((STACK2 - 1000)) -le $STACK1" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/trigger.sh b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/trigger.sh new file mode 100755 index 0000000..165bd9a --- /dev/null +++ b/tests/Regression/task-cwd-path-results-in-an-in-kernel-memory-leak/trigger.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for i in `seq 1 2000`; do + ls / > /dev/null +done + + diff --git a/tests/Regression/task-exe-file-results-in-an-file-struct-leak/main.fmf b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/main.fmf new file mode 100644 index 0000000..547e173 --- /dev/null +++ b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/main.fmf @@ -0,0 +1,14 @@ +summary: task-exe-file-results-in-an-file-struct-leak +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 48h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=1430861 +extra-summary: /tools/systemtap/Regression/task-exe-file-results-in-an-file-struct-leak +extra-task: /tools/systemtap/Regression/task-exe-file-results-in-an-file-struct-leak diff --git a/tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer.stp b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer.stp new file mode 100644 index 0000000..2dd39bb --- /dev/null +++ b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer.stp @@ -0,0 +1,6 @@ +probe kprocess.exit +{ + t=task_current() + path=fullpath_struct_file(t, task_exe_file(t)) + printf("%s\n", path) +} diff --git a/tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer2.stp b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer2.stp new file mode 100644 index 0000000..f26764a --- /dev/null +++ b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/reproducer2.stp @@ -0,0 +1,5 @@ +probe kprocess.exit +{ + path=fullpath_struct_path(task_cwd_path(task_current())) + printf("%s\n", path) +} diff --git a/tests/Regression/task-exe-file-results-in-an-file-struct-leak/runtest.sh b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/runtest.sh new file mode 100755 index 0000000..0c4e643 --- /dev/null +++ b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/runtest.sh @@ -0,0 +1,45 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/task-exe-file-results-in-an-file-struct-leak +# Description: task-exe-file-results-in-an-file-struct-leak +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2017 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartTest + EXTRA='' + arch | fgrep ppc64le && EXTRA="-P" + rlRun "FILE_NR1=$(awk '{print $1}' /proc/sys/fs/file-nr)" + REPRODUCER=reproducer.stp + rlRun "stap -g -w $EXTRA --dump-functions | fgrep task_exe_file || REPRODUCER=reproducer2.stp" + rlRun "stap -w $EXTRA $REPRODUCER -c 'bash ./trigger.sh' -o /dev/null" + rlRun "FILE_NR2=$(awk '{print $1}' /proc/sys/fs/file-nr)" + rlRun "test $((FILE_NR2 - 1000)) -le $FILE_NR1" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/task-exe-file-results-in-an-file-struct-leak/trigger.sh b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/trigger.sh new file mode 100755 index 0000000..31ee2bb --- /dev/null +++ b/tests/Regression/task-exe-file-results-in-an-file-struct-leak/trigger.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +for i in `seq 1 100000`; do + /bin/true +done + + diff --git a/tests/Regression/testsuite-upstream-raw/check_BPF.sh b/tests/Regression/testsuite-upstream-raw/check_BPF.sh new file mode 100755 index 0000000..325b894 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/check_BPF.sh @@ -0,0 +1,158 @@ +#!/bin/bash + +# Show the testcase list on demand. +if [[ "$1" == "TCLIST" ]]; then + if [[ "$(arch)" == "s390x" ]]; then + # Save the s390x machine time (regardless the rhel major): + # Almost all the testcases are failing there, and those, that + # do not, are flaky. + echo -n "notest.exp" + else + echo -n "bpf-asm.exp bpf.exp" + fi + exit 0 +fi + +_LOG=systemtap.check +cp systemtap.sum $_LOG + +_cleanup() +{ + rm $_LOG +} +trap _cleanup EXIT + +set -xe + +EXPECTED_PASSES_TRESHOLD=-1 + +if test $(rpm --eval '0%{rhel}') -eq 8; then + # systemtap-4.0-7.el8, kernel-4.18.0-64.el8 + case `arch` in + x86_64) + EXPECTED_PASSES_TRESHOLD=55 + sed -i '/FAIL: bigmap1.stp/d' $_LOG || : + sed -i '/FAIL: cast_op_tracepoint.stp/d' $_LOG || : + sed -i '/FAIL: logging1.stp/d' $_LOG || : + sed -i '/FAIL: perf1.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_loop.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_smash.stp/d' $_LOG || : + sed -i '/FAIL: reg_alloc3.stp/d' $_LOG || : + sed -i '/FAIL: string3.stp/d' $_LOG || : + sed -i '/FAIL: timer1.stp/d' $_LOG || : + sed -i '/FAIL: timer2.stp/d' $_LOG || : + sed -i '/FAIL: tracepoint1.stp/d' $_LOG || : + sed -i '/FAIL: tracepoint1.stp/d' $_LOG || : + ;; + aarch64) + EXPECTED_PASSES_TRESHOLD=58 + sed -i '/FAIL: bigmap1.stp/d' $_LOG || : + sed -i '/FAIL: logging1.stp/d' $_LOG || : + sed -i '/FAIL: perf1.stp/d' $_LOG || : + sed -i '/FAIL: perf2.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_loop.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_smash.stp/d' $_LOG || : + sed -i '/FAIL: reg_alloc3.stp/d' $_LOG || : + sed -i '/FAIL: string3.stp/d' $_LOG || : + sed -i '/FAIL: timer2.stp/d' $_LOG || : + sed -i '/FAIL: tracepoint1.stp/d' $_LOG || : + ;; + ppc64le) + EXPECTED_PASSES_TRESHOLD=53 + sed -i '/FAIL: array.stp/d' $_LOG || : + sed -i '/FAIL: array_preinit.stp/d' $_LOG || : + sed -i '/FAIL: context_vars1.stp/d' $_LOG || : + sed -i '/FAIL: context_vars2.stp/d' $_LOG || : + sed -i '/FAIL: context_vars2.stp/d' $_LOG || : + sed -i '/FAIL: context_vars3.stp/d' $_LOG || : + sed -i '/FAIL: globals2.stp/d' $_LOG || : + sed -i '/FAIL: globals3.stp/d' $_LOG || : + sed -i '/FAIL: kprobes.stp/d' $_LOG || : + sed -i '/FAIL: logging1.stp/d' $_LOG || : + sed -i '/FAIL: perf1.stp/d' $_LOG || : + sed -i '/FAIL: perf2.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_loop.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_loop.stp/d' $_LOG || : + sed -i '/FAIL: pr23875_smash.stp/d' $_LOG || : + sed -i '/FAIL: reg_alloc3.stp/d' $_LOG || : + sed -i '/FAIL: string3.stp/d' $_LOG || : + sed -i '/FAIL: timer2.stp/d' $_LOG || : + sed -i '/FAIL: tracepoint1.stp/d' $_LOG || : + ;; + s390x) + # Many testcases fail for s390x, many of them are flaky + # Not worth testing at all at this stage at all probably. + echo "INFO: UNSUPPORTED RHEL7 ARCHITECTIRE ($(arch))" + exit 0 + ;; + *) + echo "ERROR: UNSUPPORTED RHEL8 ARCHITECTIRE" + exit 1 + ;; + esac +elif test $(rpm --eval '0%{rhel}') -eq 7; then + case `arch` in + x86_64) + # (rhel7) systemtap-3.3-3.el7.x86_64, kernel-3.10.0-993.el7.x86_64 + if test $(rpm -q --queryformat='%{version}\n' kernel | awk -F. '{print $1}') -eq 3; then + EXPECTED_PASSES_TRESHOLD=32 + sed -i '/FAIL: cast_op_tracepoint.stp/d' $_LOG || : + sed -i '/FAIL: perf2.stp/d' $_LOG || : + sed -i '/FAIL: reg_alloc3.stp/d' $_LOG || : + sed -i '/FAIL: tracepoint1.stp/d' $_LOG || : + elif test $(rpm -q --queryformat='%{version}\n' kernel | awk -F. '{print $1}') -eq 4; then + # (rhel-alt-7) systemtap-3.3-3.el7.x86_64, kernel-4.14.0-115.el7a.x86_64 + echo "ERROR: known bug on rhel-alt ('map entry 0: Function not implemented')" + echo "<@fche> # CONFIG_BPF_SYSCALL is not set" + exit 0 + else + echo "ERROR: UNSUPPORTED RHEL7 KERNEL VERSION" + exit 1 + fi + ;; + *) + echo "INFO: UNSUPPORTED RHEL7 ARCHITECTIRE ($(arch))" + exit 0 + ;; + esac +elif test $(rpm --eval '0%{fedora}') -eq 29; then + case `arch` in + x86_64) + EXPECTED_PASSES_TRESHOLD=33 + sed -i '/FAIL: array.stp/d' $_LOG || : + sed -i '/FAIL: bigmap1.stp/d' $_LOG || : + sed -i '/FAIL: cast_op_tracepoint.stp/d' $_LOG || : + sed -i '/FAIL: no_end.stp/d' $_LOG || : + sed -i '/FAIL: printf.stp/d' $_LOG || : + sed -i '/FAIL: reg_alloc3.stp/d' $_LOG || : + sed -i '/FAIL: string1.stp/d' $_LOG || : + sed -i '/FAIL: timer2.stp/d' $_LOG || : + sed -i '/FAIL: tracepoint1.stp/d' $_LOG || : + ;; + *) + # No test results for other arches yet + true; + ;; + esac +else + echo "ERROR: UNSUPPORTED RHELMAJOR" + exit 1 +fi + +true _v_v_v_v_v_v_v_v_v_v_v_ UNEXPECTED FAILURES: _v_v_v_v_v_v_v_v_v_v_v_v_v_v_ +fgrep 'FAIL: ' $_LOG || : +true -^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^-^- + + +EXPECTED_PASSES=$(grep -a '^PASS: ' $_LOG | wc -l) +UNEXPECTED_FAILURES=$(grep -a '^FAIL: ' $_LOG | wc -l) + +test ${EXPECTED_PASSES_TRESHOLD} -gt 1 +test 0${EXPECTED_PASSES} -ge 0${EXPECTED_PASSES_TRESHOLD} +test 0${UNEXPECTED_FAILURES} -eq 0 + +rm $_LOG + +set +xe + + diff --git a/tests/Regression/testsuite-upstream-raw/check_DEFAULT.sh b/tests/Regression/testsuite-upstream-raw/check_DEFAULT.sh new file mode 100755 index 0000000..ed0eea8 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/check_DEFAULT.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +if [[ "$1" == "TCLIST" ]]; then + # Empty list means to run all the testcases: + exit 0 +fi + +set -xe + +# It turns out that dg-extract-results.sh relies on the logfiles +# summary (# of expected passes, # of unexpected failures, etc.) and +# counts the summary values based on that. This is is okay for the +# normal dg-extract-results.sh use-case where it combines together +# correct (per single testcase) logs coming from parallel GDB testcase +# runs, where each of the input logfiles has such summary. +# +# But in our case we are combining incomplete log snippets coming from +# various terminated/incomplete/partial testsuite runs (kernel +# stall/crash, watchdog termination etc), where the log snippets do not +# have that summary (with an exception of the very last one). The +# result is that only the last of the log snippets gets properly +# counted, and the results from the other log snippets are ignored. +# +# rlRun "EXPECTED_PASSES=$(awk '/^# of expected passes/ {print $NF}' systemtap.sum)" +# rlRun "UNEXPECTED_FAILURES=$(awk '/^# of unexpected failures/ {print $NF}' systemtap.sum)" +# +# So we really need to count the PASSes and FAILs on our own: +# + +EXPECTED_PASSES=$(grep -a '^PASS: ' systemtap.sum | wc -l) +UNEXPECTED_FAILURES=$(grep -a '^FAIL: ' systemtap.sum | wc -l) + +# +# For this rough check, ignoring other states such as KFAIL and others +# should be good enough. + +case `arch` in + x86_64) + EXPECTED_PASSES_TRESHOLD=9000 + UNEXPECTED_FAILURES_TRESHOLD=800 + ;; + ppc64*) + EXPECTED_PASSES_TRESHOLD=8000 + UNEXPECTED_FAILURES_TRESHOLD=750 + ;; + *) + EXPECTED_PASSES_TRESHOLD=8000 + UNEXPECTED_FAILURES_TRESHOLD=500 + ;; +esac + +test 0${EXPECTED_PASSES} -ge 0${EXPECTED_PASSES_TRESHOLD} +test 0${UNEXPECTED_FAILURES} -le 0${UNEXPECTED_FAILURES_TRESHOLD} + +set +xe diff --git a/tests/Regression/testsuite-upstream-raw/dg-extract-results.sh b/tests/Regression/testsuite-upstream-raw/dg-extract-results.sh new file mode 100755 index 0000000..ffea0a3 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/dg-extract-results.sh @@ -0,0 +1,453 @@ +#! /bin/sh + +# For a specified tool and optional list of test variants, extract +# test results from one or more test summary (.sum) files and combine +# the results into a new test summary file, sent to the standard output. +# The resulting file can be used with test result comparison scripts for +# results from tests that were run in parallel. See usage() below. + +# Copyright (C) 2008-2016 Free Software Foundation, Inc. +# Contributed by Janis Johnson +# +# This file is part of GCC. +# +# GCC 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, or (at your option) +# any later version. +# +# GCC 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 . + +PROGNAME=dg-extract-results.sh + +# Try to use the python version if possible, since it tends to be faster. +PYTHON_VER=`echo "$0" | sed 's/sh$/py/'` +if test "$PYTHON_VER" != "$0" && + test -f "$PYTHON_VER" && + python -c 'import sys; sys.exit (0 if sys.version_info >= (2, 6) else 1)' \ + > /dev/null 2> /dev/null; then + exec python $PYTHON_VER "$@" +fi + +usage() { + cat <&2 +Usage: $PROGNAME [-t tool] [-l variant-list] [-L] sum-file ... + + tool The tool (e.g. g++, libffi) for which to create a + new test summary file. If not specified then all + specified sum files must be for the same tool. + variant-list One or more test variant names. If the list is + not specified then one is constructed from all + variants in the files for . + sum-file A test summary file with the format of those + created by runtest from DejaGnu. + If -L is used, merge *.log files instead of *.sum. In this + mode the exact order of lines may not be preserved, just different + Running *.exp chunks should be in correct order. +EOF +} + +# Write a message to the standard error. + +msg() { + echo "$@" >&2 +} + +# Parse the command-line options. + +VARIANTS="" +TOOL="" +MODE="sum" + +while getopts "l:t:L" ARG; do + case $ARG in + l) VARIANTS="${VARIANTS} ${OPTARG}";; + t) test -z "$TOOL" || (msg "${PROGNAME}: only one tool can be specified"; exit 1); + TOOL="${OPTARG}";; + L) MODE="log";; + \?) usage; exit 0;; + esac +done +shift `expr ${OPTIND} - 1` + +if test $# -lt 1 ; then + usage + exit 1 +fi + +TMPDIR=${TMPDIR-/tmp} +SUM_FILES="$@" +FIRST_SUM=$1 +TMP= +trap 'EXIT_STATUS=$?; rm -rf $TMP && exit $EXIT_STATUS' 0 +# Create a (secure) tmp directory for tmp files. +{ + TMP=`(umask 077 && mktemp -d -q "${TMPDIR}/dg-combine-results-$$-XXXXXX") 2>/dev/null` && + test -n "$TMP" && test -d "$TMP" +} || +{ + TMP=${TMPDIR}/dg-combine-results-$$-$RANDOM + (umask 077 && mkdir $TMP) +} || +{ + msg "${PROGNAME}: cannot create a temporary directory" + { (exit 1); exit 1; } +} + +# Find a good awk. + +if test -z "$AWK" ; then + for AWK in gawk nawk awk + do + if type $AWK 2>&1 | grep 'not found' > /dev/null 2>&1 ; then + : + else + break + fi + done +fi + +# Verify that the specified summary files exist. + +ERROR=0 +for FILE in $SUM_FILES +do + if ! test -f $FILE ; then + msg "${PROGNAME}: file $FILE does not exist." + ERROR=1 + fi +done +test $ERROR -eq 0 || exit 1 + +# Test if grep supports the '--text' option + +GREP=grep + +if echo -e '\x00foo\x00' | $GREP --text foo > /dev/null 2>&1 ; then + GREP="grep --text" +else + # Our grep does not recognize the '--text' option. We have to + # treat our files in order to remove any non-printable character. + for file in $SUM_FILES ; do + mv $file ${file}.orig + cat -v ${file}.orig > $file + done +fi + +if [ -z "$TOOL" ]; then + # If no tool was specified, all specified summary files must be for + # the same tool. + + CNT=`$GREP '=== .* tests ===' $SUM_FILES | $AWK '{ print $3 }' | sort -u | wc -l` + if [ $CNT -eq 1 ]; then + TOOL=`$GREP '=== .* tests ===' $FIRST_SUM | $AWK '{ print $2 }'` + else + msg "${PROGNAME}: sum files are for multiple tools, specify a tool" + msg "" + usage + exit 1 + fi +else + # Ignore the specified summary files that are not for this tool. This + # should keep the relevant files in the same order. + + SUM_FILES=`$GREP -l "=== $TOOL" $SUM_FILES` + if test -z "$SUM_FILES" ; then + msg "${PROGNAME}: none of the specified files are results for $TOOL" + exit 1 + fi +fi + +if [ "$TOOL" = acats ]; then + # Acats *.sum or *.log files aren't dejagnu generated, and they have + # somewhat different format. + ACATS_AWK=${TMP}/acats.awk + cat < $ACATS_AWK +BEGIN { + print_prologue=1; curfile=""; insummary=0 + passcnt=0; failcnt=0; unsupcnt=0; failures="" +} +/^[ \t]*=== acats configuration ===/ { + insummary=0 + if (print_prologue) print + next +} +/^[ \t]*=== acats tests ===/ { + if (print_prologue) print + print_prologue=0 + next +} +/^Running chapter / { + if (curfile) close (curfile) + curfile="${TMP}/chapter-"\$3 + print >> curfile + next +} +/^[ \t]*=== acats Summary ===/ { + if (curfile) close (curfile) + curfile="" + insummary=1 + next +} +/^# of expected passes/ { if (insummary == 1) passcnt += \$5; next; } +/^# of unexpected failures/ { if (insummary == 1) failcnt += \$5; next; } +/^# of unsupported tests/ { if (insummary == 1) unsupcnt += \$5; next; } +/^\*\*\* FAILURES: / { + if (insummary == 1) { + if (failures) sub(/^\*\*\* FAILURES:/,"") + failures=failures""\$0 + } +} +{ + if (print_prologue) { print; next } + if (curfile) print >> curfile +} +END { + system ("cat ${TMP}/chapter-*") + print " === acats Summary ===" + print "# of expected passes " passcnt + print "# of unexpected failures " failcnt + if (unsupcnt) print "# of unsupported tests " unsupcnt + if (failures) print failures +} +EOF + + rm -f ${TMP}/chapter-* + $AWK -f $ACATS_AWK $SUM_FILES + exit 0 +fi + +# If no variants were specified, find all variants in the remaining +# summary files. Otherwise, ignore specified variants that aren't in +# any of those summary files. + +if test -z "$VARIANTS" ; then + VAR_AWK=${TMP}/variants.awk + cat < $VAR_AWK +/^Schedule of variations:/ { in_vars=1; next } +/^$/ { in_vars=0 } +/^Running target/ { exit } +{ if (in_vars==1) print \$1; else next } +EOF + + touch ${TMP}/varlist + for FILE in $SUM_FILES; do + $AWK -f $VAR_AWK $FILE >> ${TMP}/varlist + done + VARIANTS="`sort -u ${TMP}/varlist`" +else + VARS="$VARIANTS" + VARIANTS="" + for VAR in $VARS + do + $GREP "Running target $VAR" $SUM_FILES > /dev/null && VARIANTS="$VARIANTS $VAR" + done +fi + +# Find out if we have more than one variant, or any at all. + +VARIANT_COUNT=0 +for VAR in $VARIANTS +do + VARIANT_COUNT=`expr $VARIANT_COUNT + 1` +done + +if test $VARIANT_COUNT -eq 0 ; then + msg "${PROGNAME}: no file for $TOOL has results for the specified variants" + exit 1 +fi + +cat $SUM_FILES \ + | $AWK '/^Running/ { if ($2 != "target" && $3 == "...") print "EXPFILE: "$2 } ' \ + | sort -u > ${TMP}/expfiles + +# Write the begining of the combined summary file. + +head -n 2 $FIRST_SUM +echo +echo " === $TOOL tests ===" +echo +echo "Schedule of variations:" +for VAR in $VARIANTS +do + echo " $VAR" +done +echo + +# For each test variant for the tool, copy test reports from each of the +# summary files. Set up two awk scripts from within the loop to +# initialize VAR and TOOL with the script, rather than assuming that the +# available version of awk can pass variables from the command line. + +for VAR in $VARIANTS +do + GUTS_AWK=${TMP}/guts.awk + cat << EOF > $GUTS_AWK +BEGIN { + variant="$VAR" + firstvar=1 + expfileno=1 + cnt=0 + print_using=0 + need_close=0 +} +/^EXPFILE: / { + expfiles[expfileno] = \$2 + expfilesr[\$2] = expfileno + expfileno = expfileno + 1 +} +/^Running target / { + curvar = \$3 + if (variant == curvar && firstvar == 1) { print; print_using=1; firstvar = 0 } + next +} +/^Using / { + if (variant == curvar && print_using) { print; next } +} +/^Running .*\\.exp \\.\\.\\./ { + print_using=0 + if (variant == curvar) { + if (need_close) close(curfile) + curfile="${TMP}/list"expfilesr[\$2] + expfileseen[\$2]=expfileseen[\$2] + 1 + need_close=0 + testname="00" + next + } +} +/^\t\t=== .* ===$/ { curvar = ""; next } +/^(PASS|XPASS|FAIL|XFAIL|UNRESOLVED|WARNING|ERROR|UNSUPPORTED|UNTESTED|KFAIL):/ { + testname=\$2 + # Ugly hack for gfortran.dg/dg.exp + if ("$TOOL" == "gfortran" && testname ~ /^gfortran.dg\/g77\//) + testname="h"testname +} +/^$/ { if ("$MODE" == "sum") next } +{ if (variant == curvar && curfile) { + if ("$MODE" == "sum") { + printf "%s %08d|", testname, cnt >> curfile + cnt = cnt + 1 + } + filewritten[curfile]=1 + need_close=1 + print >> curfile + } else + next +} +END { + n=1 + while (n < expfileno) { + if (expfileseen[expfiles[n]]) { + print "Running "expfiles[n]" ..." + if (filewritten["${TMP}/list"n]) { + if (expfileseen[expfiles[n]] == 1) + cmd="cat" + else + cmd="LC_ALL=C sort" + if ("$MODE" == "sum") + system (cmd" ${TMP}/list"n" | sed -n 's/^[^ ]* [^ |]*|//p'") + else + system ("cat ${TMP}/list"n) + } + } + n = n + 1 + } +} +EOF + + SUMS_AWK=${TMP}/sums.awk + rm -f $SUMS_AWK + cat << EOF > $SUMS_AWK +BEGIN { + variant="$VAR" + tool="$TOOL" + passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kpasscnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0; + curvar=""; insummary=0 +} +/^Running target / { curvar = \$3; next } +/^# of / { if (variant == curvar) insummary = 1 } +/^# of expected passes/ { if (insummary == 1) passcnt += \$5; next; } +/^# of unexpected successes/ { if (insummary == 1) xpasscnt += \$5; next; } +/^# of unexpected failures/ { if (insummary == 1) failcnt += \$5; next; } +/^# of expected failures/ { if (insummary == 1) xfailcnt += \$5; next; } +/^# of unknown successes/ { if (insummary == 1) kpasscnt += \$5; next; } +/^# of known failures/ { if (insummary == 1) kfailcnt += \$5; next; } +/^# of untested testcases/ { if (insummary == 1) untstcnt += \$5; next; } +/^# of unresolved testcases/ { if (insummary == 1) unrescnt += \$5; next; } +/^# of unsupported tests/ { if (insummary == 1) unsupcnt += \$5; next; } +/^$/ { if (insummary == 1) + { insummary = 0; curvar = "" } + next + } +{ next } +END { + printf ("\t\t=== %s Summary for %s ===\n\n", tool, variant) + if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt) + if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt) + if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt) + if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt) + if (kpasscnt != 0) printf ("# of unknown successes\t\t%d\n", kpasscnt) + if (kfailcnt != 0) printf ("# of known failures\t\t%d\n", kfailcnt) + if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt) + if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt) + if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt) +} +EOF + + PVAR=`echo $VAR | sed 's,/,.,g'` + TMPFILE=${TMP}/var-$PVAR + rm -f $TMPFILE + rm -f ${TMP}/list* + cat ${TMP}/expfiles $SUM_FILES | $AWK -f $GUTS_AWK + cat $SUM_FILES | $AWK -f $SUMS_AWK > $TMPFILE + # If there are multiple variants, output the counts for this one; + # otherwise there will just be the final counts at the end. + test $VARIANT_COUNT -eq 1 || cat $TMPFILE +done + +# Set up an awk script to get the combined summary counts for the tool. + +TOTAL_AWK=${TMP}/total.awk +cat << EOF > $TOTAL_AWK +BEGIN { + tool="$TOOL" + passcnt=0; failcnt=0; untstcnt=0; xpasscnt=0; xfailcnt=0; kfailcnt=0; unsupcnt=0; unrescnt=0 +} +/^# of expected passes/ { passcnt += \$5 } +/^# of unexpected failures/ { failcnt += \$5 } +/^# of unexpected successes/ { xpasscnt += \$5 } +/^# of expected failures/ { xfailcnt += \$5 } +/^# of unknown successes/ { kpasscnt += \$5 } +/^# of known failures/ { kfailcnt += \$5 } +/^# of untested testcases/ { untstcnt += \$5 } +/^# of unresolved testcases/ { unrescnt += \$5 } +/^# of unsupported tests/ { unsupcnt += \$5 } +END { + printf ("\n\t\t=== %s Summary ===\n\n", tool) + if (passcnt != 0) printf ("# of expected passes\t\t%d\n", passcnt) + if (failcnt != 0) printf ("# of unexpected failures\t%d\n", failcnt) + if (xpasscnt != 0) printf ("# of unexpected successes\t%d\n", xpasscnt) + if (xfailcnt != 0) printf ("# of expected failures\t\t%d\n", xfailcnt) + if (kpasscnt != 0) printf ("# of unknown successes\t\t%d\n", kpasscnt) + if (kfailcnt != 0) printf ("# of known failures\t\t%d\n", kfailcnt) + if (untstcnt != 0) printf ("# of untested testcases\t\t%d\n", untstcnt) + if (unrescnt != 0) printf ("# of unresolved testcases\t%d\n", unrescnt) + if (unsupcnt != 0) printf ("# of unsupported tests\t\t%d\n", unsupcnt) +} +EOF + +# Find the total summaries for the tool and add to the end of the output. +cat ${TMP}/var-* | $AWK -f $TOTAL_AWK + +# This is ugly, but if there's version output from the compiler under test +# at the end of the file, we want it. The other thing that might be there +# is the final summary counts. +tail -2 $FIRST_SUM | $GREP '^#' > /dev/null || tail -2 $FIRST_SUM + +exit 0 diff --git a/tests/Regression/testsuite-upstream-raw/helpers/createreport.sh b/tests/Regression/testsuite-upstream-raw/helpers/createreport.sh new file mode 100755 index 0000000..49180ac --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/helpers/createreport.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +TEMPDIR=$( mktemp -d ) +ORIGPWD=$( pwd ) + +cp /mnt/scratch/mcermak/testlogs/systemtap.upstream/*tar.xz $TEMPDIR/ + + +pushd $TEMPDIR || exit 1 + +# rename files so that identical commit hashes get identical (lowest possible) timestamp for sorting purposes +HASHES=$(ls systemtap*mcermak*tar.xz | awk -F\. '{print $4}' | sort -u) +for h in $HASHES; do + echo Processing hash $h + MINSTAMP4HASH=$( ls *$h* | tr '-' '.' | awk -F\. '{print $9}' | sort -n | grep '[0-9]\+' | head -n 1 ) + echo Min stamp for hash is: $MINSTAMP4HASH + PKG4HASH=$( ls *$h* ) + for p in $PKG4HASH; do + echo Processing pkg $p + PKGSTAMP=$( echo $p | tr '-' '.' | awk -F\. '{print $9}' ) + rename 'systemtap' "$MINSTAMP4HASH" $p + done +done + +# extract systemtap.sum files and rename them +for f in $( ls *tar.xz ); do + tar xJf $f systemtap.sum + mv systemtap.sum $f.sum + rename 'tar.xz.sum' 'log' $f.sum +done + +sh $ORIGPWD/report-helper.sh | tee wiki.out + +sed -i 's/UNKNOWN/?/g' wiki.out +sed -i 's/UNTESTED/-/g' wiki.out +sed -i 's/PASS/P/g' wiki.out +sed -i 's/FAIL/F/g' wiki.out +sed -i 's/ERROR/E/g' wiki.out + + +echo uploading logs to scratch... +OUT=/mnt/scratch/mcermak/testlogs/out +rm -rf $OUT && mkdir -p $OUT && chmod a+rwx $OUT && cp -v *tar.xz $OUT/ + +echo uploading to wiki... +cat wiki.out | $ORIGPWD/wikiup 'mcermak/systemtap.upstream' + +popd # $TEMPDIR +rm -rf $TEMPDIR diff --git a/tests/Regression/testsuite-upstream-raw/helpers/report-helper.sh b/tests/Regression/testsuite-upstream-raw/helpers/report-helper.sh new file mode 100755 index 0000000..1297045 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/helpers/report-helper.sh @@ -0,0 +1,130 @@ +#!/bin/bash + +HASHES=$( ls | awk -F\. '{print $4}' | sort -u ) +ARCHES=$( ls *log | awk -F- '{print $(NF-1) }' | awk -F. '{print $NF}' | sort -u ) + +declare -A MAXTESTS + +for p in $HASHES; do + MAXTESTS[$p]=0 + for a in $ARCHES; do + c=$( ls *log | grep $p | grep $a | wc -l ) + test $c -gt ${MAXTESTS[$p]} && MAXTESTS[$p]=$c + done +done + +TESTCASES=$( cat *log | awk '/^Running\ \.\/systemtap/ {print $2}' | sort -u ) + +TEMPFILE=$( mktemp ) + +function getCaseResults() { + casename=$1 + logfile=$2 + casename=$( echo $casename | tr "/" "." ) + cmd="cat $logfile | sed -e '/$casename/,/^Running/ !d'" + eval "$cmd" | head -n -1 +} + +function getWorstResult() { + results="$1" + retval='UNKNOWN' + echo "$results" | grep -q '^PASS' && retval='PASS' + echo "$results" | grep -q '^KPASS' && retval='KPASS' + echo "$results" | grep -q '^XPASS' && retval='XPASS' + echo "$results" | grep -q '^UNTESTED' && retval='UNTESTED' + echo "$results" | grep -q '^KFAIL' && retval='KFAIL' + echo "$results" | grep -q '^XFAIL' && retval='XFAIL' + echo "$results" | grep -q '^FAIL' && retval='FAIL' + echo "$results" | grep -q '^ERROR' && retval='ERROR' + echo $retval +} + +function getResult() { + casename=$1 + logfile=$2 + worstResult=$( getWorstResult "$( getCaseResults "$casename" "$logfile" )" ) + if test -s $logfile; then + loglink="http://nfs.englab.brq.redhat.com/scratch/mcermak/testlogs/out/$( echo $logfile | sed 's/log/tar\.xz/' )" + echo "[[$loglink|$worstResult]]" + else + echo $worstResult + fi +} + +function getLogs() { + package=$1 + arch=$2 + logcnt=$3 + availogcont=$( ls *log | grep $package | grep $arch | wc -l ) + remainlogcnt=$(( $logcnt - $availogcont )) + logs=$( ls *log | grep $package | grep $arch ) + for i in $( seq 1 $remainlogcnt ); do + logs="$logs $TEMPFILE" + done + echo $logs +} + +function colorizeResult() { + result=$1 + if echo $result | egrep -q '(KFAIL|XFAIL)'; then + echo "<#a2eea2> $result" + elif echo $result | egrep -q '(FAIL|ERROR)'; then + echo "<#f30000> $result" + elif echo $result | egrep -q '(UNKNOWN)'; then + echo "<#ffffff> $result" + else + echo "<#a2eea2> $result" + fi +} + +function getResultSet() { + package=$1 + arch=$2 + testcase=$3 + #echo -n "|| $package ($arch) " + echo -n "|| '''$arch''' " + for logfile in $( getLogs "$package" "$arch" ${MAXTESTS[$package]} ); do + result=$( getResult "$testcase" "$logfile" ) + echo -n "||$( colorizeResult "$result" ) " + done +} + +function getBugsForTestcase() { + testcase=$1 + testcase=$( echo $testcase | sed 's/^\.\///' | tr "/" "." ) + cmd="awk '/$testcase/ {print \$2}' bugs.txt" + eval "$cmd" +} + +function getBugLinksForTestcase() { + bznos="$1" + if ! test -z "$bznos"; then + echo + for bzno in $bznos; do + echo -e "[[https://bugzilla.redhat.com/show_bug.cgi?id=$bzno|bz$bzno]]" + done + echo + fi +} + +echo -n "== " +first=1 +for package in $HASHES; do + test $first -eq 0 && echo -n "<-> " + echo -n "$package " + first=0 +done +echo " ==" + +for testcase in $TESTCASES; do + echo -e "\n=== $testcase ===\n" + getBugLinksForTestcase "$( getBugsForTestcase "$testcase" )" + for arch in $ARCHES; do + for __hash in $HASHES; do + getResultSet $__hash $arch $testcase + done + echo " ||" + done +done + + diff --git a/tests/Regression/testsuite-upstream-raw/helpers/wikiup b/tests/Regression/testsuite-upstream-raw/helpers/wikiup new file mode 100755 index 0000000..f703910 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/helpers/wikiup @@ -0,0 +1,22 @@ +#!/usr/bin/python + +import sys +import xmlrpclib + +wikilocation = sys.argv[1] +wikicontent = sys.stdin.read() + +if not wikilocation.startswith("mcermak/"): + print "wiki location must start with mcermak/" + sys.exit(1) + +user = 'xmlrpc2' +password = 'fo0m4nchU+' +url='http://wiki.test.redhat.com/' +wiki = xmlrpclib.ServerProxy(url + '?action=xmlrpc2', allow_none=False) +auth_token = wiki.getAuthToken(user, password) +mc = xmlrpclib.MultiCall(wiki) +mc.applyAuthToken(auth_token) +mc.putPage(wikilocation, wikicontent) +result = mc() + diff --git a/tests/Regression/testsuite-upstream-raw/internal-watchdog.sh b/tests/Regression/testsuite-upstream-raw/internal-watchdog.sh new file mode 100755 index 0000000..f977337 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/internal-watchdog.sh @@ -0,0 +1,21 @@ +#/bin/bash + +test -x +__TRESHOLD=$(( 240 * 60 )) +__SLEEP=$(( 15 * 60 )) +__LOG="$1" +test -z $__LOG && exit 1 +test +x + +echo "`date` internal watchdog $$ starting." >> $__LOG +while true; do + sleep $__SLEEP + __DELTA=$(( `date +'%s'` - `stat -c '%Y' $__LOG` )) + if [[ $__DELTA -gt $__TRESHOLD ]]; then + echo "`date` internal watchdog $$ rebooting due to inactivity." >> $__LOG + sync + sleep 1m + reboot -f + sleep 5m + fi +done diff --git a/tests/Regression/testsuite-upstream-raw/main.fmf b/tests/Regression/testsuite-upstream-raw/main.fmf new file mode 100644 index 0000000..883d060 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/main.fmf @@ -0,0 +1,50 @@ +summary: testsuite-upstream-raw +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +# test: /bin/true +framework: beakerlib +recommend: + - avahi-debuginfo + - avahi-devel + - boost-devel + - byteman + - coreutils + - coreutils-debuginfo + - crash-devel + - dejagnu + - '@development' + - '@development-tools' + - dyninst-devel + - elfutils-devel + - gcc-c++ + - gettext-devel + - git + - glibc-debuginfo + - glibc-devel + - libselinux-devel + - libstdc++-devel + - m4 + - nss-devel + - pkgconfig + - postgresql-debuginfo + - postgresql-server + - python + - python3-debuginfo + - python-debuginfo + - python-libs-debuginfo + - rpm-devel + - sqlite-devel + - systemtap + - systemtap-testsuite + - tcl + - xz + - zlib-devel + - sqlite + - systemtap-debuginfo + - kernel-headers +duration: 72h +extra-summary: /tools/systemtap/Regression/testsuite-upstream-raw +extra-task: /tools/systemtap/Regression/testsuite-upstream-raw diff --git a/tests/Regression/testsuite-upstream-raw/runtest.sh b/tests/Regression/testsuite-upstream-raw/runtest.sh new file mode 100755 index 0000000..6b9a1b0 --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/runtest.sh @@ -0,0 +1,282 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/testsuite-upstream-raw +# Description: testsuite-upstream-raw +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2014 Red Hat, 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 2 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +# What part of the testsuite should we run (and then check for errors)? +_WHAT=${_WHAT:-DEFAULT} + +export AVC_ERROR='+no_avc_check' +touch /tmp/disable-qe-abrt + +unset DEBUGINFOD_PROGRESS +if test $(rpm --eval "0%{rhel}") -ge 9; then + # Allow use of debuginfod + export DEBUGINFOD_URLS=http://debuginfod.usersys.redhat.com:3632/ + # export DEBUGINFOD_PROGRESS=1 +else + unset DEBUGINFOD_URLS +fi + +trap '' SIGHUP SIGINT SIGQUIT SIGABRT + +ORIGPWD=$( pwd ) + +PKGMGR="yum --skip-broken --nogpgcheck" +rpm -q dnf && PKGMGR="dnf --setopt=strict=0 --nogpgcheck" + +STARTDATE=$(date +%Y-%m-%d-%H-%M-%S) +STAPSRPM=$(rpm -qif `which stap` | awk '/Source RPM/ {print $NF}' | sort -u | sed 's/\.src\.rpm//') +SUITERPM=$(rpm --queryformat '%{name}\n' -qf `which stap` | grep -o '.*systemtap' | sort -u)-testsuite +SUITELOC=$(rpm -ql $SUITERPM | grep -o '.*systemtap\/testsuite/' | sort -u) + +test_primary_arch_only () +{ + echo "=== TESTING PRIMARY ARCH ONLY ===" + sed -i '/^proc arch_compile_flags/,/^}/d' $SUITELOC/lib/compile_flags.exp + echo 'proc arch_compile_flags {} { return 1 }' >> $SUITELOC/lib/compile_flags.exp +} + +# For devtoolset, compat arch support was dropped for non-x86_64 arches. Ref: bz1493500 +if echo $SUITELOC | grep -q toolset && arch | egrep -q '^(ppc64|s390x)$'; then + test_primary_arch_only +elif test $(rpm -E '0%{rhel}') -ge 8 -a "$(arch)" != "x86_64"; then + test_primary_arch_only +fi + +# Currently the Makefile overrides what was set in the env via +# http://pkgs.devel.redhat.com/cgit/rpms/devtoolset-7/commit/?h=devtoolset-7.1-rhel-7&id=e305f5912a13bd2ca04ac319afca50bfab6f4aea +# And actually if the base rhel dyninst is installed, the dts testsuite runs against it rather than agains +# the dts-stap - producing irrelevant test results. +# +# A real fix on the stap side might be: +# -LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap +# +LD_LIBRARY_PATH=$(DESTDIR)$(libdir)/systemtap:$(DESTDIR)$(libdir)/dyninst +# in the Makefile.am etc, but let's work this around for now in a way that we simply use the +# LD_LIBRARY_PATH taken directly from the env: +if echo $SUITELOC | grep -q toolset; then + sed -i 's/^LD_LIBRARY_PATH/# LD_LIBRARY_PATH/' $SUITELOC/Makefile +fi + +rlJournalStart + rlPhaseStartSetup + rlLogInfo "SUITERPM=$SUITERPM" + rlLogInfo "SUITELOC=$SUITELOC" + rlRun "pushd $SUITELOC" + rlServiceStop firewalld + rlServiceStop iptables + rlServiceStop ip6tables + rlServiceStart avahi-daemon + rlRun "rpm -qa | grep ^kernel | grep -v `uname -r` | xargs rpm -e --nodeps" 0-255 + # if ! (uname -r | fgrep -q '.rt'); then + # rlRun "$ORIGPWD/stap-prep" 0,127 || \ + # rlRun "stap-prep" 0,127 + # fi + rlRun "sysctl -w kernel.panic=1" + rlRun "sysctl -w kernel.panic_on_oops=1" + rlRun "$PKGMGR -y install --setopt=multilib_policy=all libstdc++ dejagnu elfutils-devel gettext libgcc glibc-devel gcc-c++ libstdc++-devel dyninst dyninst-devel" + rlPhaseEnd + + + MYDMESGDIR=/root/mydmesg + mkdir -p $MYDMESGDIR + if strings $(which dmesg) | fgrep -q -- '-w'; then + rlPhaseStart FAIL "Run dmesg recorder." + MYTIMESTAMP=$(date +%s) + dmesg -wH > $MYDMESGDIR/dmesg$MYTIMESTAMP & + MYDMESGPID=$! + rlLogInfo "Dmesg recorder file: $MYDMESGDIR/dmesg$MYTIMESTAMP" + rlLogInfo "Dmesg PID: $MYDMESGPID" + rlPhaseEnd + fi + + rlPhaseStart FAIL "sanity check" + rlRun "stap -vve 'probe kernel.function(\"vfs_read\"){ log(\"hey!\"); exit() } probe timer.s(60){log(\"timeout\"); exit()}'" + rlRun "stap -vvl 'process(\"/usr/sbin/fdisk\").function(\"main\")'" 0-255 + rlPhaseEnd + + if ! test -f $SUITELOC/systemtap.log; then + rlPhaseStart WARN "Apply blacklist" + # === RHEL7 === + if rlIsRHEL 7; then + if arch | grep -q s390; then + true + # PR17270 + #rlRun "rm -f systemtap.onthefly/hrtimer_onthefly.exp" + #rlRun "rm -f systemtap.onthefly/uprobes_onthefly.exp" + #rlRun "rm -f systemtap.onthefly/kprobes_onthefly.exp" + # PR17140 + #rlRun "rm -f systemtap.examples/profiling/functioncallcount.stp" + elif arch | grep -q ppc; then + true + # PR17270 + #rlRun "rm -f systemtap.onthefly/hrtimer_onthefly.exp" + #rlRun "rm -f systemtap.onthefly/uprobes_onthefly.exp" + #rlRun "rm -f systemtap.onthefly/kprobes_onthefly.exp" + # PR17126 + #rlRun "rm -f systemtap.base/tracepoints.exp" + # BZ1153082 + #rlRun "rm -f systemtap.clone/main_quiesce.exp" + #elif rpm -q systemtap | grep -q '2.4-16.el7_0'; then + # BZ1145958 + #rlRun "rm -f systemtap.base/process_resume.exp" + fi + # === FEDORA === + elif grep -qi fedora /etc/redhat-release; then + # BZ1153082 + rlRun "rm -f systemtap.clone/main_quiesce.exp" + fi + + # Work around problem fixed in https://sourceware.org/git/gitweb.cgi?p=systemtap.git;a=commitdiff;h=a9b0aa4dbd1aa7a1c36eba8102e1445e8f2eb8b8 + rlRun "sed -i 's/exit\ 0/return/' $(fgrep -ril 'exit 0' $(find . -type f -name '*.exp')) ||:" + rlPhaseEnd + else + rlPhaseStart FAIL "Post-process anticipated reboot" + # Sometimes the testsuite crashes the kernel or causes stall. + # In case --ignore-panic is set, the box gets rebooted (bz1155644). + # This shouldn't happen. It'd be nice to report it as FAIL, but that + # appears to be too pedantic. We'll need this bell to ring when + # too many unexpected failures get reported by the upstream test driver. + # rlRun "false" + + # Remove testcases that have already been run + for tc in $( awk '/^Running.*exp\ \.\.\.$/ {print $2}' *systemtap.log ); do + echo $tc | grep -q 'systemtap/notest.exp' && continue + test -f $tc && rm -f $tc && rlLog "Removed $tc" + done + + #generate random hash + HASH=$(date | md5sum | cut -c 1-32 -) + + # save existing logs before creating new ones + rlRun "mv systemtap.log ${HASH}-systemtap.log" + rlRun "mv systemtap.sum ${HASH}-systemtap.sum" + + # clean up garbage incl. systemtap.log + rlRun "make clean" + rlPhaseEnd + fi + + rlPhaseStartTest + # Start internal watchdog if running in beaker + if test -n $JOBID; then + rlLogInfo "Starting internal watchdog ..." + $ORIGPWD/internal-watchdog.sh "$SUITELOC/systemtap.sum" & + __WATCHDOG_PID=$! + sleep 3 + if ps -p $__WATCHDOG_PID; then + rlLogInfo "Internal watchdog running (pid $__WATCHDOG_PID)." + else + rlFail "Problem starting the internal watchdog." + fi + fi + + # The _WHAT env var allows the test to only run selected subset of all + # the tests and perform specific checks on the resulting logs. + # + # Accepted values: BPF + + # run the testsuite (grab the list of testcases from the respective check* file) + TESTCASES=$(bash ${ORIGPWD}/check_${_WHAT}.sh TCLIST) + rlRun "make RUNTESTFLAGS='$TESTCASES' installcheck 2>&1" + + # Kill internal watchdog if running in beaker + if ! test -z $JOBID; then + rlLogInfo "Killing internal watchdog ..." + kill -s TERM $__WATCHDOG_PID + fi + rlPhaseEnd + + rlPhaseStart FAIL "Put all the log fragments together" + rlRun "$ORIGPWD/dg-extract-results.sh *systemtap.sum > big-systemtap.sum" + rlRun "$ORIGPWD/dg-extract-results.sh -L *systemtap.log > big-systemtap.log" + rlRun "mv --force big-systemtap.sum systemtap.sum" + rlRun "mv --force big-systemtap.log systemtap.log" + # remove the hash-prefixed fragments + # these are needed for the resume mode, but since we got to this point, + # we most likely processed all the testcases somehow, put all the pieces + # together and can start cleaning up and reporting + rlRun "rm -f *-systemtap.{log,sum}" + rlPhaseEnd + + rlPhaseStart FAIL "rlFileSubmit logs" + rlRun "xz --keep --force systemtap.log" + rlFileSubmit "systemtap.log.xz" + rlRun "xz --keep --force systemtap.sum" + rlFileSubmit "systemtap.sum.xz" + rlRun "rm systemtap.log.xz systemtap.sum.xz" + rlPhaseEnd + + if [[ "$_WHAT" == "DEFAULT" ]]; then + rlPhaseStart FAIL "save logs to /mnt/scratch" + MP=$( mktemp -d ) + # Refer to /tools/systemtap/Install/upstream-head + SD=rhpkg; rpm -q systemtap | grep -q mcermak && SD=upstream + rlRun "echo ${BEAKER}jobs/${JOBID} > job.txt" + rlRun "tar cf mydmesg.tar $MYDMESGDIR" + rlRun "xz mydmesg.tar" + rlRun "mount -o rw,nolock nfs.englab.brq.redhat.com:/scratch/mcermak $MP" + if test $(rpm --eval '0%{rhel}') -eq 8 && (! echo ${STAPSRPM} | grep '\.el8'); then + rlRun "LOGNAME=${MP}/testlogs/systemtap.${SD}/${STAPSRPM}.el8.$(uname -m)-${STARTDATE}" + else + rlRun "LOGNAME=${MP}/testlogs/systemtap.${SD}/${STAPSRPM}.$(uname -m)-${STARTDATE}" + fi + rlRun "mkdir -p $( dirname $LOGNAME )" + rlRun "tar cJf ${LOGNAME}.tar.xz systemtap.log systemtap.sum job.txt mydmesg.tar.xz" + + # Upload logs to bunsen instance on tofan if running in beaker + if ! test -z $JOBID; then + LOGFULLNAME="${LOGNAME}.tar.xz" + LOGBASENAME="$(basename $LOGFULLNAME)" + rlLogInfo "Uploading test log to bunsen..." + rlRun "cat $LOGFULLNAME | \ + curl -X POST -F project=systemtap-qe \ + -F tarballname=$LOGBASENAME \ + -F 'tar=@-' \ + http://tofan.yyz.redhat.com:8013/bunsen-upload.py" + fi + rlRun "umount -l $MP && sleep 3 && rm -rf $MP" + rlPhaseEnd + fi + + rlPhaseStart FAIL "Log checks ($_WHAT)" + rlRun "bash ${ORIGPWD}/check_${_WHAT}.sh" + rlPhaseEnd + + rlPhaseStartCleanup + rlServiceRestore firewalld + rlServiceRestore iptables + rlServiceRestore ip6tables + rlServiceRestore avahi-daemon + rlRun popd + kill -9 $MYDMESGPID ||: + rlPhaseEnd +rlJournalPrintText +rlJournalEnd + +rm -f /tmp/disable-qe-abrt diff --git a/tests/Regression/testsuite-upstream-raw/stap-prep b/tests/Regression/testsuite-upstream-raw/stap-prep new file mode 100755 index 0000000..89b7c3c --- /dev/null +++ b/tests/Regression/testsuite-upstream-raw/stap-prep @@ -0,0 +1,150 @@ +#! /bin/bash +LANG=C; export LANG +PATH=/usr/sbin:/sbin:/usr/bin:/bin:$PATH; export PATH + +check_error() { if test $1 != 0; then printf "\n$2\n"; exit $1; fi } + +prep_rpm_based() { +# uname -r can produce different kinds of output: +# 2.6.32-30.el6.x86_64 (no variant, but including ".arch") +# 2.6.18-194.3.1.el5debug ("variant", without dot, no arch) +# 2.6.33.4-95.fc13.i686.PAE (".arch.variant", two dots) +# 3.18.6-100.fc20.i686+PAE (".arch+variant", dot, plus) +if [ "$#" -lt 1 ]; then + UNAME=`uname -r` # determine the kernel running on the machine +else + UNAME=$1 #user passed in uname value +fi +UNAME=`echo $UNAME | sed "s/ //"` #strip out any whitespace +KERNEL="kernel" +for VARIANT in debug kdump PAE xen; do + # strip out ".variant" or else "+variant" or else "variant" at end. + TMP=`echo $UNAME | sed "s/[\.\+]\?$VARIANT\$//"` + if [ "$TMP" != "$UNAME" ]; then + UNAME=$TMP; KERNEL="kernel-$VARIANT" + fi +done +KERN_ARCH=`uname -m` +KERN_REV=`echo $UNAME | sed s/.$KERN_ARCH//` # strip arch from uname +if [ -x /usr/bin/dnf ]; then + DI="dnf debuginfo-install" + DI_DEPS="" + D="dnf" +else + DI="debuginfo-install" + DI_DEPS="yum-utils" + D="yum" +fi +CANDIDATES="$KERNEL-$KERN_REV.$KERN_ARCH \ + $KERNEL-devel-$KERN_REV.$KERN_ARCH \ + $DI_DEPS" + +# Can't simply work with /boot/vmlinuz-* below because of +# https://sourceware.org/bugzilla/show_bug.cgi?id=26599 +_debuginfod_file=$(rpm -ql kernel-core | fgrep $(uname -r) | grep '\.so$' | tail -1) +# Now let's assume following to come from outside env... +# export DEBUGINFOD_URLS=http://debuginfod.usersys.redhat.com:3632/ +# export DEBUGINFOD_PROGRESS=1 +debuginfod-find debuginfo $(rpm -ql kernel-core | fgrep $(uname -r) | grep '\.so$' | tail -1) || \ + CANDIDATES="$CANDIDATES $KERNEL-debuginfo-$KERN_REV.$KERN_ARCH" + +NEEDED=`rpm --qf "%{name}-%{version}-%{release}.%{arch}\n" \ + -q $CANDIDATES | grep "is not installed" | awk '{print $2}'` +if [ "$NEEDED" != "" ]; then + echo -e "Need to install the following packages:\n$NEEDED" + if [ `id -u` = "0" ]; then #attempt to install + $D install -y --enablerepo=\* $NEEDED + if expr "$NEEDED" : ".*debuginfo.*" >/dev/null; + then + $DI -y $KERNEL-$KERN_REV.$KERN_ARCH; + fi + rpm -q $NEEDED + rc=$? + check_error $rc "problem installing rpm(s) $NEEDED\nin case of file conflicts, try again after # $D erase $KERNEL-debuginfo" + fi +fi +} + +prep_deb_based() { +if [ $# -ne 0 ]; then + echo "Specifying kernel version is not yet support on deb based systems." 1>&2 + exit 1 +fi + +# 2.6.32-5-amd64 +# 2.6.32-37-generic +ABINAME="$(cut -d " " -f 3 /proc/version)" + +# 2.6.32 +BASEVERSION="$(echo "$ABINAME" | cut -d "-" -f 1)" +DEBIAN_FRONTEND=noninteractive # don't confirm or chat +export DEBIAN_FRONTEND + +case "$DISTRO" in + Debian) # 2.6.32-39 + if uname -v | grep -q Debian; then + VERSION="$(uname -v | cut -d " " -f 4)" + else + VERSION="$(cut -d " " -f 3 /proc/version)" + fi + ;; + Ubuntu) + # 2.6.32-37.81 + if [ -f /proc/version_signature ]; then + VERSION="$(cut -d " " -f 2 /proc/version_signature | cut -d "-" -f 1-2)" + else # 4.18 + VERSION="$(cut -d " " -f 3 /proc/version)" + fi + ;; +esac + +( + echo "make >= 0" + echo "linux-image-$ABINAME = $VERSION" + echo "linux-headers-$ABINAME = $VERSION" + echo "linux-image-$ABINAME-dbgsym = $VERSION" +) | while read package relation requiredversion; do + installedversion="$(dpkg-query -W "$package" 2> /dev/null | cut -f 2)" + if [ "$installedversion" = "" ]; then + availableversion="$(apt-cache show $package 2> /dev/null | grep ^Version: | cut -d " " -f 2)" + if [ "$availableversion" = "" -a "$(echo $package | grep dbgsym$)" ]; then + echo "You need package $package but it does not seem to be available" + if [ "$DISTRO" = "Ubuntu" ]; then + echo " Ubuntu -dbgsym packages are typically in a separate repository" + echo " Follow https://wiki.ubuntu.com/DebuggingProgramCrash to add this repository" + elif [ "$DISTRO" = "Debian" ]; then + echo " Debian -dbgsym packages are typically in a separate repository" + echo " Follow https://wiki.debian.org/AutomaticDebugPackages to add this repository" + fi + else + echo "Need to install $package" + if [ `id -u` = "0" ]; then #attempt to install + apt-get -y install $package + fi + fi + elif ! dpkg --compare-versions $installedversion $relation $requiredversion; then + echo "Package $package version $installedversion does not match version of currently running kernel: $requiredversion" + echo " Consider apt-get upgrade && reboot" + fi +done + +user="$(id --user --name)" +if [ "$user" != "root" ]; then + groups="$(id --groups --name)" + for i in stapusr stapdev; do + if [ "$(echo $groups | grep $i)" = "" ]; then + echo "Be root or adduser $user $i" + fi + done +fi +} + +DISTRO="$(lsb_release --id --short 2> /dev/null)" +case "$DISTRO" in +Debian|Ubuntu) + prep_deb_based "$@" + ;; +*) + prep_rpm_based "$@" + ;; +esac diff --git a/tests/Regression/utrace-taskfinder-misses-events/main.fmf b/tests/Regression/utrace-taskfinder-misses-events/main.fmf new file mode 100644 index 0000000..b5af125 --- /dev/null +++ b/tests/Regression/utrace-taskfinder-misses-events/main.fmf @@ -0,0 +1,16 @@ +summary: Test for BZ#876848 (utrace taskfinder misses events when main thread) +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap + - gcc-c++ + - kernel-debuginfo +duration: 15m +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=876848 +extra-summary: /tools/systemtap/Regression/utrace-taskfinder-misses-events +extra-task: /tools/systemtap/Regression/utrace-taskfinder-misses-events diff --git a/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.cpp b/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.cpp new file mode 100644 index 0000000..30a8215 --- /dev/null +++ b/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.cpp @@ -0,0 +1,35 @@ +#include +#include +#include + +int square (int x) +{ + return (x * x); +} + +void *my_thread(void *arg) +{ + int x = 0; + int sqr; + + while (true) { + sqr = square(5); + sleep(1); + } + return NULL; +} + +int main() +{ + pthread_t thread_id; + if (pthread_create(&thread_id, NULL, my_thread, NULL)) { + fprintf(stderr, "Error creating thread\n"); + return 1; + } + if (pthread_join(thread_id, NULL)) { + fprintf(stderr, "Error joining thread\n"); + return 2; + } + return 0; +} + diff --git a/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.stp b/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.stp new file mode 100644 index 0000000..d6ab354 --- /dev/null +++ b/tests/Regression/utrace-taskfinder-misses-events/pthreadtestcase.stp @@ -0,0 +1,28 @@ +#! /usr/bin/env stap + +probe timer.sec(180) +{ + printf("EXITONTIMEOUT\n"); + exit() +} + +probe process("./pthreadtestcase").function("square") +{ + printf("USERSPACEFUNCTIONENTER\n") + printf("=> %s(%s)\n", probefunc(), $$parms) +} + +probe process("./pthreadtestcase").function("square").return +{ + printf("USERSPACEFUNCTIONLEAVE\n") + printf("<= %s\n", probefunc()) + exit() +} + +probe process("./pthreadtestcase").statement("*@pthreadtestcase.cpp:7") +{ + printf("USERSPACEREACHEDLINE\n") + #printf(" x=%d, sqr=%d\n\n", $x, $sqr) + printf(" x=%d\n\n", $x) +} + diff --git a/tests/Regression/utrace-taskfinder-misses-events/runtest.sh b/tests/Regression/utrace-taskfinder-misses-events/runtest.sh new file mode 100755 index 0000000..c20788c --- /dev/null +++ b/tests/Regression/utrace-taskfinder-misses-events/runtest.sh @@ -0,0 +1,77 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/utrace-taskfinder-misses-events +# Description: Test for BZ#876848 (utrace taskfinder misses events when main thread) +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +# if this testcase caused kernel crash and reboot, don't try to rerun it +[[ $REBOOTCOUNT -gt 0 ]] && exit 1 + +rlJournalStart + rlPhaseStartSetup + rlRun "TMPDIR=\$(mktemp -d)" + rlRun "cp pthreadtestcase.cpp pthreadtestcase.stp $TMPDIR" + rlRun "pushd $TMPDIR" + rlPhaseEnd + + rlPhaseStart FAIL "Systemtap sanity check" + rlRun "stap --version" + rlRun "stap -v -e 'probe kernel.function(\"vfs_read\"){ exit() }'" + rlPhaseEnd + + rlPhaseStart FAIL "Prepare pthreadtestcase, run it" + rlRun "g++ -g -o pthreadtestcase pthreadtestcase.cpp -lpthread" + killall -9 pthreadtestcase &> /dev/null + ./pthreadtestcase & + MYPID=$! + sleep 3 + rlRun "ps | grep '$MYPID.*pthreadtestcase$'" + rlPhaseEnd + + rlPhaseStartTest + rlRun "stap -v pthreadtestcase.stp 2>&1 | tee mylog.txt" + rlRun "grep EXITONTIMEOUT mylog.txt" 1 + for token in USERSPACEFUNCTIONENTER \ + USERSPACEREACHEDLINE \ + USERSPACEFUNCTIONLEAVE + do + rlRun "grep ^$token$ mylog.txt" 0 + done + rlPhaseEnd + + rlPhaseStart FAIL "Shut pthreadtestcase down" + # pthreadtestcase should still be running + # so killing it should certsinly succeed + rlRun "kill $MYPID" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalEnd diff --git a/tests/Regression/wrong-data-returned-by-nfs-commit-done/main.fmf b/tests/Regression/wrong-data-returned-by-nfs-commit-done/main.fmf new file mode 100644 index 0000000..c4d5b52 --- /dev/null +++ b/tests/Regression/wrong-data-returned-by-nfs-commit-done/main.fmf @@ -0,0 +1,14 @@ +summary: wrong-data-returned-by-nfs-commit-done +description: '' +contact: Martin Cermak +component: + - systemtap +test: ./runtest.sh +framework: beakerlib +recommend: + - systemtap +duration: 2h +link: + - relates: https://bugzilla.redhat.com/show_bug.cgi?id=920444 +extra-summary: /tools/systemtap/Regression/wrong-data-returned-by-nfs-commit-done +extra-task: /tools/systemtap/Regression/wrong-data-returned-by-nfs-commit-done diff --git a/tests/Regression/wrong-data-returned-by-nfs-commit-done/runtest.sh b/tests/Regression/wrong-data-returned-by-nfs-commit-done/runtest.sh new file mode 100755 index 0000000..105b8b7 --- /dev/null +++ b/tests/Regression/wrong-data-returned-by-nfs-commit-done/runtest.sh @@ -0,0 +1,73 @@ +#!/bin/bash +# vim: dict=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/systemtap/Regression/wrong-data-returned-by-nfs-commit-done +# Description: wrong-data-returned-by-nfs-commit-done +# Author: Martin Cermak +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2013 Red Hat, Inc. All rights reserved. +# +# This copyrighted material is made available to anyone wishing +# to use, modify, copy, or redistribute it subject to the terms +# and conditions of the GNU General Public License version 2. +# +# 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, write to the Free +# Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="systemtap" + +rlJournalStart + rlPhaseStartSetup + rlRun "rpm -qf $(which --skip-alias stap)" + rlRun "TMPDIR=$(mktemp -d)" + rlRun "cp -r testpro $TMPDIR" + rlRun "pushd $TMPDIR/testpro/" + rlPhaseEnd + + rlPhaseStart FAIL "Systemtap sanity check" + rlRun "stap --version" + rlRun "stap -v -e 'probe kernel.function(\"vfs_read\"){ exit() }'" + rlRun "uname -a" + rlPhaseEnd + + rlPhaseStart FAIL "Build testing binary, prepare nfs environment" + rlRun "make" + rlRun "rhelmajor=$(rpm --eval %{rhel})" + rlRun "chmod u+x test-for-nfs" + rlRun "./test-for-nfs RHEL${rhelmajor}" + rlPhaseEnd + + rlPhaseStartTest + if stap -p2 nfs.proc.commit_done.stp >&/dev/null; then + rlRun "stap --prologue-searching=never --poison-cache -vc './nfs.proc.commit_done' nfs.proc.commit_done.stp 2>&1 | tee testout.log" + else + rlRun "stap --prologue-searching=always --poison-cache -vc './nfs.proc.commit_done' nfs.proc.commit_done.stp 2>&1 | tee testout.log" + fi + rlRun "grep -qP 'nfs.proc.commit_done server_ip:\ \d+\.\d+\.\d+\.\d+' testout.log" + rlPhaseEnd + + rlPhaseStart WARN "Clean the nfs environment up" + rlRun "./test-for-nfs -c RHEL${rhelmajor}" + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "popd" + rlRun "rm -r $TMPDIR" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd diff --git a/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/Makefile b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/Makefile new file mode 100644 index 0000000..021de18 --- /dev/null +++ b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/Makefile @@ -0,0 +1,11 @@ +CFLAGS+= -Wall + +SRCS = $(wildcard *.c) +TARGETS = $(patsubst %.c,%,$(SRCS)) + +all: $(TARGETS) + +install: + +clean: + rm -f $(TARGETS) diff --git a/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.c b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.c new file mode 100644 index 0000000..0417d71 --- /dev/null +++ b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.c @@ -0,0 +1,84 @@ +#include +#include +#include +#include +#include +#include +#include +#include + +#define TEST_DIR "/systemtap-sts-nfs-share-and-mount-tmpdir/sts_mount" + +static int create_and_write(char *file_name); +static int read_file(char *file_name); + +int main(int argc, char *argv[]) +{ + char tmp_path[1024]; + char tmp_file[1024]; + char new_file[1024]; + + strcpy(tmp_path, getenv("HOME")); + strcat(tmp_path, TEST_DIR); + strcat(tmp_path, "/sts_tmp"); + strcpy(tmp_file, tmp_path); + strcpy(new_file, tmp_path); + strcat(tmp_file, "/tmp.txt"); + strcat(new_file, "/tmp2.txt"); + + if (mkdir(tmp_path, 0777) == -1) { + fprintf(stderr, "Create tmp path failed! %d\n", errno); + return -1; + } + if (create_and_write(tmp_file)) + return -1; + + if (rename(tmp_file, new_file) == -1) { + fprintf(stderr, "Rename failed! %d\n", errno); + return -1; + } + read_file(new_file); + if (remove(new_file) == -1) { + fprintf(stderr, "Remove file failed! %d\n", errno); + return -1; + } + + remove(tmp_path); + + return 0; +} + +static int create_and_write(char *file_name) +{ + char buf[] = "abcdefg123"; + int i; + int fd; + + fd = open(file_name, O_RDWR | O_CREAT, 00777); + if (!fd) { + fprintf(stderr, "Create tmp file failed!\n"); + return -1; + } + + for (i = 0; i < 1024 * 1024; i++){ + if (write(fd, buf, 10) != 10) { + fprintf(stderr, "Write error!\n"); + return -1; + } + } + + close(fd); + return 0; +} + +static int read_file(char *file_name) +{ + char buf[1024]; + int fd; + + fd = open(file_name, O_RDONLY); + lseek(fd, 1024 * 10, SEEK_SET); + read(fd, buf, 1024); + close(fd); + return 0; +} diff --git a/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.stp b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.stp new file mode 100644 index 0000000..8de8be0 --- /dev/null +++ b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/nfs.proc.commit_done.stp @@ -0,0 +1,3 @@ +probe nfs.proc.commit_done{ + printf("nfs.proc.commit_done server_ip: %s\n", %( systemtap_v >= "4.3" %? server_ip %: ip_ntop(server_ip) %)); +} diff --git a/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/test-for-nfs b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/test-for-nfs new file mode 100755 index 0000000..156831d --- /dev/null +++ b/tests/Regression/wrong-data-returned-by-nfs-commit-done/testpro/test-for-nfs @@ -0,0 +1,111 @@ +#!/bin/bash + +export NFS_TMP="$HOME/systemtap-sts-nfs-share-and-mount-tmpdir" + +nfs_service() +{ + local ret + local status="$1" + local OS_VER="$2" + + if [[ "$OS_VER" != "RHEL9" && "$OS_VER" != "RHEL8" && "$OS_VER" != "RHEL7" && "$OS_VER" != "RHEL6" && "$OS_VER" != "RHEL5" ]]; then + echo "Error: $OS_VER not supported." + return 1 + fi + + case "$status" in + restart) + ps -ef | grep "nfsd" | grep -v grep > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "nfsd already running!!" + return 0 + fi + + if [[ "$2" == "RHEL7" || "$2" == "RHEL8" || "$2" == "RHEL9" ]]; then + /bin/systemctl restart nfs-server.service + ret=$? + else + /etc/init.d/nfs restart + ret=$? + fi + ;; + stop) + if [[ "$2" == "RHEL7" || "$2" == "RHEL8" || "$2" == "RHEL9" ]]; then + /bin/systemctl stop nfs-server.service + ret=$? + else + /etc/init.d/nfs stop + ret=$? + fi + ;; + *) + echo "Error: nfs_service [stop|restart]" + ret=1 + ;; + esac + + return $ret +} + +clean_nfs_env() +{ + umount "$NFS_TMP"/sts_mount + /usr/sbin/exportfs -u 127.0.0.1:"$NFS_TMP"/sts_share + rm -rf "$NFS_TMP" + nfs_service stop $1 + if [ $? -ne 0 ]; then + return 1 + else + echo "Info: The nfs env for test clean successfully." + return 0 + fi +} + +create_nfs_env() +{ + nfs_service restart $1 + if [ $? -ne 0 ]; then + return 1 + fi + + sleep 1 + + mkdir -p "$NFS_TMP"/sts_share + mkdir -p "$NFS_TMP"/sts_mount + + /usr/sbin/exportfs -i -o 'rw,async,no_root_squash' 127.0.0.1:"$NFS_TMP"/sts_share + mount -t nfs 127.0.0.1:"$NFS_TMP"/sts_share "$NFS_TMP"/sts_mount + + return 0 +} + +if [ $# -gt 2 ]; then + echo "Usage: test-for-nfs [-c] OS_VERSION" + exit 1 +fi + +case "$1" in +-c) + clean_nfs_env $2 + ret=$? + if [ $ret -ne 0 ]; then + echo "Error: cleaning the nfs env for test failed." + fi + ;; +*) + if [ ! -z "$1" ]; then + create_nfs_env $1 + ret=$? + if [ $ret -eq 0 ]; then + echo "Info: The nfs env for test create successfully." + else + echo "Error: creating the nfs env for test failed." + fi + else + echo "Usage: test-for-nfs [-c] OS_VERSION" + ret=1 + fi + ;; +esac + +exit $ret