make-test 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. set -eo pipefail
  3. cleanup() {
  4. # Remove if nothing was generated.
  5. [ -d artifacts ] && find artifacts -type d -empty -delete
  6. }
  7. trap cleanup EXIT
  8. # Make a central directory to store all output artifacts of our test run to
  9. # avoid having to configure multiple upload-artifacts steps in the workflow
  10. # file.
  11. OSSL_CI_ARTIFACTS_PATH="artifacts/"
  12. if [ -n "${GITHUB_RUN_NUMBER}" ]; then
  13. OSSL_CI_ARTIFACTS_PATH="artifacts/github-${GITHUB_JOB}-${GITHUB_RUN_NUMBER}-${GITHUB_RUN_ID}/"
  14. fi
  15. mkdir -p "$OSSL_CI_ARTIFACTS_PATH"
  16. export OSSL_CI_ARTIFACTS_PATH="$(cd "$OSSL_CI_ARTIFACTS_PATH"; pwd)"
  17. # Run the tests. This might fail, but we need to capture artifacts anyway.
  18. set +e
  19. make test HARNESS_JOBS=${HARNESS_JOBS:-4} "$@"
  20. RESULT=$?
  21. set -e
  22. # Move an interesting subset of the test-runs data we want into the artifacts
  23. # staging directory.
  24. for test_name in quic_multistream; do
  25. if [ -d "test-runs/test_${test_name}" ]; then
  26. mv "test-runs/test_${test_name}" "$OSSL_CI_ARTIFACTS_PATH/"
  27. fi
  28. done
  29. # Log the artifact tree.
  30. echo "::group::List of artifact files generated"
  31. echo "Test suite exited with $RESULT, artifacts path is $OSSL_CI_ARTIFACTS_PATH"
  32. (cd "$OSSL_CI_ARTIFACTS_PATH"; find . -type f | sort)
  33. echo "::endgroup::"
  34. echo "Archive artifacts"
  35. tar -czvf artifacts.tar.gz $OSSL_CI_ARTIFACTS_PATH
  36. exit $RESULT