Skip to content

Commit

Permalink
tests: add a simple test for the Clang analyzer plugin
Browse files Browse the repository at this point in the history
Related: csutils#93
  • Loading branch information
lzaoral committed Feb 22, 2023
1 parent eda1cf9 commit d7a56ae
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
5 changes: 5 additions & 0 deletions plans/example.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
summary: Basic analysis tests
discover:
how: fmf
execute:
how: tmt
9 changes: 9 additions & 0 deletions tests/clang/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
summary: Test analysis using Clang analyzer
test: ./test.sh
framework: beakerlib
component:
- csmock
recommend:
- csmock
- csmock-plugin-clang
duration: 1h
34 changes: 34 additions & 0 deletions tests/clang/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/bash
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
. /usr/share/beakerlib/beakerlib.sh || exit 1

PACKAGES="csmock csmock-plugin-clang"

TEST_PACKAGE="csrap"
TEST_USER="csmock"

rlJournalStart
rlPhaseStartSetup
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
rlRun "pushd \$tmp"

rlRun "dnf -y update $TEST_PACKAGE" 0-255
rlRun "rlFetchSrcForInstalled $TEST_PACKAGE"
rlRun "SRPM=\$(find . -name '$TEST_PACKAGE-*.src.rpm')"

rlRun "userdel -r $TEST_USER" 0,6
rlRun "useradd -m -d /home/$TEST_USER -G mock $TEST_USER"
rlRun "cp $SRPM /home/$TEST_USER"
rlPhaseEnd

rlPhaseStartTest
rlRun "su - $TEST_USER -c 'csmock -t clang \"$SRPM\"'" 0 \
"Analyze $SRPM using Clang analyzer"
rlPhaseEnd

rlPhaseStartCleanup
rlRun "userdel -r $TEST_USER"
rlRun "popd"
rlRun "rm -r \$tmp" 0 "Remove tmp directory"
rlPhaseEnd
rlJournalEnd

0 comments on commit d7a56ae

Please sign in to comment.