#!/bin/sh

set -eu

# Optional arguments are 'list' to lists the tests, or the test name (base name
# ie test_evp, not 03_test_evp.t). Without any arguments we run all tests.

if test $# -gt 0; then
    TESTS=$*
else
    # Skip test_symbol_presence as this is for developers.
    # Skip test_quic_multistream as it has a 60s internal timeout per
    # operation that is too tight under QEMU emulation on loaded hosts,
    # causing intermittent failures (upstream: https://github.com/openssl/openssl/issues/27104)
    TESTS="alltests -test_symbol_presence -test_quic_multistream"
fi

export TOP=.
# Run four jobs in parallel
export HARNESS_JOBS=4

{ perl ./test/run_tests.pl $TESTS || echo "FAIL: openssl" ; } | sed -u -r -e '/(.*) \.*.ok/ s/^/PASS: /g' -r -e '/Dubious(.*)/ s/^/FAIL: /g' -e '/(.*) \.*.skipped: (.*)/ s/^/SKIP: /g'
