tests/dwz-quick-test: rework to make the test case more robust
This commit is contained in:
parent
2536f753c8
commit
f41c299cbe
@ -29,7 +29,7 @@ export TESTVERSION=1.0
|
|||||||
|
|
||||||
BUILT_FILES=
|
BUILT_FILES=
|
||||||
|
|
||||||
FILES=$(METADATA) runtest.sh Makefile PURPOSE something.c cmd.txt
|
FILES=$(METADATA) runtest.sh Makefile PURPOSE testcase.c cmds
|
||||||
|
|
||||||
.PHONY: all install download clean
|
.PHONY: all install download clean
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
b f
|
b 19
|
||||||
r
|
r
|
||||||
p x
|
p x
|
||||||
p/x var
|
p/x var
|
@ -29,32 +29,34 @@
|
|||||||
# Include Beaker environment
|
# Include Beaker environment
|
||||||
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
. /usr/share/beakerlib/beakerlib.sh || exit 1
|
||||||
|
|
||||||
|
export PACKAGE="${PACKAGE:-$(rpm -qf --qf='%{name}\n' `which dwz`)}"
|
||||||
|
REQUIRES="$PACKAGE gcc glibc gdb"
|
||||||
|
|
||||||
rlJournalStart
|
rlJournalStart
|
||||||
rlPhaseStartSetup
|
rlPhaseStartSetup
|
||||||
rlAssertRpm gcc
|
rlShowRunningKernel
|
||||||
rlAssertRpm gdb
|
rlAssertRpm --all
|
||||||
rlRun "TmpDir=\$(mktemp -d)" 0 "Creating tmp directory"
|
rlRun "TmpDir=\$(mktemp -d)"
|
||||||
rlRun "cp something.c cmd.txt $TmpDir"
|
rlRun "cp -r testcase.c cmds $TmpDir"
|
||||||
rlRun "pushd $TmpDir"
|
rlRun "pushd $TmpDir"
|
||||||
rlRun "gcc -g -O2 something.c -o something.out"
|
rlRun "gcc -g -O0 -o testcase testcase.c"
|
||||||
rlRun "cp something.out something.dwz"
|
rlRun "cp testcase testcase.dwz"
|
||||||
rlPhaseEnd
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "no crash + saved space"
|
rlPhaseStartTest
|
||||||
rlRun "dwz something.dwz"
|
rlRun "dwz testcase.dwz"
|
||||||
rlRun "[[ $(wc -c <something.out) -gt $(wc -c <something.dwz) ]]"
|
rlRun "BYTES_BASE_FILE=`wc -c <testcase`"
|
||||||
rlPhaseEnd
|
rlRun "BYTES_DWZED_FILE=`wc -c <testcase.dwz`"
|
||||||
|
[ $BYTES_DWZED_FILE -gt $BYTES_BASE_FILE ] && rlFail "DWZed file should not be greater than the original file."
|
||||||
|
rlRun "gdb --command=cmds --quiet --batch testcase.dwz |& tee $TmpDir/testcase.log; test \${PIPESTATUS[0]} -eq 0"
|
||||||
|
rlRun "grep 'hello, world' $TmpDir/testcase.log"
|
||||||
|
rlRun "grep '\$1 = -1' $TmpDir/testcase.log"
|
||||||
|
rlRun "grep '\$2 = 0x2a' $TmpDir/testcase.log"
|
||||||
|
rlPhaseEnd
|
||||||
|
|
||||||
rlPhaseStartTest "can we debug it?"
|
rlPhaseStartCleanup
|
||||||
rlRun "gdb -x cmd.txt -batch -q ./something.dwz > log 2>&1"
|
rlRun "popd"
|
||||||
rlRun "[[ $(grep -c 'hello, world' log) -eq 2 ]]"
|
rlRun "rm -r $TmpDir"
|
||||||
rlAssertGrep '$1 = -1' log
|
rlPhaseEnd
|
||||||
rlAssertGrep '$2 = 0x2a' log
|
|
||||||
rlPhaseEnd
|
|
||||||
|
|
||||||
rlPhaseStartCleanup
|
|
||||||
rlRun "popd"
|
|
||||||
rlRun "rm -r $TmpDir" 0 "Removing tmp directory"
|
|
||||||
rlPhaseEnd
|
|
||||||
rlJournalPrintText
|
rlJournalPrintText
|
||||||
rlJournalEnd
|
rlJournalEnd
|
||||||
|
Loading…
Reference in New Issue
Block a user