playwright/installation-tests/run_all_tests.sh
Andrey Lushnikov 2c59985bcd
chore: refactor installation tests (#12054)
This patch refactors installation tests. With this
refactoring:

- each test is a separate file
- to run a single test, just run the bash file
  * tests support optional `--no-build` flag to re-use previously
    built packages.
  * tests support optional `--debug` flag to see line-by-line test output
  * failed tests print a line that can be copied-and-pasted locally
    to debug the test
- run all tests with `//installation-tests/run_all_tests.sh`
  * test output is hidden for successful runs when run locally and is
    shown when test fails
  * runs all tests, and reports failed tests in the end
  * command output is split into groups when viewed on Github.
2022-02-11 17:06:37 -08:00

55 lines
942 B
Bash
Executable File

#!/bin/bash
set -e
set +x
trap "cd $(pwd -P)" EXIT
cd "$(dirname $0)"
source ./initialize_test.sh
setup_env_variables
echo "Building packages..."
build_packages
clean_test_root
function gh_echo {
if [[ -z "${GITHUB_ACTIONS}" ]]; then
return
fi
echo "$@"
}
FAILED_TESTS=""
for i in test_*.sh
do
set +e
cecho "YELLOW" "Running - $i..."
OUTPUT=$(bash $i --multitest --no-build 2>&1)
RV=$?
set -e
if [[ "${RV}" != 0 ]]; then
FAILED_TESTS="${FAILED_TESTS}- bash ${PWD}/${i} --debug\n"
gh_echo "::group::FAILED - $i"
cecho "RED" "FAILED - $i"
echo "${OUTPUT}"
gh_echo "::endgroup::"
else
gh_echo "::group::PASSED - $i"
cecho "GREEN" "PASSED - $i"
gh_echo "${OUTPUT}"
gh_echo "::endgroup::"
fi
done
echo
if [[ -n "${FAILED_TESTS}" ]]; then
cecho "RED" "SOME TESTS FAILED! To debug:"
cecho "RED" "${FAILED_TESTS}"
exit 1
else
cecho "GREEN" "All tests passed!"
exit 0
fi