coverity-scan.sh 1.5 KB

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