From c23733759df4f05db52e3b93146a64b437dfd30b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Kadl=C4=8D=C3=ADk?= Date: Thu, 14 Aug 2025 07:06:44 +0200 Subject: [PATCH] Add a smoke test --- tests/Sanity/smoke/files/hello.c | 1 + tests/Sanity/smoke/main.fmf | 12 ++++++++ tests/Sanity/smoke/runtest.sh | 48 ++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 tests/Sanity/smoke/files/hello.c create mode 100644 tests/Sanity/smoke/main.fmf create mode 100755 tests/Sanity/smoke/runtest.sh diff --git a/tests/Sanity/smoke/files/hello.c b/tests/Sanity/smoke/files/hello.c new file mode 100644 index 0000000..76e8197 --- /dev/null +++ b/tests/Sanity/smoke/files/hello.c @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/tests/Sanity/smoke/main.fmf b/tests/Sanity/smoke/main.fmf new file mode 100644 index 0000000..1f6e834 --- /dev/null +++ b/tests/Sanity/smoke/main.fmf @@ -0,0 +1,12 @@ +summary: Smoke test +contact: Vaclav Kadlcik +component: + - chrpath +test: ${WITH_SCL:-bash} ./runtest.sh +framework: beakerlib +require+: + - chrpath + - gcc +duration: 5m +extra-summary: /tools/chrpath/Sanity/smoke +extra-task: /tools/chrpath/Sanity/smoke diff --git a/tests/Sanity/smoke/runtest.sh b/tests/Sanity/smoke/runtest.sh new file mode 100755 index 0000000..bfe8233 --- /dev/null +++ b/tests/Sanity/smoke/runtest.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash + +# Load libraries +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGES='chrpath gcc' + +rlJournalStart + rlPhaseStartSetup + rlLogInfo "PACKAGES=$PACKAGES" + rlAssertRpm --all + + rlRun "TmpDir=\$(mktemp -d)" + # shellcheck disable=SC2154 + rlRun "cp files/* $TmpDir" + rlRun "pushd $TmpDir" + rlPhaseEnd + + rlPhaseStartTest + rlRun 'chrpath -h >help.out' + rlAssertGrep '^Usage: chrpath .*' help.out + + rlRun 'chrpath -v >version.out' + rlAssertGrep '[0-9]\.[0-9]' version.out + + rlRun 'chrpath /dev/null' 1 + + rlRun 'gcc -o hello hello.c' + rlRun 'chrpath -l hello' 2 + + rlRun 'gcc -o hello -Wl,--disable-new-dtags,-rpath,./something hello.c' + rlRun 'chrpath -l hello >t1.out' + rlAssertGrep 'RPATH=./something$' t1.out + + rlRun 'chrpath -r ./other hello' + rlRun 'chrpath -l hello >t2.out' + rlAssertGrep 'RPATH=./other$' t2.out + + rlRun 'chrpath -d hello' + rlRun 'chrpath -l hello' 2 + rlPhaseEnd + + rlPhaseStartCleanup + rlRun popd + rlRun "rm -r $TmpDir" + rlPhaseEnd +rlJournalPrintText +rlJournalEnd