runtests.sh 675 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/bash
  2. # Copyright The OpenTelemetry Authors
  3. # SPDX-License-Identifier: Apache-2.0
  4. set -e
  5. GOJUNITREPORTCMD=${GOJUNIT:-go-junit-report}
  6. TESTS_DIR=${TESTS_DIR:-tests}
  7. cd ${TESTS_DIR}
  8. SED="sed"
  9. PASS_COLOR=$(printf "\033[32mPASS\033[0m")
  10. FAIL_COLOR=$(printf "\033[31mFAIL\033[0m")
  11. TEST_COLORIZE="${SED} 's/PASS/${PASS_COLOR}/' | ${SED} 's/FAIL/${FAIL_COLOR}/'"
  12. mkdir -p results/junit
  13. RUN_TESTBED=1 go test -v ${TEST_ARGS} 2>&1 | tee results/testoutput.log | bash -c "${TEST_COLORIZE}"
  14. testStatus=${PIPESTATUS[0]}
  15. ${GOJUNITREPORTCMD} < results/testoutput.log > results/junit/results.xml
  16. bash -c "cat results/TESTRESULTS.md | ${TEST_COLORIZE}"
  17. exit ${testStatus}