diff --git a/compiler+runtime/test/bash/test-all b/compiler+runtime/test/bash/test-all deleted file mode 100755 index bdc6b910c..000000000 --- a/compiler+runtime/test/bash/test-all +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -# Pipe the output of `set -x` to a new fd, number 20, and direct that to our -# log file. Also direct stdout (1) and stderr (2) to the log file, but make -# a new fd (3) point to stdout first. This allows us to write to fd 3 and -# have it go to the console, while everything else goes to the log file. -test_log="${PWD}/test.log" -rm -f "${test_log}" -exec 20>"${test_log}" -export BASH_XTRACEFD=20 -exec 3>&1 -exec 1>&20 -exec 2>&20 - -set -xeuo pipefail -# Not POSIX, but useful. -shopt -s inherit_errexit 2>/dev/null || true - -here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -failures=0 - -color_default="$(tput sgr0)" -color_red="$(tput setaf 1)" -color_green="$(tput setaf 2)" - -# Write a log to the console, which is a special fd. -# -# $1 = message -function console_log -{ echo -n -e "${1}" >&3; } - -# $1 => "success" or "failure" -function report_result -{ - if [[ "${1}" == "success" ]]; - then - console_log "${color_green}${1}${color_default}\n" - else - console_log "${color_red}${1}${color_default}\n" - fi -} - -# $1 => Relative test name (either `pass-test` or `fail-test`) -# -# Note: We're already in the directory to run the test. -function run_test -{ - local expected_pass result relative_test_dir - if [[ "${1}" == "pass-test" ]]; - then - expected_pass=true - else - expected_pass=false - fi - - relative_test_dir="$(realpath -s --relative-to="${here}" "${PWD}")" - console_log "testing directory ${relative_test_dir} => " - - set +e - "${PWD}/${1}" - result=${?} - set -e - - if [[ ${result} == 0 ]]; - then - if [[ "${expected_pass}" == "false" ]]; - then - (( ++failures )) - report_result failure - else - report_result success - fi - else - if [[ "${expected_pass}" == "true" ]]; - then - (( ++failures )) - report_result failure - else - report_result success - fi - fi -} - -function main -{ - local test_dir - - while IFS= read -r -d '' file - do - test_dir="$(dirname "${file}")" - pushd "${test_dir}" >/dev/null - run_test "$(basename "${file}")" - popd >/dev/null - done < <(find . -type f -regextype posix-egrep -regex '.*/(pass|fail)-test' -print0 || true) - - exit ${failures} -} -main