2
0

scan_build.sh 926 B

123456789101112131415161718192021222324252627
  1. #!/bin/bash
  2. sed -i '/cotire/d' ./CMakeLists.txt
  3. mkdir -p scan-build
  4. scan-build-7 -o ./scan-build/ cmake .
  5. scan-build-7 -o ./scan-build/ cmake .
  6. scan-build-7 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt
  7. exitstatus=${PIPESTATUS[0]}
  8. echo "*** Exit status is $exitstatus";
  9. export SubString="scan-build: No bugs found";
  10. export COMPILATION_FAILED=false;
  11. export BUGS_FOUND=false;
  12. if [ "0" -ne $exitstatus ] ; then
  13. export COMPILATION_FAILED=true;
  14. echo MESSAGE="compilation failed" >> $GITHUB_OUTPUT;
  15. fi
  16. export RESULTFILE="/__w/libks/libks/scan-build-result.txt";
  17. cat $RESULTFILE;
  18. if ! grep -sq "$SubString" $RESULTFILE; then
  19. export BUGS_FOUND=true;
  20. echo MESSAGE="found bugs" >> $GITHUB_OUTPUT;
  21. fi
  22. echo "COMPILATION_FAILED=$COMPILATION_FAILED" >> $GITHUB_OUTPUT;
  23. echo "BUGS_FOUND=$BUGS_FOUND" >> $GITHUB_OUTPUT;
  24. if [ "0" != $exitstatus ] || ! grep -sq "$SubString" $RESULTFILE; then
  25. exit 1;
  26. fi
  27. exit 0;