cov.sh 932 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh -l
  2. PATH=$PATH
  3. BIN_PATH="$(swift build --show-bin-path)"
  4. XCTEST_PATH="$(find ${BIN_PATH} -name '*.xctest')"
  5. COV_BIN=$XCTEST_PATH
  6. INSTR_PROFILE=.build/debug/codecov/default.profdata
  7. IGNORE_FILENAME_REGEX=".build|Tests"
  8. FORMAT="lcov"
  9. OUTPUT_FILE=.build/debug/codecov/lcov.info
  10. while :; do
  11. case $1 in
  12. -f|--format) FORMAT=$2
  13. ;;
  14. -o|--output) OUTPUT_FILE=$2
  15. ;;
  16. *) break
  17. esac
  18. shift
  19. done
  20. if [[ "$OSTYPE" == "darwin"* ]]; then
  21. f="$(basename $XCTEST_PATH .xctest)"
  22. COV_BIN="${COV_BIN}/Contents/MacOS/$f"
  23. PATH="/usr/local/opt/llvm/bin:$PATH"​
  24. fi
  25. llvm-cov report \
  26. "${COV_BIN}" \
  27. -instr-profile=$INSTR_PROFILE \
  28. -ignore-filename-regex=$IGNORE_FILENAME_REGEX \
  29. -use-color
  30. llvm-cov export \
  31. "${COV_BIN}" \
  32. -instr-profile=$INSTR_PROFILE \
  33. -ignore-filename-regex=$IGNORE_FILENAME_REGEX \
  34. -format=$FORMAT > $OUTPUT_FILE