Blame packages/g/gdb/qa.sh

b7b9f5
#!/bin/bash
b7b9f5
Bernhard M. Wiedemann c41d25
# Note:
Bernhard M. Wiedemann c41d25
# Occasionally we run into PR28561 - "[gdb/testsuite] Error due to not
Bernhard M. Wiedemann c41d25
# reading \r\n at end of mi prompt".
Bernhard M. Wiedemann c41d25
# https://sourceware.org/bugzilla/show_bug.cgi?id=28561
Bernhard M. Wiedemann c41d25
# Not sure how to filter for that.
Bernhard M. Wiedemann c41d25
Bernhard M. Wiedemann c41d25
# TODO:
Bernhard M. Wiedemann c41d25
#
Bernhard M. Wiedemann c41d25
# We run into FAILs like this:
Bernhard M. Wiedemann c41d25
# FAIL: gdb.base/options.exp: test-print: \
Bernhard M. Wiedemann c41d25
#   tab complete "thread apply all print " (clearing input line) (timeout)
Bernhard M. Wiedemann c41d25
# FAIL: gdb.base/options.exp: test-print: \
Bernhard M. Wiedemann c41d25
#   cmd complete "thread apply all print "
Bernhard M. Wiedemann c41d25
# in various test-cases.  One instance is reported here (
Bernhard M. Wiedemann c41d25
# https://sourceware.org/bugzilla/show_bug.cgi?id=27813 ).
Bernhard M. Wiedemann c41d25
# We could do a generic kfail for "(clearing input line) (timeout)", but that
Bernhard M. Wiedemann c41d25
# doesn't filter out the following FAIL.  We need to update the testsuite to
Bernhard M. Wiedemann c41d25
# emit only one FAIL for this, or alternatively, add a possibility in this
Bernhard M. Wiedemann c41d25
# script to KFAIL one and all following FAILs in the same test-case.
Bernhard M. Wiedemann c41d25
Bernhard M. Wiedemann c41d25
usage ()
Bernhard M. Wiedemann c41d25
{
Bernhard M. Wiedemann c41d25
    echo "usage: $0 <1-5>"
Bernhard M. Wiedemann c41d25
    echo "       $0 <6> <dir>"
b7b9f5
    echo "Verify remote results at:"
b7b9f5
    echo "  ./binaries-testsuite.distro.arch/gdb-testresults"
b7b9f5
    echo "1: gdb.sum: Check for 'FAIL: .* internal error' (all configs)"
b7b9f5
    echo "2: gdb.sum: Check for 'ERROR:'                  (all configs)"
b7b9f5
    echo "3: gdb.log: Check for 'internal-error:'         (all configs)"
b7b9f5
    echo "4: gdb.sum: Check FAIL and ERROR                (known clean configs)"
Bernhard M. Wiedemann c41d25
    echo "5: gdb.sum: Check gdb.suse PASS                 (all configs)"
b7b9f5
    echo "Verify local results at:"
b7b9f5
    echo "  \$dir"
Bernhard M. Wiedemann c41d25
    echo "6: gdb.sum: Check FAIL and ERROR"
Bernhard M. Wiedemann c41d25
}
Bernhard M. Wiedemann c41d25
Bernhard M. Wiedemann c41d25
if [ $# -eq 0 ]; then
Bernhard M. Wiedemann c41d25
    usage
b7b9f5
    exit 1
b7b9f5
fi
b7b9f5
b7b9f5
n="$1"
b7b9f5
shift
b7b9f5
Bernhard M. Wiedemann c41d25
if [ "$n" = "6" ]; then
b7b9f5
    dir="$1"
b7b9f5
    shift
b7b9f5
fi
b7b9f5
b7b9f5
echo_line ()
b7b9f5
{
b7b9f5
    for n in "$@"; do
b7b9f5
        echo "$n"
b7b9f5
    done
b7b9f5
}
b7b9f5
b7b9f5
join ()
b7b9f5
{
b7b9f5
    local char
b7b9f5
    char="$1"
b7b9f5
    shift
b7b9f5
b7b9f5
    local res
b7b9f5
    res=""
b7b9f5
b7b9f5
    local first
b7b9f5
    first=true
b7b9f5
    for elem in "$@"; do
b7b9f5
        if $first; then
b7b9f5
            first=false
b7b9f5
        else
b7b9f5
            res+="$char"
b7b9f5
        fi
b7b9f5
        res+="$elem"
b7b9f5
    done
b7b9f5
    echo "$res"
b7b9f5
}
b7b9f5
b7b9f5
report_sum ()
b7b9f5
{
b7b9f5
    local sum
b7b9f5
    sum="$1"
b7b9f5
b7b9f5
    echo
b7b9f5
    echo "$sum:"
b7b9f5
b7b9f5
    if [ ! -f "$sum" ]; then
b7b9f5
	echo "MISSING"
b7b9f5
	return
b7b9f5
    fi
b7b9f5
b7b9f5
    kfail_re=$(join "|" "${kfail[@]}")
b7b9f5
    echo FAILs:
b7b9f5
    grep ^FAIL: "$sum" \
b7b9f5
	| grep -E -v "$kfail_re"
b7b9f5
    echo ERROR COUNT:
b7b9f5
    grep -c ^ERROR: "$sum"
b7b9f5
}
b7b9f5
b7b9f5
kfail=(
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26971
b7b9f5
    "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: check post FLD1 value of .fop"
b7b9f5
    "FAIL: gdb.arch/amd64-init-x87-values.exp: check_x87_regs_around_init: check post FLD1 value of .fioff"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=24845
b7b9f5
    "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: single step over clone"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=19436#c1
b7b9f5
    "FAIL: gdb.cp/no-dmgl-verbose.exp: setting breakpoint at 'f\(std::string\)'"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=25504
b7b9f5
    "FAIL: gdb.threads/process-dies-while-detaching.exp: single-process: continue: .*: continue"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28065
b7b9f5
    "FAIL: gdb.threads/access-mem-running-thread-exit.exp:"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=27813
b7b9f5
    "FAIL: gdb.cp/cpcompletion.exp:"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=25503
b7b9f5
    "FAIL: gdb.threads/signal-while-stepping-over-bp-other-thread.exp: step \(pattern 3\)"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26915
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.threads/schedlock.exp: schedlock=off: .*: other threads ran - unlocked"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28479
b7b9f5
    "FAIL: gdb.mi/mi-nonstop.exp: wait for thread exit \(timeout\)"
Bernhard M. Wiedemann c41d25
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26273
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.threads/gcore-stale-thread.exp: save a corefile"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.threads/gcore-stale-thread.exp: exited thread is current due to non-stop"
Bernhard M. Wiedemann c41d25
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28467
Bernhard M. Wiedemann c41d25
    # -pie, x86_64 -m32 or i586.
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/nodebug.exp: p/c \(int\) array_index\(\"abcdef\",2\)"
Bernhard M. Wiedemann c41d25
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28617
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get process groups \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get threads \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get file descriptors \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get internet-domain sockets \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get shared-memory regions \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get semaphores \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: get message queues \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: info os unknown_entry \(timeout\)"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.base/info-os.exp: continue \(timeout\)"
b7b9f5
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26284
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28275
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28343
b7b9f5
    "FAIL: gdb.threads/detach-step-over.exp: .*internal error"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26363
b7b9f5
    "FAIL: gdb.xml/tdesc-reload.exp: .*internal error"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26761
b7b9f5
    "FAIL: gdb.base/gdb-sigterm.exp: .*internal error"
b7b9f5
)
b7b9f5
b7b9f5
kfail_factory=(
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=27027
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28464
b7b9f5
    "FAIL: gdb.ada/mi_var_access.exp: Create varobj \(unexpected output\)"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28463
b7b9f5
    "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: print va.t\(1\) := 15"
b7b9f5
    "FAIL: gdb.ada/set_pckd_arr_elt.exp: scenario=minimal: continue to update_small for va.t"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28108
b7b9f5
    "FAIL: gdb.base/langs.exp: up to foo in langs.exp"
b7b9f5
    "FAIL: gdb.base/langs.exp: up to cppsub_ in langs.exp"
b7b9f5
    "FAIL: gdb.base/langs.exp: up to fsub in langs.exp"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=27539
b7b9f5
    "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\)"
b7b9f5
    "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(i\) == &typeid\(typeof\(i\)\)"
b7b9f5
    "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\)"
b7b9f5
    "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(cp\) == &typeid\(typeof\(cp\)\)"
b7b9f5
    "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\)"
b7b9f5
    "FAIL: gdb.cp/typeid.exp: before starting: print &typeid\(ccp\) == &typeid\(typeof\(ccp\)\)"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28461
b7b9f5
    "FAIL: gdb.reverse/fstatat-reverse.exp: continue to breakpoint: marker2"
b7b9f5
    # https://sourceware.org/pipermail/gdb-patches/2021-October/182449.html
b7b9f5
    "FAIL: gdb.threads/current-lwp-dead.exp: continue to breakpoint: fn_return"
b7b9f5
    # Similar error message to the one above, see if fixing that one fixes this.
b7b9f5
    "FAIL: gdb.threads/clone-new-thread-event.exp: catch SIGUSR1"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=27238
b7b9f5
    "FAIL: gdb.go/package.exp: setting breakpoint at package2.Foo"
b7b9f5
    "FAIL: gdb.go/package.exp: going to first breakpoint \(the program exited\)"
Bernhard M. Wiedemann c41d25
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28551
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.go/package.exp: going to first breakpoint \\(GDB internal error\\)"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28468
b7b9f5
    "FAIL: gdb.threads/signal-command-handle-nopass.exp: step-over (yes|no): signal SIGUSR1"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28477
b7b9f5
    "FAIL: gdb.base/step-over-syscall.exp: clone: displaced=off: continue to marker \(clone\)"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28478
b7b9f5
    "FAIL: gdb.gdb/selftest.exp: backtrace through signal handler"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=26867
b7b9f5
    "FAIL: gdb.threads/signal-sigtrap.exp: sigtrap thread 1: signal SIGTRAP reaches handler"
b7b9f5
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28510
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: br main"
Bernhard M. Wiedemann c41d25
    "FAIL: gdb.debuginfod/fetch_src_and_symbols.exp: local_url: l"
Bernhard M. Wiedemann f155be
Bernhard M. Wiedemann f155be
    # https://sourceware.org/bugzilla/show_bug.cgi?id=28667
Bernhard M. Wiedemann f155be
    "FAIL: gdb.reverse/watch-precsave.exp: watchpoint hit, fourth time \\(GDB internal error\\)"
b7b9f5
)
b7b9f5
b7b9f5
case $n in
b7b9f5
    1)
b7b9f5
	# 'FAIL: .* internal error' in gdb.sum.
b7b9f5
	# Test fail due to internal error.
b7b9f5
	#
Bernhard M. Wiedemann c41d25
	# Todo: apply kfail_factory only on factory sum files.
Bernhard M. Wiedemann c41d25
	kfail+=("${kfail_factory[@]}")
b7b9f5
	kfail_re=$(join "|" "${kfail[@]}")
b7b9f5
	grep "^FAIL:.*internal error" binaries-testsuite*/gdb-testresults/*.sum \
b7b9f5
	     | grep -E -v "$kfail_re"
b7b9f5
	;;
b7b9f5
b7b9f5
    2)
b7b9f5
	# 'ERROR:' in gdb.sum.
b7b9f5
	# A dejagnu or tcl ERROR, may hide real problems.
b7b9f5
	#
b7b9f5
	kfail+=(
b7b9f5
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=28323
b7b9f5
	    "SLE-12.x86_64.*gdb.ada/mi_dyn_arr.exp"
b7b9f5
	)
b7b9f5
b7b9f5
	kfail_re=$(join "|" "${kfail[@]}")
b7b9f5
	grep -A1 "ERROR:.*no longer" binaries-testsuite*/gdb-testresults/*.sum \
b7b9f5
	    | grep -E -v "ERROR|\--" | grep -E -v "$kfail_re"
b7b9f5
	;;
b7b9f5
b7b9f5
    3)
b7b9f5
	# 'internal-error' in gdb.log
b7b9f5
	# Catch all internal-errors, not just the ones reported by dejagnu.
b7b9f5
	#
b7b9f5
	kfail+=(
b7b9f5
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=26284
b7b9f5
	    "infrun.c:[0-9]*: internal-error: int finish_step_over\(.*\): Assertion \`ecs->event_thread->control.trap_expected' failed."
b7b9f5
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=26363
b7b9f5
	    ".i586.*i386-linux-nat.c:[0-9]*: internal-error: Got request for bad register number 41."
b7b9f5
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=26761
b7b9f5
	    "thread.c:[0-9]*: internal-error: .* inferior_thread\(\): Assertion \`current_thread_ \!= nullptr' failed."
b7b9f5
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=19675
b7b9f5
	    "linux-nat.c:[0-9]*: internal-error: wait returned unexpected status"
Bernhard M. Wiedemann c41d25
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=28553
Bernhard M. Wiedemann c41d25
	    "infrun.c:[0-9]*: internal-error: thread .* needs a step-over, but not in step-over queue"
Bernhard M. Wiedemann c41d25
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=19675
Bernhard M. Wiedemann c41d25
	    "linux-nat.c:[0-9]*: internal-error: wait returned unexpected"
Bernhard M. Wiedemann c41d25
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=28604
Bernhard M. Wiedemann c41d25
	    "x86-linux-dregs.c:[0-9]*: internal-error: void x86_linux_update_debug_registers\(lwp_info\*\): Assertion \`lwp_is_stopped \(lwp\)' failed."
Bernhard M. Wiedemann f155be
Bernhard M. Wiedemann f155be
	    # https://sourceware.org/bugzilla/show_bug.cgi?id=28667
Bernhard M. Wiedemann f155be
	    "record-full.c:[0-9]*: internal-error: ptid_t record_full_wait_1\(target_ops\*, ptid_t, target_waitstatus\*, target_wait_flags\): Assertion \`\(options & TARGET_WNOHANG\) != 0' failed."
b7b9f5
	)
b7b9f5
b7b9f5
	kfail_re=$(join "|" "${kfail[@]}")
b7b9f5
	grep -a -H internal-error: binaries-testsuite.*/gdb-testresults/*.log \
b7b9f5
	    | grep -a -v "maint.c:[0-9]" \
b7b9f5
	    | grep -a -E -v "$kfail_re"
b7b9f5
	;;
b7b9f5
b7b9f5
    4)
b7b9f5
	sums=()
b7b9f5
b7b9f5
	# Note: below we avoid gdb-x86_64-suse-linux-m32.sum (the pie variant).
b7b9f5
	# That one hasn't been cleaned up.
b7b9f5
	
b7b9f5
	# Known clean config: Leap 15.2 x86_64.
b7b9f5
	config=openSUSE_Leap_15.2.x86_64/gdb-testresults
b7b9f5
	sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum"
b7b9f5
	       "$config/gdb-x86_64-suse-linux-m64.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.sum")
b7b9f5
b7b9f5
	# Known clean config: Leap 15.3 x86_64
b7b9f5
	config=openSUSE_Leap_15.3.x86_64/gdb-testresults
b7b9f5
	sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum"
b7b9f5
	       "$config/gdb-x86_64-suse-linux-m64.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.sum")
b7b9f5
b7b9f5
	# Known clean config: SLE 15 x86_64.
b7b9f5
	config=SLE-15.x86_64/gdb-testresults
b7b9f5
	sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum"
b7b9f5
	       "$config/gdb-x86_64-suse-linux-m64.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.sum")
b7b9f5
b7b9f5
	# Known cleanish config: Factory x86_64.
b7b9f5
	config=openSUSE_Factory.x86_64/gdb-testresults
b7b9f5
	sums+=("$config/gdb-x86_64-suse-linux-m64.-fno-PIE.-no-pie.sum"
b7b9f5
	       "$config/gdb-x86_64-suse-linux-m64.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.-fno-PIE.-no-pie.sum"
Bernhard M. Wiedemann c41d25
	       "$config/gdb-x86_64-suse-linux-m32.sum")	
b7b9f5
b7b9f5
	kfail+=("${kfail_factory[@]}")
b7b9f5
b7b9f5
	for sum in "${sums[@]}"; do
b7b9f5
	    sum=binaries-testsuite.$sum
b7b9f5
	    report_sum "$sum"
b7b9f5
	done
b7b9f5
	;;
b7b9f5
b7b9f5
    5)
Bernhard M. Wiedemann c41d25
	librpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \
Bernhard M. Wiedemann c41d25
		     | grep -v SLE-11)
Bernhard M. Wiedemann c41d25
	nolibrpm=$(ls -1 binaries-testsuite*/gdb-testresults/*.sum \
Bernhard M. Wiedemann c41d25
		     | grep SLE-11)
Bernhard M. Wiedemann c41d25
	grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (librpm)" \
Bernhard M. Wiedemann c41d25
	     $librpm \
Bernhard M. Wiedemann c41d25
	    | grep -E -v ":1"
Bernhard M. Wiedemann c41d25
	grep -c "PASS: gdb.suse/zypper-hint.exp: zypper hint printed (no librpm)" \
Bernhard M. Wiedemann c41d25
	     $nolibrpm \
Bernhard M. Wiedemann c41d25
	    | grep -E -v ":1"
Bernhard M. Wiedemann c41d25
	;;
Bernhard M. Wiedemann c41d25
Bernhard M. Wiedemann c41d25
    6)
b7b9f5
	sums=()
b7b9f5
b7b9f5
	mapfile -t < <(echo_line "$dir"/*-m64.-fno-PIE.-no-pie.sum)
b7b9f5
	sums+=("${MAPFILE[@]}")
b7b9f5
	mapfile -t < <(echo_line "$dir"/*-m64.sum)
b7b9f5
	sums+=("${MAPFILE[@]}")
b7b9f5
	mapfile -t < <(echo_line "$dir"/*-m32.-fno-PIE.-no-pie.sum)
b7b9f5
	sums+=("${MAPFILE[@]}")
Bernhard M. Wiedemann c41d25
	mapfile -t < <(echo_line "$dir"/*-m32.sum)
Bernhard M. Wiedemann c41d25
	sums+=("${MAPFILE[@]}")
b7b9f5
b7b9f5
	# Assume this is factory.
b7b9f5
	kfail+=("${kfail_factory[@]}")
b7b9f5
	
b7b9f5
	for sum in "${sums[@]}"; do
b7b9f5
	    report_sum "$sum"
b7b9f5
	done
b7b9f5
	;;
b7b9f5
b7b9f5
    *)
b7b9f5
	echo "Don't know how to handle arg: $n"
b7b9f5
	exit 1
b7b9f5
	;;
b7b9f5
esac