From e2a1df0b4f125f8441a86410b25391a9064da601 Mon Sep 17 00:00:00 2001 From: Michal Kolar Date: Mon, 29 Nov 2021 10:58:36 +0000 Subject: [PATCH] tests/gdb-testsuite-sanity: add testcase --- tests/gdb-testsuite-sanity/Makefile | 68 ++++ tests/gdb-testsuite-sanity/PURPOSE | 30 ++ tests/gdb-testsuite-sanity/main.fmf | 45 +++ tests/gdb-testsuite-sanity/ref/default | 431 +++++++++++++++++++++++++ tests/gdb-testsuite-sanity/ref/gen.sh | 11 + tests/gdb-testsuite-sanity/runtest.sh | 135 ++++++++ 6 files changed, 720 insertions(+) create mode 100644 tests/gdb-testsuite-sanity/Makefile create mode 100644 tests/gdb-testsuite-sanity/PURPOSE create mode 100644 tests/gdb-testsuite-sanity/main.fmf create mode 100644 tests/gdb-testsuite-sanity/ref/default create mode 100755 tests/gdb-testsuite-sanity/ref/gen.sh create mode 100755 tests/gdb-testsuite-sanity/runtest.sh diff --git a/tests/gdb-testsuite-sanity/Makefile b/tests/gdb-testsuite-sanity/Makefile new file mode 100644 index 0000000..c74a922 --- /dev/null +++ b/tests/gdb-testsuite-sanity/Makefile @@ -0,0 +1,68 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /tools/gdb/Sanity/gdb-testsuite-sanity +# Description: gdb testing by upstream testsuite +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 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/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/tools/gdb/Sanity/gdb-testsuite-sanity +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE ref + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +.SILENT: ref_file +ref_file: ./ref/gen.sh + test -x ./ref/gen.sh || chmod a+x ./ref/gen.sh + ./ref/gen.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Michal Kolar " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: gdb testing by upstream testsuite" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 1h" >> $(METADATA) + @echo "RunFor: gdb" >> $(METADATA) + @echo "Requires: gdb rpm-build yum-utils dejagnu make gcc gcc-gfortran glibc" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHEL6 -RHEL7" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/gdb-testsuite-sanity/PURPOSE b/tests/gdb-testsuite-sanity/PURPOSE new file mode 100644 index 0000000..83d868f --- /dev/null +++ b/tests/gdb-testsuite-sanity/PURPOSE @@ -0,0 +1,30 @@ +PURPOSE of /tools/gdb/Sanity/gdb-testsuite-sanity +Description: gdb testing by upstream testsuite +Author: Michal Kolar + +By default, testsuite is executed with default options for the package that +corresponds to the gdb command by newly created ordinary user. Before +executing, the testsuite is reduced by the appropriate reference file that +defines the allowed test range. + +Executing can be modified by these variables: + * BUILD_USER -- user which will be used for building and testing gdb + * PACKAGE -- explicitly defines which rpm package should be tested + * RUNTESTFLAGS -- variable which will be forwarded to 'make check' command + and can be used to reduce the range of testing + * TESTS_COUNT_MIN -- minimum number of cases that should be tested (does not + affect the triggering of testcases, it only sets the + value of the reference comparator) + +Example: + $ BUILD_USER=root \ + PACKAGE=gdb \ + RUNTESTFLAGS='GDB=/usr/bin/gdb gdb.base/break*.exp' \ + TESTS_COUNT_MIN=32 make run + +Reference files instructions: + * path of reference file for current package, distribution and architecture + can be generated by: + $ make ref_file + or directly by: + $ ./ref/gen.sh diff --git a/tests/gdb-testsuite-sanity/main.fmf b/tests/gdb-testsuite-sanity/main.fmf new file mode 100644 index 0000000..32f0351 --- /dev/null +++ b/tests/gdb-testsuite-sanity/main.fmf @@ -0,0 +1,45 @@ +summary: gdb testing by upstream testsuite +description: | + By default, testsuite is executed with default options for the package that + corresponds to the gdb command by newly created ordinary user. Before + executing, the testsuite is reduced by the appropriate reference file that + defines the allowed test range. + + Executing can be modified by these variables: + * BUILD_USER -- user which will be used for building and testing gdb + * PACKAGE -- explicitly defines which rpm package should be tested + * RUNTESTFLAGS -- variable which will be forwarded to 'make check' command + and can be used to reduce the range of testing + * TESTS_COUNT_MIN -- minimum number of cases that should be tested (does not + affect the triggering of testcases, it only sets the + value of the reference comparator) + + Example: + $ BUILD_USER=root \ + PACKAGE=gdb \ + RUNTESTFLAGS='GDB=/usr/bin/gdb gdb.base/break*.exp' \ + TESTS_COUNT_MIN=32 make run + + Reference files instructions: + * path of reference file for current package, distribution and architecture + can be generated by: + $ make ref_file + or directly by: + $ ./ref/gen.sh +contact: Michal Kolar +component: +- gdb +test: ./runtest.sh +framework: beakerlib +recommend: +- gdb +- rpm-build +- yum-utils +- dejagnu +- make +- gcc +- gcc-gfortran +- glibc +duration: 1h +extra-summary: /tools/gdb/Sanity/gdb-testsuite-sanity +extra-task: /tools/gdb/Sanity/gdb-testsuite-sanity diff --git a/tests/gdb-testsuite-sanity/ref/default b/tests/gdb-testsuite-sanity/ref/default new file mode 100644 index 0000000..07860a5 --- /dev/null +++ b/tests/gdb-testsuite-sanity/ref/default @@ -0,0 +1,431 @@ +gdb.base/advance-until-multiple-locations.exp +gdb.base/alias.exp +gdb.base/align-c.exp +gdb.base/annota-input-while-running.exp +gdb.base/anon.exp +gdb.base/args.exp +gdb.base/arrayidx.exp +gdb.base/attach-non-pgrp-leader.exp +gdb.base/attach-pie-noexec.exp +gdb.base/attach-twice.exp +gdb.base/attach-wait-input.exp +gdb.base/auto-load.exp +gdb.base/bang.exp +gdb.base/batch-exit-status.exp +gdb.base/bfp-test.exp +gdb.base/bg-execution-repeat.exp +gdb.base/bitfields2.exp +gdb.base/bitfields.exp +gdb.base/bitops.exp +gdb.base/bp-cmds-execution-x-script.exp +gdb.base/branch-to-self.exp +gdb.base/break-always.exp +gdb.base/break-caller-line.exp +gdb.base/break-include.exp +gdb.base/break-inline.exp +gdb.base/break-main-file-remove-fail.exp +gdb.base/break-on-linker-gcd-function.exp +gdb.base/breakpoint-shadow.exp +gdb.base/break-probes.exp +gdb.base/cached-source-file.exp +gdb.base/callexit.exp +gdb.base/call-strs.exp +gdb.base/catch-follow-exec.exp +gdb.base/catch-gdb-caused-signals.exp +gdb.base/catch-signal-fork.exp +gdb.base/catch-signal-siginfo-cond.exp +gdb.base/check-psymtab.exp +gdb.base/c-linkage-name.exp +gdb.base/code_elim.exp +gdb.base/command-line-input.exp +gdb.base/compare-sections.exp +gdb.base/complex.exp +gdb.base/comprdebug.exp +gdb.base/consecutive-step-over.exp +gdb.base/continue-all-already-running.exp +gdb.base/coredump-filter.exp +gdb.base/corefile2.exp +gdb.base/corefile-buildid.exp +gdb.base/cursal.exp +gdb.base/datalib.exp +gdb.base/dcache-line-read-error.exp +gdb.base/default-args.exp +gdb.base/define.exp +gdb.base/disabled-location.exp +gdb.base/disasm-end-cu.exp +gdb.base/disasm-optim.exp +gdb.base/double-prompt-target-event-error.exp +gdb.base/dprintf-detach.exp +gdb.base/dprintf-next.exp +gdb.base/dprintf-non-stop.exp +gdb.base/dprintf-pending.exp +gdb.base/dso2dso.exp +gdb.base/dump.exp +gdb.base/dup-sect.exp +gdb.base/echo.exp +gdb.base/empty_exe.exp +gdb.base/endian.exp +gdb.base/endianity.exp +gdb.base/enumval.exp +gdb.base/environ.exp +gdb.base/eu-strip-infcall.exp +gdb.base/eval.exp +gdb.base/examine-backward.exp +gdb.base/exec-invalid-sysroot.exp +gdb.base/execution-termios.exp +gdb.base/exe-lock.exp +gdb.base/exitsignal.exp +gdb.base/expand-psymtabs.exp +gdb.base/filesym.exp +gdb.base/find-unmapped.exp +gdb.base/fixsection.exp +gdb.base/flexible-array-member.exp +gdb.base/float.exp +gdb.base/floatn.exp +gdb.base/focus-cmd-prev.exp +gdb.base/foll-exec.exp +gdb.base/foll-exec-mode.exp +gdb.base/fortran-sym-case.exp +gdb.base/frame-selection.exp +gdb.base/freebpcmd.exp +gdb.base/fullname.exp +gdb.base/fullpath-expand.exp +gdb.base/func-ptr.exp +gdb.base/gcore-buffer-overflow.exp +gdb.base/gcore-relro.exp +gdb.base/gdb1056.exp +gdb.base/gdb1090.exp +gdb.base/gdb11530.exp +gdb.base/gdb11531.exp +gdb.base/gdb1250.exp +gdb.base/gdb1555.exp +gdb.base/gdb1821.exp +gdb.base/gdbhistsize-history.exp +gdb.base/gdb-sigterm-2.exp +gdb.base/hashline2.exp +gdb.base/hashline3.exp +gdb.base/hbreak.exp +gdb.base/hbreak-unmapped.exp +gdb.base/help.exp +gdb.base/history-duplicates.exp +gdb.base/hook-stop.exp +gdb.base/huge.exp +gdb.base/hw-sw-break-same-address.exp +gdb.base/ifelse.exp +gdb.base/index-cache.exp +gdb.base/infcall-input.exp +gdb.base/infcall-nested-structs-c++.exp +gdb.base/infcall-nested-structs-c.exp +gdb.base/infnan.exp +gdb.base/infoline.exp +gdb.base/info-locals-unused-static-var.exp +gdb.base/info_minsym.exp +gdb.base/info-proc.exp +gdb.base/info-program.exp +gdb.base/info_qt.exp +gdb.base/info-shared.exp +gdb.base/info_sources.exp +gdb.base/info-target.exp +gdb.base/info-types-c++.exp +gdb.base/info-types-c.exp +gdb.base/info-var.exp +gdb.base/interact.exp +gdb.base/interrupt-daemon-attach.exp +gdb.base/interrupt-daemon.exp +gdb.base/interrupt-noterm.exp +gdb.base/jit-attach-pie.exp +gdb.base/jit-reader-exec.exp +gdb.base/jit-reader-simple.exp +gdb.base/jump.exp +gdb.base/kill-detach-inferiors-cmd.exp +gdb.base/killed-outside.exp +gdb.base/label.exp +gdb.base/label-without-address.exp +gdb.base/largecore-last-address-lock.exp +gdb.base/lineinc.exp +gdb.base/lineno-makeup.exp +gdb.base/linespecs.exp +gdb.base/line-symtabs.exp +gdb.base/list-ambiguous.exp +gdb.base/list-missing-source.exp +gdb.base/logical.exp +gdb.base/longest-types.exp +gdb.base/longjmp.exp +gdb.base/long_long.exp +gdb.base/maint-expand-symbols-header-file.exp +gdb.base/maint-target-async-off.exp +gdb.base/many-completions.exp +gdb.base/many-headers.exp +gdb.base/max-depth-c++.exp +gdb.base/max-depth-c.exp +gdb.base/max-value-size.exp +gdb.base/memattr.exp +gdb.base/mips_pro.exp +gdb.base/move-dir.exp +gdb.base/msym-lang.exp +gdb.base/nested-addr.exp +gdb.base/nextoverexit.exp +gdb.base/nodebug.exp +gdb.base/noreturn-finish.exp +gdb.base/noreturn-return.exp +gdb.base/offsets.exp +gdb.base/osabi.exp +gdb.base/overlays.exp +gdb.base/page.exp +gdb.base/paginate-after-ctrl-c-running.exp +gdb.base/paginate-bg-execution.exp +gdb.base/paginate-execution-startup.exp +gdb.base/paginate-inferior-exit.exp +gdb.base/pc-fp.exp +gdb.base/permissions.exp +gdb.base/pr10179.exp +gdb.base/pretty-print.exp +gdb.base/prologue.exp +gdb.base/prologue-include.exp +gdb.base/psym-external-decl.exp +gdb.base/psymtab.exp +gdb.base/ptr-typedef.exp +gdb.base/quit.exp +gdb.base/quit-live.exp +gdb.base/randomize.exp +gdb.base/random-signal.exp +gdb.base/readline-overflow.exp +gdb.base/reggroups.exp +gdb.base/remote-exec-file.exp +gdb.base/remote.exp +gdb.base/remotetimeout.exp +gdb.base/reread-readsym.exp +gdb.base/return.exp +gdb.base/return-nodebug.exp +gdb.base/run-after-attach.exp +gdb.base/save-bp.exp +gdb.base/sect-cmd.exp +gdb.base/sep.exp +gdb.base/sepsymtab.exp +gdb.base/server-del-break.exp +gdb.base/set-inferior-tty.exp +gdb.base/set-lang-auto.exp +gdb.base/set-noassign.exp +gdb.base/set-solib-absolute-prefix.exp +gdb.base/shell.exp +gdb.base/shreloc.exp +gdb.base/sigall.exp +gdb.base/sigchld.exp +gdb.base/signest.exp +gdb.base/sigrepeat.exp +gdb.base/skip-inline.exp +gdb.base/solib-disc.exp +gdb.base/solib-nodir.exp +gdb.base/solib-probes-nosharedlibrary.exp +gdb.base/solib-vanish.exp +gdb.base/source-execution.exp +gdb.base/source.exp +gdb.base/sss-bp-on-user-bp.exp +gdb.base/stale-infcall.exp +gdb.base/start.exp +gdb.base/startup-with-shell.exp +gdb.base/statistics.exp +gdb.base/step-resume-infcall.exp +gdb.base/step-sw-breakpoint-adjust-pc.exp +gdb.base/step-symless.exp +gdb.base/step-test.exp +gdb.base/structs2.exp +gdb.base/structs3.exp +gdb.base/style.exp +gdb.base/style-logging.exp +gdb.base/symbol-alias.exp +gdb.base/sym-file.exp +gdb.base/symfile-warn.exp +gdb.base/symlink-sourcefile.exp +gdb.base/symtab-search-order.exp +gdb.base/tab-crash.exp +gdb.base/term.exp +gdb.base/testenv.exp +gdb.base/trace-commands.exp +gdb.base/tracefork-zombie.exp +gdb.base/twice.exp +gdb.base/type-opaque.exp +gdb.base/until.exp +gdb.base/value-double-free.exp +gdb.base/vdso-warning.exp +gdb.base/vla-ptr.exp +gdb.base/warning.exp +gdb.base/watch-cond-infcall.exp +gdb.base/watch-non-mem.exp +gdb.base/watchpoint-cond-gone.exp +gdb.base/watchpoint-delete.exp +gdb.base/watchpoint-during-step.exp +gdb.base/watch-vfork.exp +gdb.base/wchar.exp +gdb.base/with.exp +gdb.base/with-mf.exp +gdb.cp/abstract-origin.exp +gdb.cp/ambiguous.exp +gdb.cp/anon-ns.exp +gdb.cp/anon-struct.exp +gdb.cp/anon-union.exp +gdb.cp/arg-reference.exp +gdb.cp/b146835.exp +gdb.cp/baseenum.exp +gdb.cp/bool.exp +gdb.cp/breakpoint-locs.exp +gdb.cp/bs15503.exp +gdb.cp/call-c.exp +gdb.cp/chained-calls.exp +gdb.cp/class2.exp +gdb.cp/cmpd-minsyms.exp +gdb.cp/converts.exp +gdb.cp/cpcompletion.exp +gdb.cp/cpexprs-debug-types.exp +gdb.cp/cplabel.exp +gdb.cp/cpsizeof.exp +gdb.cp/ctti.exp +gdb.cp/debug-expr.exp +gdb.cp/demangle.exp +gdb.cp/derivation.exp +gdb.cp/destrprint.exp +gdb.cp/disasm-func-name.exp +gdb.cp/dispcxx.exp +gdb.cp/ena-dis-br-range.exp +gdb.cp/enum-class.exp +gdb.cp/exception.exp +gdb.cp/exceptprint.exp +gdb.cp/expand-psymtabs-cxx.exp +gdb.cp/expand-sals.exp +gdb.cp/extern-c.exp +gdb.cp/formatted-ref.exp +gdb.cp/fpointer.exp +gdb.cp/gdb1355.exp +gdb.cp/hang.exp +gdb.cp/impl-this.exp +gdb.cp/infcall-dlopen.exp +gdb.cp/infcall-nodebug-c++-d0.exp +gdb.cp/infcall-nodebug-c-d0.exp +gdb.cp/infcall-nodebug-c++-d1.exp +gdb.cp/infcall-nodebug-c-d1.exp +gdb.cp/iostream.exp +gdb.cp/local-static.exp +gdb.cp/mb-inline.exp +gdb.cp/mb-templates.exp +gdb.cp/m-data.exp +gdb.cp/member-name.exp +gdb.cp/member-ptr.exp +gdb.cp/method2.exp +gdb.cp/method.exp +gdb.cp/meth-typedefs.exp +gdb.cp/namelessclass.exp +gdb.cp/namespace-enum.exp +gdb.cp/namespace.exp +gdb.cp/namespace-nested-import.exp +gdb.cp/nested-types.exp +gdb.cp/nextoverthrow.exp +gdb.cp/non-trivial-retval.exp +gdb.cp/noparam.exp +gdb.cp/nsalias.exp +gdb.cp/nsdecl.exp +gdb.cp/nsimport.exp +gdb.cp/nsnoimports.exp +gdb.cp/nsrecurs.exp +gdb.cp/nsstress.exp +gdb.cp/operator.exp +gdb.cp/overload-const.exp +gdb.cp/overload.exp +gdb.cp/ovsrch.exp +gdb.cp/paren-type.exp +gdb.cp/parse-lang.exp +gdb.cp/pass-by-ref-2.exp +gdb.cp/pass-by-ref.exp +gdb.cp/pr-1023.exp +gdb.cp/pr10687.exp +gdb.cp/pr10728.exp +gdb.cp/pr11734.exp +gdb.cp/pr12028.exp +gdb.cp/pr-1210.exp +gdb.cp/pr12273.exp +gdb.cp/pr17132.exp +gdb.cp/pr9067.exp +gdb.cp/pr9631.exp +gdb.cp/print-demangle.exp +gdb.cp/printmethod.exp +gdb.cp/psmang.exp +gdb.cp/psymtab-parameter.exp +gdb.cp/ptype-cv-cp.exp +gdb.cp/ptype-flags.exp +gdb.cp/punctuator.exp +gdb.cp/readnow-language.exp +gdb.cp/ref-params.exp +gdb.cp/re-set-overloaded.exp +gdb.cp/rtti.exp +gdb.cp/rvalue-ref-casts.exp +gdb.cp/rvalue-ref-params.exp +gdb.cp/rvalue-ref-sizeof.exp +gdb.cp/rvalue-ref-types.exp +gdb.cp/save-bp-qualified.exp +gdb.cp/scope-err.exp +gdb.cp/shadow.exp +gdb.cp/smartp.exp +gdb.cp/static-method.exp +gdb.cp/static-print-quit.exp +gdb.cp/static-typedef-print.exp +gdb.cp/stub-array-size.exp +gdb.cp/subtypes.exp +gdb.cp/try_catch.exp +gdb.cp/typedef-base.exp +gdb.cp/typedef-operator.exp +gdb.cp/typed-enum.exp +gdb.cp/userdef.exp +gdb.cp/using-crash.exp +gdb.cp/virtbase2.exp +gdb.cp/virtbase.exp +gdb.cp/virtfunc2.exp +gdb.cp/wide_char_types.exp +gdb.fortran/array-bounds.exp +gdb.fortran/array-bounds-high.exp +gdb.fortran/array-element.exp +gdb.fortran/array-slices-bad.exp +gdb.fortran/array-slices-sub-slices.exp +gdb.fortran/block-data.exp +gdb.fortran/charset.exp +gdb.fortran/class-allocatable-array.exp +gdb.fortran/common-block.exp +gdb.fortran/complex.exp +gdb.fortran/derived-type.exp +gdb.fortran/derived-type-function.exp +gdb.fortran/derived-type-striding.exp +gdb.fortran/dot-ops.exp +gdb.fortran/exprs.exp +gdb.fortran/info-modules.exp +gdb.fortran/info-types.exp +gdb.fortran/intrinsics.exp +gdb.fortran/library-module.exp +gdb.fortran/logical.exp +gdb.fortran/max-depth.exp +gdb.fortran/mixed-lang-stack.exp +gdb.fortran/module.exp +gdb.fortran/multi-dim.exp +gdb.fortran/nested-funcs-2.exp +gdb.fortran/nested-funcs.exp +gdb.fortran/pointer-to-pointer.exp +gdb.fortran/print-formatted.exp +gdb.fortran/printing-types.exp +gdb.fortran/print_type.exp +gdb.fortran/ptr-indentation.exp +gdb.fortran/ptype-on-functions.exp +gdb.fortran/short-circuit-argument-list.exp +gdb.fortran/subarray.exp +gdb.fortran/type-kinds.exp +gdb.fortran/types.exp +gdb.fortran/vla-alloc-assoc.exp +gdb.fortran/vla-datatypes.exp +gdb.fortran/vla-history.exp +gdb.fortran/vla-ptr-info.exp +gdb.fortran/vla-ptype.exp +gdb.fortran/vla-ptype-sub.exp +gdb.fortran/vla-sizeof.exp +gdb.fortran/vla-type.exp +gdb.fortran/vla-value.exp +gdb.fortran/vla-value-sub-arbitrary.exp +gdb.fortran/vla-value-sub.exp +gdb.fortran/vla-value-sub-finish.exp +gdb.fortran/whatis_type.exp +gdb.fortran/xlf-variable.exp diff --git a/tests/gdb-testsuite-sanity/ref/gen.sh b/tests/gdb-testsuite-sanity/ref/gen.sh new file mode 100755 index 0000000..0926a71 --- /dev/null +++ b/tests/gdb-testsuite-sanity/ref/gen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +BIN=`which gdb` && +PACKAGE=`rpm -qf --qf='%{name}\n' ${BIN}` && +SYSTEM=`uname -r | grep -o -E 'el[0-9]+a?|fc[0-9]+'` && +ARCH=`arch` && +echo "./ref/${PACKAGE}/${SYSTEM}.${ARCH}" && +exit 0 + +echo "ERROR" >&2 +exit 1 diff --git a/tests/gdb-testsuite-sanity/runtest.sh b/tests/gdb-testsuite-sanity/runtest.sh new file mode 100755 index 0000000..0a17d03 --- /dev/null +++ b/tests/gdb-testsuite-sanity/runtest.sh @@ -0,0 +1,135 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /tools/gdb/Sanity/gdb-testsuite-sanity +# Description: gdb testing by upstream testsuite +# Author: Michal Kolar +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2021 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 + +BUILD_USER=${BUILD_USER:-gdbbld} +export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' `which gdb`)}" +RUNTESTFLAGS=${RUNTESTFLAGS:-GDB=`rpm -ql $PACKAGE | grep -E 'bin/gdb$'`} +TESTS_COUNT_MIN=${TESTS_COUNT_MIN:-4000} +REQUIRES="$PACKAGE rpm-build dejagnu make gcc glibc" +if rlIsFedora; then + REQUIRES="$REQUIRES dnf-utils" +else + REQUIRES="$REQUIRES yum-utils" +fi + +rlJournalStart + rlPhaseStartSetup + rlShowRunningKernel + rlAssertRpm --all + rlRun "TmpDir=\$(mktemp -d)" + rlRun "cp -r ./ref $TmpDir" + rlRun "pushd $TmpDir" + rlFetchSrcForInstalled $PACKAGE + rlRun "useradd -M -N $BUILD_USER" 0,9 + [ $? -eq 0 ] && rlRun "del=yes" + rlRun "chown -R $BUILD_USER:users $TmpDir" + rlRun "cp /proc/sys/kernel/core_pattern $TmpDir/core_pattern.bckp" + rlRun "echo 'core.%p' >/proc/sys/kernel/core_pattern" + rlRun "ulimit -c unlimited" + rlPhaseEnd + + rlPhaseStartSetup "build gdb" + rlRun "su -c 'rpm -D \"_topdir $TmpDir\" -U *.src.rpm &>rpm.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/rpm.log rpm.log" + rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bs --with testsuite $TmpDir/SPECS/*.spec &>rpmbuild-bs.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/rpmbuild-bs.log rpmbuild-bs.log" + rlRun "yum-builddep -y -D \"_topdir $TmpDir\" $TmpDir/SRPMS/*.src.rpm &>$TmpDir/yum-builddep.log" 0,1; ret=$? + rlRun "rlFileSubmit $TmpDir/yum-builddep.log yum-builddep.log" + if [ $ret -ne 0 ]; then + rlLogWarning "Dependencies was not successfully installed" + rlLogInfo "Trying to install dependencies of bare SPEC file ..." + rlRun "yum-builddep -y -D \"_topdir $TmpDir\" $TmpDir/SPECS/*.spec &>$TmpDir/yum-builddep-spec.log" + rlRun "rlFileSubmit $TmpDir/yum-builddep-spec.log yum-builddep-spec.log" + fi + rlRun "su -c 'rpmbuild -D \"_topdir $TmpDir\" -bp $TmpDir/SPECS/*.spec &>$TmpDir/rpmbuild-bp.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/rpmbuild-bp.log rpmbuild-bp.log" + if test -e $TmpDir/BUILD/gdb-*/gnulib/configure; then + rlRun "cd $TmpDir/BUILD/gdb-*/gnulib" + rlRun "su -c 'bash ./configure &>$TmpDir/configure-gnulib.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/configure-gnulib.log configure-gnulib.log" + fi + rlRun "cd $TmpDir/BUILD/gdb-*/gdb" + rlRun "su -c './configure &>$TmpDir/configure.log' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/configure.log configure.log" + rlRun "DATADIR=`gdb -ex 'show data-directory' -batch | grep -o -E '/[^\"]+'`" + rlRun "mv data-directory data-directory.orig" + rlRun "ln -s $DATADIR ./data-directory" + rlPhaseEnd + + rlPhaseStartSetup "filter testsuite" + rlRun "system=`uname -r | grep -o -E 'el[0-9]+a?|fc[0-9]+'` && [[ ! -z \$system ]]" + rlRun "ref_file=$TmpDir/ref/$PACKAGE/$system.`arch`" + if ! test -e $ref_file; then + rlLogWarning "Reference file $ref_file not found" + rlLogInfo "Using default reference file ..." + rlRun "ref_file=$TmpDir/ref/default" + fi + rlRun "test -e $ref_file" + rlRun "cd testsuite" + rlRun "find . -regex '^./gdb\..+\.exp$' -type f -printf '%P\n' | sort >$TmpDir/test_list" + rlRun "comm -23 $TmpDir/test_list $ref_file >$TmpDir/disable_list" # disable tests that are not included in the reference file + rlLogInfo "Testcase disabling ..." + while read file; do + mv "$file" "$file.disabled" + done <$TmpDir/disable_list + rlRun "cd $TmpDir/BUILD/gdb-*/gdb" + rlPhaseEnd + + rlPhaseStartTest "run testsuite" + rlRun "su -c 'make check RUNTESTFLAGS=\"${RUNTESTFLAGS}\" |& tee $TmpDir/testsuite.log | grep -E \"^Running.+\.exp ...$\"; test \${PIPESTATUS[0]} -eq 0' $BUILD_USER" + rlRun "rlFileSubmit $TmpDir/testsuite.log testsuite.log" + rlRun "rlFileSubmit testsuite/gdb.sum gdb.sum" + rlRun "rlFileSubmit testsuite/gdb.log gdb.log" + rlLogInfo "`awk '/=== gdb Summary ===/,0' testsuite/gdb.sum`" + rlPhaseEnd + + rlPhaseStartTest "evaluate results" + rlRun "tests_count=\$(grep -E '^PASS:' testsuite/gdb.sum | wc -l)" + [ "$tests_count" -ge "$TESTS_COUNT_MIN" ] && rlLogInfo "Test counter: $tests_count" || rlFail "Test counter $tests_count should be greater than or equal to $TESTS_COUNT_MIN" + rlRun "awk 'BEGIN { RS=\"Running /tmp/[^/]+/BUILD/gdb-[^/]+/gdb/testsuite/\" } /\sERROR:|\sFAIL:|\sKPASS:|\sUNRESOLVED:|\sXPASS:/ { print \$0 }' testsuite/gdb.sum >$TmpDir/error.log" # check for errors, unresolved testcases, unexpected failures and unexpected successes + if [ -s $TmpDir/error.log ]; then + rlFail "Errors observed"; + rlRun "rlFileSubmit $TmpDir/error.log error.log" + rlRun "awk 'BEGIN { RS=\"Running /tmp/[^/]+/BUILD/gdb-[^/]+/gdb/testsuite/\" } /\sERROR:|\sFAIL:|\sKPASS:|\sUNRESOLVED:|\sXPASS:/ { print \$1 }' testsuite/gdb.sum >$TmpDir/affected_testcases.log" + rlLogInfo "`echo 'Affected testcases:';cat $TmpDir/affected_testcases.log`" + rlRun "rlFileSubmit $TmpDir/affected_testcases.log affected_testcases.log" + else + rlPass "No errors observed" + fi + rlPhaseEnd + + rlPhaseStartCleanup + rlRun "cat $TmpDir/core_pattern.bckp >/proc/sys/kernel/core_pattern" + rlRun "popd" + rlRun "rm -r $TmpDir" + [ "$del" = "yes" ] && rlRun "userdel -f $BUILD_USER" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd