coverity-scan.sh 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. cpus=$(grep ^processor </proc/cpuinfo| wc -l)
  3. [ -z "${cpus}" ] && cpus=1
  4. token=
  5. [ -f .coverity-token ] && token="$(<.coverity-token)"
  6. [ -z "${token}" ] && \
  7. echo >&2 "Save the coverity token to .coverity-token" && \
  8. exit 1
  9. echo >&2 "Coverity token: ${token}"
  10. covbuild="$(which cov-build 2>/dev/null || command -v cov-build 2>/dev/null)"
  11. [ -z "${covbuild}" -a -f .coverity-build ] && covbuild="$(<.coverity-build)"
  12. [ -z "${covbuild}" ] && \
  13. echo "Save command the full filename of cov-build in .coverity-build" && \
  14. exit 1
  15. [ ! -x "${covbuild}" ] && \
  16. echo "The command ${covbuild} is not executable. Save command the full filename of cov-build in .coverity-build" && \
  17. exit 1
  18. version="$(cat config.h | grep "^#define PACKAGE_VERSION" | cut -d '"' -f 2)"
  19. echo >&2 "Working on netdata version: ${version}"
  20. echo >&2 "Cleaning up old builds..."
  21. make clean || exit 1
  22. [ -d "cov-int" ] && \
  23. rm -rf "cov-int"
  24. [ -f netdata-coverity-analysis.tgz ] && \
  25. rm netdata-coverity-analysis.tgz
  26. "${covbuild}" --dir cov-int make -j${cpus} || exit 1
  27. echo >&2 "Compressing data..."
  28. tar czvf netdata-coverity-analysis.tgz cov-int || exit 1
  29. echo >&2 "Sending analysis..."
  30. curl --progress-bar --form token="${token}" \
  31. --form email=costa@tsaousis.gr \
  32. --form file=@netdata-coverity-analysis.tgz \
  33. --form version="${version}" \
  34. --form description="netdata, real-time performance monitoring, done right." \
  35. https://scan.coverity.com/builds?project=firehol%2Fnetdata