diff options
author | chriseth <chris@ethereum.org> | 2018-05-14 23:37:38 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2018-05-17 00:32:44 +0800 |
commit | 970567826905c953134e54c64f129e31b3fc6a05 (patch) | |
tree | 4c0a1a1bd6e9c88a6a6f64ef077000af3abd9dbd /test | |
parent | 67ec76f4625bdf5e2777416c07a3e7d89d12bf16 (diff) | |
parent | db5ea8ec0325512af3238918ca0ea297488a5c5d (diff) | |
download | dexon-solidity-970567826905c953134e54c64f129e31b3fc6a05.tar.gz dexon-solidity-970567826905c953134e54c64f129e31b3fc6a05.tar.zst dexon-solidity-970567826905c953134e54c64f129e31b3fc6a05.zip |
Merge pull request #3987 from ethereum/solc_remove_stdin
BREAKING Solc: read from stdin only if "-" is explicitly given
Diffstat (limited to 'test')
-rwxr-xr-x | test/cmdlineTests.sh | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/test/cmdlineTests.sh b/test/cmdlineTests.sh index 1137c7b0..74b6a5a7 100755 --- a/test/cmdlineTests.sh +++ b/test/cmdlineTests.sh @@ -139,25 +139,55 @@ rm -rf "$TMPDIR" echo "Done." printTask "Testing library checksum..." -echo '' | "$SOLC" --link --libraries a:0x90f20564390eAe531E810af625A22f51385Cd222 -! echo '' | "$SOLC" --link --libraries a:0x80f20564390eAe531E810af625A22f51385Cd222 2>/dev/null +echo '' | "$SOLC" - --link --libraries a:0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null +! echo '' | "$SOLC" - --link --libraries a:0x80f20564390eAe531E810af625A22f51385Cd222 &>/dev/null printTask "Testing long library names..." -echo '' | "$SOLC" --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname:0x90f20564390eAe531E810af625A22f51385Cd222 +echo '' | "$SOLC" - --link --libraries aveeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeerylonglibraryname:0x90f20564390eAe531E810af625A22f51385Cd222 >/dev/null -printTask "Testing overwriting files" +printTask "Testing overwriting files..." TMPDIR=$(mktemp -d) ( set -e # First time it works - echo 'contract C {} ' | "$SOLC" --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null + echo 'contract C {} ' | "$SOLC" - --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null # Second time it fails - ! echo 'contract C {} ' | "$SOLC" --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null + ! echo 'contract C {} ' | "$SOLC" - --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null # Unless we force - echo 'contract C {} ' | "$SOLC" --overwrite --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null + echo 'contract C {} ' | "$SOLC" - --overwrite --bin -o "$TMPDIR/non-existing-stuff-to-create" 2>/dev/null ) rm -rf "$TMPDIR" +printTask "Testing assemble, yul, strict-assembly..." +echo '{}' | "$SOLC" - --assemble &>/dev/null +echo '{}' | "$SOLC" - --julia &>/dev/null +echo '{}' | "$SOLC" - --strict-assembly &>/dev/null + +printTask "Testing standard input..." +TMPDIR=$(mktemp -d) +( + set +e + output=$("$SOLC" --bin 2>&1) + result=$? + set -e + + # This should fail + if [[ !("$output" =~ "No input files given") || ($result == 0) ]] ; then + printError "Incorrect response to empty input arg list: $STDERR" + exit 1 + fi + + set +e + output=$(echo 'contract C {} ' | "$SOLC" - --bin 2>/dev/null | grep -q "<stdin>:C") + result=$? + set -e + + # The contract should be compiled + if [[ "$result" != 0 ]] ; then + exit 1 + fi +) + printTask "Testing soljson via the fuzzer..." TMPDIR=$(mktemp -d) ( |