From 970381cb1d96f8cc0e7443ff11bdebd35a187525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 17 Sep 2021 20:08:49 +0200 Subject: [PATCH 1/2] splitSources.py: Support the case where the input file is empty --- scripts/splitSources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/splitSources.py b/scripts/splitSources.py index bdd53bf0a..3d1c8ef45 100755 --- a/scripts/splitSources.py +++ b/scripts/splitSources.py @@ -65,7 +65,7 @@ if __name__ == '__main__': # decide if file has multiple sources with open(filePath, mode='r', encoding='utf8', newline='') as f: lines = f.read().splitlines() - if lines[0][:12] == "==== Source:": + if len(lines) >= 1 and lines[0][:12] == "==== Source:": hasMultipleSources = True writeSourceToFile(lines) From 23f7b7781f47672267741922af77c0610abf495a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Fri, 17 Sep 2021 20:54:01 +0200 Subject: [PATCH 2/2] cmdlineTests.sh: Skip empty test directories --- test/cmdlineTests.sh | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index d6c335067..ab0037bd9 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -56,7 +56,8 @@ do *) matching_tests=$(find . -mindepth 1 -maxdepth 1 -type d -name "$1" | cut --characters 3- | sort) - if [[ $matching_tests == "" ]]; then + if [[ $matching_tests == "" ]] + then patterns_with_no_matches+=("$1") printWarning "No tests matching pattern '$1' found." else @@ -69,7 +70,8 @@ do esac done -if (( ${#selected_tests[@]} == 0 && ${#patterns_with_no_matches[@]} == 0 )); then +if (( ${#selected_tests[@]} == 0 && ${#patterns_with_no_matches[@]} == 0 )) +then selected_tests=(*) fi popd > /dev/null @@ -94,7 +96,8 @@ then fi # extend stack size in case we run via ASAN -if [[ -n "${CIRCLECI}" ]] || [[ -n "$CI" ]]; then +if [[ -n "${CIRCLECI}" ]] || [[ -n "$CI" ]] +then ulimit -s 16384 ulimit -a fi @@ -169,7 +172,10 @@ function test_solc_behaviour() # shellcheck disable=SC2064 trap "rm -f $stdout_path $stderr_path" EXIT - if [[ "$exit_code_expected" = "" ]]; then exit_code_expected="0"; fi + if [[ "$exit_code_expected" = "" ]] + then + exit_code_expected="0" + fi [[ $filename == "" ]] || solc_args+=("$filename") @@ -338,19 +344,27 @@ printTask "Running general commandline tests..." cd "$REPO_ROOT"/test/cmdlineTests/ for tdir in "${selected_tests[@]}" do - if ! [[ -d $tdir ]]; then + if ! [[ -d $tdir ]] + then printError "Test directory not found: $tdir" exit 1 fi printTask " - ${tdir}" + if [[ $(ls -A "$tdir") == "" ]] + then + printWarning " ---> skipped (test dir empty)" + continue + fi + # Strip trailing slash from $tdir. tdir=$(basename "${tdir}") if [[ $no_smt == true ]] then - if [[ $tdir =~ .*model_checker_.* ]]; then - printWarning " --- > skipped" + if [[ $tdir =~ .*model_checker_.* ]] + then + printWarning " ---> skipped (SMT test)" continue fi fi