run captree smoke tests

This commit is contained in:
Carlos Rodriguez-Fernandez 2023-12-10 22:13:31 -07:00
parent a3e0bbb8fc
commit 9298823630
No known key found for this signature in database
GPG Key ID: 47EBED05C3375B1F
2 changed files with 25 additions and 0 deletions

2
tests/captree/main.fmf Normal file
View File

@ -0,0 +1,2 @@
summary: captree smoke test
description: tests basic captree functionality

23
tests/captree/test.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
. /usr/share/beakerlib/beakerlib.sh || exit 1
rlJournalStart
if rpm --eval '%{golang_arches}' | tr ' ' '\n' | grep -q -e "$(rpm --eval '%{_arch}')"; then
rlPhaseStartTest "Should display help"
rlRun "captree -h"
rlPhaseEnd
rlPhaseStartTest "Should list capabilities of pid 1"
rlRun -s "captree --depth 1 1"
rlAssertGrep 'systemd.*=ep' $rlRun_LOG
rlPhaseEnd
rlPhaseStartTest "Should display sys admin capability"
rlRun -s "capsh --drop=cap_sys_admin -- -c 'captree --verbose \$\$'"
rlAssertGrep "!cap_sys_admin" $rlRun_LOG
rlPhaseEnd
fi
rlJournalEnd