forked from signalwire/freeswitch
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scan_build.sh
executable file
·28 lines (28 loc) · 1010 Bytes
/
scan_build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
mkdir -p scan-build
scan-build-14 --force-analyze-debug-code -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt
exitstatus=${PIPESTATUS[0]}
echo "*** Exit status is $exitstatus"
export SubString="scan-build: No bugs found"
export COMPILATION_FAILED="false"
export BUGS_FOUND="false"
if [[ "0" != "$exitstatus" ]] ; then
export COMPILATION_FAILED="true"
echo MESSAGE="compilation failed" >> $GITHUB_OUTPUT
fi
export RESULTFILE="$PWD/scan-build-result.txt"
# cat $RESULTFILE
if ! grep -sq "$SubString" $RESULTFILE; then
export BUGS_FOUND="true"
echo MESSAGE="found bugs" >> $GITHUB_OUTPUT
fi
export REPORT=$PWD/`find scan-build* -mindepth 1 -type d`
echo "COMPILATION_FAILED: $COMPILATION_FAILED"
echo "BUGS_FOUND: $BUGS_FOUND"
echo "COMPILATION_FAILED=$COMPILATION_FAILED" >> $GITHUB_OUTPUT
echo "BUGS_FOUND=$BUGS_FOUND" >> $GITHUB_OUTPUT
echo "REPORT=$REPORT" >> $GITHUB_OUTPUT
if [[ "0" != "$exitstatus" ]] || ! grep -sq "$SubString" $RESULTFILE; then
exit 1
fi
exit 0