diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index fb346f71d..0731fc5b2 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -174,8 +174,8 @@ function test_solc_behaviour local stderr_expected="${7}" local stdout_expectation_file="${8}" # the file to write to when user chooses to update stdout expectation local stderr_expectation_file="${9}" # the file to write to when user chooses to update stderr expectation - local stdout_path; stdout_path=$(mktemp) - local stderr_path; stderr_path=$(mktemp) + local stdout_path; stdout_path=$(mktemp -t "cmdline-test-stdout-XXXXXX") + local stderr_path; stderr_path=$(mktemp -t "cmdline-test-stderr-XXXXXX") # shellcheck disable=SC2064 trap "rm -f $stdout_path $stderr_path" EXIT diff --git a/test/cmdlineTests/~ast_import_export/test.sh b/test/cmdlineTests/~ast_import_export/test.sh index d85d55b96..ff3ab8811 100755 --- a/test/cmdlineTests/~ast_import_export/test.sh +++ b/test/cmdlineTests/~ast_import_export/test.sh @@ -4,7 +4,7 @@ set -euo pipefail # shellcheck source=scripts/common.sh source "${REPO_ROOT}/scripts/common.sh" -SOLTMPDIR=$(mktemp -d) +SOLTMPDIR=$(mktemp -d -t "cmdline-test-ast-import-export-XXXXXX") cd "$SOLTMPDIR" if ! "$REPO_ROOT/scripts/ASTImportTest.sh" ast then diff --git a/test/cmdlineTests/~documentation_examples/test.sh b/test/cmdlineTests/~documentation_examples/test.sh index 7d7b7fa7d..1acf5e8a7 100755 --- a/test/cmdlineTests/~documentation_examples/test.sh +++ b/test/cmdlineTests/~documentation_examples/test.sh @@ -6,7 +6,7 @@ source "${REPO_ROOT}/scripts/common.sh" # shellcheck source=scripts/common_cmdline.sh source "${REPO_ROOT}/scripts/common_cmdline.sh" -SOLTMPDIR=$(mktemp -d) +SOLTMPDIR=$(mktemp -d -t "cmdline-test-docs-examples-XXXXXX") cd "$SOLTMPDIR" "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/ diff --git a/test/cmdlineTests/~linking/test.sh b/test/cmdlineTests/~linking/test.sh index a87dccdcc..ad7d9e173 100755 --- a/test/cmdlineTests/~linking/test.sh +++ b/test/cmdlineTests/~linking/test.sh @@ -4,7 +4,7 @@ set -euo pipefail # shellcheck source=scripts/common.sh source "${REPO_ROOT}/scripts/common.sh" -SOLTMPDIR=$(mktemp -d) +SOLTMPDIR=$(mktemp -d -t "cmdline-test-linking-XXXXXX") cd "$SOLTMPDIR" echo 'library L { function f() public pure {} } contract C { function f() public pure { L.f(); } }' > x.sol diff --git a/test/cmdlineTests/~overwriting_files/test.sh b/test/cmdlineTests/~overwriting_files/test.sh index 0fba60e06..acb8a7aca 100755 --- a/test/cmdlineTests/~overwriting_files/test.sh +++ b/test/cmdlineTests/~overwriting_files/test.sh @@ -4,7 +4,7 @@ set -euo pipefail # shellcheck source=scripts/common.sh source "${REPO_ROOT}/scripts/common.sh" -SOLTMPDIR=$(mktemp -d) +SOLTMPDIR=$(mktemp -d -t "cmdline-test-overwriting-files-XXXXXX") # First time it works echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" diff --git a/test/cmdlineTests/~soljson_via_fuzzer/test.sh b/test/cmdlineTests/~soljson_via_fuzzer/test.sh index 42410947f..2d2312fd1 100755 --- a/test/cmdlineTests/~soljson_via_fuzzer/test.sh +++ b/test/cmdlineTests/~soljson_via_fuzzer/test.sh @@ -4,7 +4,7 @@ set -euo pipefail # shellcheck source=scripts/common.sh source "${REPO_ROOT}/scripts/common.sh" -SOLTMPDIR=$(mktemp -d) +SOLTMPDIR=$(mktemp -d -t "cmdline-test-soljson-via-fuzzer-XXXXXX") cd "$SOLTMPDIR" "$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/ diff --git a/test/cmdlineTests/~update_bugs_by_version/test.sh b/test/cmdlineTests/~update_bugs_by_version/test.sh index 9d07f4c17..6ec1d069b 100755 --- a/test/cmdlineTests/~update_bugs_by_version/test.sh +++ b/test/cmdlineTests/~update_bugs_by_version/test.sh @@ -4,7 +4,7 @@ set -euo pipefail # shellcheck source=scripts/common.sh source "${REPO_ROOT}/scripts/common.sh" -SOLTMPDIR=$(mktemp -d) +SOLTMPDIR=$(mktemp -d -t "cmdline-test-update-bugs-by-version-XXXXXX") cp "${REPO_ROOT}/docs/bugs_by_version.json" "${SOLTMPDIR}/original_bugs_by_version.json" "${REPO_ROOT}/scripts/update_bugs_by_version.py" diff --git a/test/cmdlineTests/~via_ir_equivalence/test.sh b/test/cmdlineTests/~via_ir_equivalence/test.sh index 24c784bb8..4da72d151 100755 --- a/test/cmdlineTests/~via_ir_equivalence/test.sh +++ b/test/cmdlineTests/~via_ir_equivalence/test.sh @@ -6,9 +6,6 @@ source "${REPO_ROOT}/scripts/common.sh" function test_via_ir_equivalence() { - SOLTMPDIR=$(mktemp -d) - pushd "$SOLTMPDIR" > /dev/null - (( $# <= 2 )) || fail "This function accepts at most two arguments." local solidity_file="$1" local optimize_flag="$2" @@ -17,6 +14,9 @@ function test_via_ir_equivalence() local output_file_prefix output_file_prefix=$(basename "$solidity_file" .sol) + SOLTMPDIR=$(mktemp -d -t "cmdline-test-via-ir-equivalence-${output_file_prefix}-XXXXXX") + pushd "$SOLTMPDIR" > /dev/null + local optimizer_flags=() [[ $optimize_flag == "" ]] || optimizer_flags+=("$optimize_flag") [[ $optimize_flag == "" ]] || output_file_prefix+="_optimize" diff --git a/test/stopAfterParseTests.sh b/test/stopAfterParseTests.sh index 503c43579..7d74704c5 100755 --- a/test/stopAfterParseTests.sh +++ b/test/stopAfterParseTests.sh @@ -11,7 +11,7 @@ SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build} SOLC=${SOLIDITY_BUILD_DIR}/solc/solc SPLITSOURCES=${REPO_ROOT}/scripts/splitSources.py -FILETMP=$(mktemp -d) +FILETMP=$(mktemp -d -t "stop-after-parse-tests-XXXXXX") cd "$FILETMP" || exit 1