forked from csutils/csmock
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: add a simple test for the Clang analyzer plugin
Related: csutils#93
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
summary: Basic analysis tests | ||
discover: | ||
how: fmf | ||
execute: | ||
how: tmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
summary: Test analysis using Clang analyzer | ||
test: ./test.sh | ||
framework: beakerlib | ||
environment: | ||
TEST_PACKAGE: units | ||
TEST_TOOL: clang | ||
component: | ||
- csmock-plugin-clang | ||
recommend: | ||
- csmock-plugin-clang | ||
duration: 1h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k | ||
. /usr/share/beakerlib/beakerlib.sh || exit 1 | ||
|
||
TEST_PACKAGE="${TEST_PACKAGE:-}" | ||
TEST_TOOL="${TEST_TOOL:-}" | ||
TEST_USER="csmock" | ||
|
||
rlJournalStart | ||
rlPhaseStartSetup | ||
if [ -z "$TEST_PACKAGE" ]; then | ||
rlDie "TEST_PACKAGE parameter is empty or undefined" | ||
fi | ||
|
||
if [ -z "$TEST_TOOL" ]; then | ||
rlDie "TEST_TOOL parameter is empty or undefined" | ||
fi | ||
|
||
rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory" | ||
rlRun "pushd \$tmp" | ||
|
||
rlRun "yum -y install $TEST_PACKAGE" | ||
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" | ||
|
||
if ! rlGetPhaseState; then | ||
rlDie "'$TEST_PACKAGE' sources could not be fetched" | ||
fi | ||
rlPhaseEnd | ||
|
||
rlPhaseStartTest | ||
rlRun "su - $TEST_USER -c 'csmock -t $TEST_TOOL \"$SRPM\"'" 0 \ | ||
"Analyze $SRPM using $TEST_TOOL analyzer" | ||
rlFileSubmit "$TEST_PACKAGE"-*.tar.xz "$TEST_TOOL-$SRPM" | ||
rlPhaseEnd | ||
|
||
rlPhaseStartCleanup | ||
rlRun "userdel -r $TEST_USER" | ||
rlRun "popd" | ||
rlRun "rm -r \$tmp" 0 "Remove tmp directory" | ||
rlPhaseEnd | ||
rlJournalEnd |