CI testing: Drop the Regression/testsuite-upstream-raw TC

This commit is contained in:
Martin Cermak 2023-02-22 09:48:52 +01:00
parent 6e2eede1a1
commit 1c8c98dbcd
10 changed files with 0 additions and 1370 deletions

View File

@ -1,158 +0,0 @@
#!/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

View File

@ -1,55 +0,0 @@
#!/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

View File

@ -1,453 +0,0 @@
#! /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 <janis187@us.ibm.com>
#
# 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 <http://www.gnu.org/licenses/>.
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 <<EOF >&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 <tool>.
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 <<EOF > $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 <<EOF > $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

View File

@ -1,49 +0,0 @@
#!/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

View File

@ -1,130 +0,0 @@
#!/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

View File

@ -1,22 +0,0 @@
#!/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()

View File

@ -1,21 +0,0 @@
#/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

View File

@ -1,50 +0,0 @@
summary: testsuite-upstream-raw
description: ''
contact: Martin Cermak <mcermak@redhat.com>
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

View File

@ -1,282 +0,0 @@
#!/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 <mcermak@redhat.com>
#
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#
# 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

View File

@ -1,150 +0,0 @@
#! /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