cmdlineTests: Remove unnecessary subshells

- Whitespace-only change, separated out to make it easy to diff.
This commit is contained in:
Kamil Śliwak 2023-06-01 18:44:23 +02:00
parent 6b061ba696
commit c1df8ed563
11 changed files with 161 additions and 162 deletions

View File

@ -25,7 +25,6 @@ function test_solc_assembly_output
}
printTask "Testing assemble, yul, strict-assembly and optimize..."
(
echo '{}' | msg_on_error --silent "$SOLC" - --assemble
echo '{}' | msg_on_error --silent "$SOLC" - --yul
echo '{}' | msg_on_error --silent "$SOLC" - --strict-assembly
@ -43,4 +42,3 @@ printTask "Testing assemble, yul, strict-assembly and optimize..."
test_solc_assembly_output "{ let t:bool := not(true) }" "{ let t:bool := not(true) }" "--yul"
test_solc_assembly_output "{ let x := 0 }" "{ let x := 0 }" "--strict-assembly"
test_solc_assembly_output "{ let x := 0 }" "{ { } }" "--strict-assembly --optimize"
)

View File

@ -6,12 +6,10 @@ source "${REPO_ROOT}/scripts/common.sh"
printTask "Testing AST import/export..."
SOLTMPDIR=$(mktemp -d)
(
cd "$SOLTMPDIR"
if ! "$REPO_ROOT/scripts/ASTImportTest.sh" ast
then
rm -r "$SOLTMPDIR"
fail
fi
)
rm -r "$SOLTMPDIR"

View File

@ -7,7 +7,6 @@ source "${REPO_ROOT}/scripts/common.sh"
source "${REPO_ROOT}/scripts/common_cmdline.sh"
printTask "Compiling various other contracts and libraries..."
(
cd "$REPO_ROOT"/test/compilationTests/
for dir in */
do
@ -17,4 +16,3 @@ printTask "Compiling various other contracts and libraries..."
compileFull --expect-warnings $(find . -name '*.sol')
cd ..
done
)

View File

@ -8,10 +8,12 @@ source "${REPO_ROOT}/scripts/common_cmdline.sh"
printTask "Compiling all examples from the documentation..."
SOLTMPDIR=$(mktemp -d)
(
set -e
cd "$SOLTMPDIR"
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/
developmentVersion=$("$REPO_ROOT/scripts/get_version.sh")
for f in *.yul *.sol
@ -46,6 +48,5 @@ SOLTMPDIR=$(mktemp -d)
sed -i.bak -E -e 's/pragma[[:space:]]+solidity[[:space:]]*(\^|>=)[[:space:]]*'"$developmentVersion"'/pragma solidity >0.0.1/' "$f"
compileFull "${opts[@]}" "$SOLTMPDIR/$f"
done
)
rm -r "$SOLTMPDIR"
echo "Done."

View File

@ -6,17 +6,21 @@ source "${REPO_ROOT}/scripts/common.sh"
printTask "Testing linking itself..."
SOLTMPDIR=$(mktemp -d)
(
cd "$SOLTMPDIR"
echo 'library L { function f() public pure {} } contract C { function f() public pure { L.f(); } }' > x.sol
msg_on_error --no-stderr "$SOLC" --bin -o . x.sol
# Explanation and placeholder should be there
grep -q '//' C.bin && grep -q '__' C.bin
# But not in library file.
grep -q -v '[/_]' L.bin
# Now link
msg_on_error "$SOLC" --link --libraries x.sol:L=0x90f20564390eAe531E810af625A22f51385Cd222 C.bin
# Now the placeholder and explanation should be gone.
grep -q -v '[/_]' C.bin
)
rm -r "$SOLTMPDIR"

View File

@ -6,13 +6,15 @@ source "${REPO_ROOT}/scripts/common.sh"
printTask "Testing overwriting files..."
SOLTMPDIR=$(mktemp -d)
(
# First time it works
echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create"
# Second time it fails
echo 'contract C {}' | "$SOLC" - --bin -o "$SOLTMPDIR/non-existing-stuff-to-create" 2>/dev/null && \
fail "solc did not refuse to overwrite $SOLTMPDIR/non-existing-stuff-to-create."
# Unless we force
echo 'contract C {}' | msg_on_error --no-stderr "$SOLC" - --overwrite --bin -o "$SOLTMPDIR/non-existing-stuff-to-create"
)
rm -r "$SOLTMPDIR"

View File

@ -6,13 +6,14 @@ source "${REPO_ROOT}/scripts/common.sh"
printTask "Testing soljson via the fuzzer..."
SOLTMPDIR=$(mktemp -d)
(
set -e
cd "$SOLTMPDIR"
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/test/
"$REPO_ROOT"/scripts/isolate_tests.py "$REPO_ROOT"/docs/
echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --quiet --input-files
echo ./*.sol | xargs -P 4 -n 50 "${SOLIDITY_BUILD_DIR}/test/tools/solfuzzer" --without-optimizer --quiet --input-files
)
rm -r "$SOLTMPDIR"

View File

@ -6,7 +6,6 @@ source "${REPO_ROOT}/scripts/common.sh"
printTask "Testing standard input..."
SOLTMPDIR=$(mktemp -d)
(
set +e
output=$("$SOLC" --bin 2>&1)
result=$?
@ -27,5 +26,4 @@ SOLTMPDIR=$(mktemp -d)
# This should not fail
echo '' | msg_on_error --silent --msg "Incorrect response to --ast-compact-json option with empty stdin" \
"$SOLC" --ast-compact-json -
)
rm -r "$SOLTMPDIR"

View File

@ -5,7 +5,6 @@ set -euo pipefail
source "${REPO_ROOT}/scripts/common.sh"
printTask "Testing unknown options..."
(
set +e
output=$("$SOLC" --allow=test 2>&1)
failed=$?
@ -17,4 +16,3 @@ printTask "Testing unknown options..."
else
fail "Incorrect response to unknown options: $output"
fi
)

View File

@ -6,8 +6,11 @@ source "${REPO_ROOT}/scripts/common.sh"
SOLTMPDIR=$(mktemp -d)
printTask "Checking that the bug list is up to date..."
cp "${REPO_ROOT}/docs/bugs_by_version.json" "${SOLTMPDIR}/original_bugs_by_version.json"
"${REPO_ROOT}/scripts/update_bugs_by_version.py"
diff --unified "${SOLTMPDIR}/original_bugs_by_version.json" "${REPO_ROOT}/docs/bugs_by_version.json" || \
fail "The bug list in bugs_by_version.json was out of date and has been updated. Please investigate and submit a bugfix if necessary."
rm -r "$SOLTMPDIR"

View File

@ -66,7 +66,6 @@ function test_via_ir_equivalence()
}
printTask "Testing the eqivalence of --via-ir and a two-stage compilation..."
(
externalContracts=(
externalTests/solc-js/DAO/TokenCreation.sol
libsolidity/semanticTests/externalContracts/_prbmath/PRBMathSD59x18.sol
@ -95,4 +94,3 @@ printTask "Testing the eqivalence of --via-ir and a two-stage compilation..."
printTask " - ${contractFile} (optimized)"
test_via_ir_equivalence "${REPO_ROOT}/test/${contractFile}" --optimize
done
)