cmdlineTests: Add prefixes for temporary files/dirs

This commit is contained in:
Kamil Śliwak 2023-06-01 18:51:42 +02:00
parent 5c5f8e8dad
commit f397b9a083
9 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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

View File

@ -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/

View File

@ -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

View File

@ -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"

View File

@ -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/

View File

@ -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"

View File

@ -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"

View File

@ -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