Skip to content

Commit

Permalink
Fix test failure checking
Browse files Browse the repository at this point in the history
  • Loading branch information
elopez committed Dec 31, 2024
1 parent 9eaa8e2 commit ff28aa6
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 26 deletions.
5 changes: 3 additions & 2 deletions scripts/test_linux.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env bash
set -euo pipefail

sudo pip3 install .
solc-select install all
Expand 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
Expand Down
5 changes: 3 additions & 2 deletions scripts/test_macos.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
31 changes: 14 additions & 17 deletions scripts/test_solc.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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
Expand All @@ -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
Expand All @@ -54,39 +54,36 @@ 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
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
Expand All @@ -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
Expand Down
8 changes: 5 additions & 3 deletions scripts/test_solc_upgrade.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions scripts/test_windows.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down

0 comments on commit ff28aa6

Please sign in to comment.