Add a smoke test

This commit is contained in:
Václav Kadlčík 2025-08-14 07:06:44 +02:00
commit c23733759d
3 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1 @@
int main() { return 0; }

View file

@ -0,0 +1,12 @@
summary: Smoke test
contact: Vaclav Kadlcik <vkadlcik@redhat.com>
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

48
tests/Sanity/smoke/runtest.sh Executable file
View file

@ -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 .*<program>' 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