diff --git a/scripts/test_linux.sh b/scripts/test_linux.sh index 85e2999..6564bf1 100644 --- a/scripts/test_linux.sh +++ b/scripts/test_linux.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail sudo pip3 install . solc-select install all @@ -19,14 +20,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then fi echo "LINUX SUCCESS: maximum version" -use_version=$(solc-select use 0.3.9 2>&1) +use_version=$(solc-select use 0.3.9 2>&1 || true) if [[ $use_version != *"Invalid version - only solc versions above '0.4.0' are available"* ]]; then echo "LINUX FAILED: version too low" exit 255 fi echo "LINUX SUCCESS: version too low" -use_version=$(solc-select use 0.100.8 2>&1) +use_version=$(solc-select use 0.100.8 2>&1 || true) if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then echo "LINUX FAILED: version too high" exit 255 diff --git a/scripts/test_macos.sh b/scripts/test_macos.sh index e1ad95b..232605e 100644 --- a/scripts/test_macos.sh +++ b/scripts/test_macos.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail use_version=$(solc-select use 0.3.6) if [[ $use_version != "Switched global version to 0.3.6"* ]]; then @@ -16,14 +17,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then fi echo "OS X SUCCESS: set maximum version" -use_version=$(solc-select use 0.3.5 2>&1) +use_version=$(solc-select use 0.3.5 2>&1 || true) if [[ $use_version != *"Invalid version - only solc versions above '0.3.6' are available"* ]]; then echo "OS X FAILED: version too low" exit 255 fi echo "OS X SUCCESS: version too low" -use_version=$(solc-select use 0.100.8 2>&1) +use_version=$(solc-select use 0.100.8 2>&1 || true) if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then echo "OS X FAILED: version too high" exit 255 diff --git a/scripts/test_solc.sh b/scripts/test_solc.sh index 3b1f6c8..db20a04 100644 --- a/scripts/test_solc.sh +++ b/scripts/test_solc.sh @@ -1,3 +1,6 @@ +#!/usr/bin/env bash +set -euo pipefail + ## solc 0.4.5 ## solc-select use 0.4.5 &> /dev/null solc ./scripts/solidity_tests/solc045_success.sol @@ -8,7 +11,7 @@ if [[ $? != 0 ]]; then fi echo "SUCCESS: solc045_success" -execute=$(solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1) +execute=$(solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1 || true) if [[ "$execute" != *"Error: Expected token Semicolon got 'Function'"* ]]; then echo "FAILED: solc045_fail_compile" echo "$execute" @@ -26,7 +29,7 @@ if [[ $? != 0 ]]; then fi echo "SUCCESS: solc050_success" -execute=$(solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1) +execute=$(solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1 || true) if [[ "$execute" != *"Error: Functions are not allowed to have the same name as the contract."* ]]; then echo "FAILED: solc050_fail_compile" exit 255 @@ -35,17 +38,14 @@ echo "SUCCESS: solc050_fail_compile" ## solc 0.6.0 ## solc-select use 0.6.0 &> /dev/null -solc ./scripts/solidity_tests/solc060_success_trycatch.sol -if [[ $? != 0 ]]; then +if ! solc ./scripts/solidity_tests/solc060_success_trycatch.sol; then echo "FAILED: solc060_success_trycatch" $? exit 255 fi echo "SUCCESS: solc060_success_trycatch" -solc ./scripts/solidity_tests/solc060_success_receive.sol - -if [[ $? != 0 ]]; then +if ! solc ./scripts/solidity_tests/solc060_success_receive.sol; then echo "FAILED: solc060_success_receive" $? exit 255 fi @@ -54,16 +54,14 @@ echo "SUCCESS: solc060_success_receive" ## solc 0.7.0 ## solc-select use 0.7.0 &> /dev/null -execute=$(solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1) +execute=$(solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1 || true) if [[ "$execute" != *"\"now\" has been deprecated."* ]]; then echo "FAILED: solc070_fail_compile" "$execute" exit 255 fi echo "SUCCESS: solc070_fail_compile" -solc ./scripts/solidity_tests/solc070_success.sol - -if [[ $? != 0 ]]; then +if ! solc ./scripts/solidity_tests/solc070_success.sol; then echo "FAILED: solc070_success" $? exit 255 fi @@ -71,22 +69,21 @@ echo "SUCCESS: solc070_success" ## solc 0.8.0 ## solc-select use 0.8.0 &> /dev/null -solc ./scripts/solidity_tests/solc080_success.sol -if [[ $? != 0 ]]; then +if ! solc ./scripts/solidity_tests/solc080_success.sol; then echo "FAILED: solc080_success" $? exit 255 fi echo "SUCCESS: solc080_success" -execute=$(solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1) +execute=$(solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1 || true) if [[ "$execute" != *"Warning: Function state mutability can be restricted to pure"* ]]; then echo "FAILED: solc080_success_warning" exit 255 fi echo "SUCCESS: solc080_success_warning" -execute=$(solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1) +execute=$(solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1 || true) if [[ "$execute" != *"Error: Explicit type conversion not allowed"* ]]; then echo "FAILED: solc080_fail_compile" exit 255 @@ -100,11 +97,11 @@ if [[ "$execute" != *"Switched global version to 0.8.9"* ]]; then echo "FAILED: use - always install" exit 255 fi -echo "SUCCESS: use - always install" +echo "SUCCESS: use - always install" UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.1 rm -rf $UNINSTALL_PATH # uninstall solc 0.8.1 -execute=$(solc-select use 0.8.1 2>&1) +execute=$(solc-select use 0.8.1 2>&1 || true) if [[ $execute != *"'0.8.1' must be installed prior to use"* ]]; then echo "FAILED: use - no install" exit 255 diff --git a/scripts/test_solc_upgrade.sh b/scripts/test_solc_upgrade.sh index 7eac93e..de504d0 100644 --- a/scripts/test_solc_upgrade.sh +++ b/scripts/test_solc_upgrade.sh @@ -1,16 +1,18 @@ #!/usr/bin/env bash +set -euo pipefail ### Install old version of solc -sudo pip3 uninstall solc-select +sudo pip3 uninstall --yes solc-select sudo pip3 install solc-select +solc-select use 0.8.0 --always-install old_solc_version=$(solc --version) solc-select install 0.4.11 0.5.0 0.6.12 0.7.3 0.8.3 -all_old_versions=$(solc-select versions) +all_old_versions=$(solc-select versions | sort) ### Install new version of solc sudo pip3 install -e . new_solc_version=$(solc --version) -all_new_versions=$(solc-select versions) +all_new_versions=$(solc-select versions | sort) ### halt if solc version is accidentally changed if [ "$old_solc_version" != "$new_solc_version" ]; then diff --git a/scripts/test_windows.sh b/scripts/test_windows.sh index df24b12..acc284b 100644 --- a/scripts/test_windows.sh +++ b/scripts/test_windows.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -euo pipefail use_version=$(solc-select use 0.4.5) if [[ $use_version != "Switched global version to 0.4.5"* ]]; then @@ -16,14 +17,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then fi echo "WINDOWS SUCCESS: maximum version" -use_version=$(solc-select use 0.3.9 2>&1) +use_version=$(solc-select use 0.3.9 2>&1 || true) if [[ $use_version != *"Invalid version - only solc versions above '0.4.5' are available"* ]]; then echo "WINDOWS FAILED: version too low" exit 255 fi echo "WINDOWS SUCCESS: version too low" -use_version=$(solc-select use 0.100.8 2>&1) +use_version=$(solc-select use 0.100.8 2>&1 || true) if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then echo "WINDOWS FAILED: version too high" exit 255