Skip to content

Commit ff28aa6

Browse files
committed
Fix test failure checking
1 parent 9eaa8e2 commit ff28aa6

File tree

5 files changed

+28
-26
lines changed

5 files changed

+28
-26
lines changed

scripts/test_linux.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

34
sudo pip3 install .
45
solc-select install all
@@ -19,14 +20,14 @@ if [[ $use_version != "Switched global version to $latest_release" ]]; then
1920
fi
2021
echo "LINUX SUCCESS: maximum version"
2122

22-
use_version=$(solc-select use 0.3.9 2>&1)
23+
use_version=$(solc-select use 0.3.9 2>&1 || true)
2324
if [[ $use_version != *"Invalid version - only solc versions above '0.4.0' are available"* ]]; then
2425
echo "LINUX FAILED: version too low"
2526
exit 255
2627
fi
2728
echo "LINUX SUCCESS: version too low"
2829

29-
use_version=$(solc-select use 0.100.8 2>&1)
30+
use_version=$(solc-select use 0.100.8 2>&1 || true)
3031
if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then
3132
echo "LINUX FAILED: version too high"
3233
exit 255

scripts/test_macos.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

34
use_version=$(solc-select use 0.3.6)
45
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
1617
fi
1718
echo "OS X SUCCESS: set maximum version"
1819

19-
use_version=$(solc-select use 0.3.5 2>&1)
20+
use_version=$(solc-select use 0.3.5 2>&1 || true)
2021
if [[ $use_version != *"Invalid version - only solc versions above '0.3.6' are available"* ]]; then
2122
echo "OS X FAILED: version too low"
2223
exit 255
2324
fi
2425
echo "OS X SUCCESS: version too low"
2526

26-
use_version=$(solc-select use 0.100.8 2>&1)
27+
use_version=$(solc-select use 0.100.8 2>&1 || true)
2728
if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then
2829
echo "OS X FAILED: version too high"
2930
exit 255

scripts/test_solc.sh

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
14
## solc 0.4.5 ##
25
solc-select use 0.4.5 &> /dev/null
36
solc ./scripts/solidity_tests/solc045_success.sol
@@ -8,7 +11,7 @@ if [[ $? != 0 ]]; then
811
fi
912
echo "SUCCESS: solc045_success"
1013

11-
execute=$(solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1)
14+
execute=$(solc ./scripts/solidity_tests/solc045_fail_compile.sol 2>&1 || true)
1215
if [[ "$execute" != *"Error: Expected token Semicolon got 'Function'"* ]]; then
1316
echo "FAILED: solc045_fail_compile"
1417
echo "$execute"
@@ -26,7 +29,7 @@ if [[ $? != 0 ]]; then
2629
fi
2730
echo "SUCCESS: solc050_success"
2831

29-
execute=$(solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1)
32+
execute=$(solc ./scripts/solidity_tests/solc050_fail_compile.sol 2>&1 || true)
3033
if [[ "$execute" != *"Error: Functions are not allowed to have the same name as the contract."* ]]; then
3134
echo "FAILED: solc050_fail_compile"
3235
exit 255
@@ -35,17 +38,14 @@ echo "SUCCESS: solc050_fail_compile"
3538

3639
## solc 0.6.0 ##
3740
solc-select use 0.6.0 &> /dev/null
38-
solc ./scripts/solidity_tests/solc060_success_trycatch.sol
3941

40-
if [[ $? != 0 ]]; then
42+
if ! solc ./scripts/solidity_tests/solc060_success_trycatch.sol; then
4143
echo "FAILED: solc060_success_trycatch" $?
4244
exit 255
4345
fi
4446
echo "SUCCESS: solc060_success_trycatch"
4547

46-
solc ./scripts/solidity_tests/solc060_success_receive.sol
47-
48-
if [[ $? != 0 ]]; then
48+
if ! solc ./scripts/solidity_tests/solc060_success_receive.sol; then
4949
echo "FAILED: solc060_success_receive" $?
5050
exit 255
5151
fi
@@ -54,39 +54,36 @@ echo "SUCCESS: solc060_success_receive"
5454
## solc 0.7.0 ##
5555
solc-select use 0.7.0 &> /dev/null
5656

57-
execute=$(solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1)
57+
execute=$(solc ./scripts/solidity_tests/solc070_fail_compile.sol 2>&1 || true)
5858
if [[ "$execute" != *"\"now\" has been deprecated."* ]]; then
5959
echo "FAILED: solc070_fail_compile" "$execute"
6060
exit 255
6161
fi
6262
echo "SUCCESS: solc070_fail_compile"
6363

64-
solc ./scripts/solidity_tests/solc070_success.sol
65-
66-
if [[ $? != 0 ]]; then
64+
if ! solc ./scripts/solidity_tests/solc070_success.sol; then
6765
echo "FAILED: solc070_success" $?
6866
exit 255
6967
fi
7068
echo "SUCCESS: solc070_success"
7169

7270
## solc 0.8.0 ##
7371
solc-select use 0.8.0 &> /dev/null
74-
solc ./scripts/solidity_tests/solc080_success.sol
7572

76-
if [[ $? != 0 ]]; then
73+
if ! solc ./scripts/solidity_tests/solc080_success.sol; then
7774
echo "FAILED: solc080_success" $?
7875
exit 255
7976
fi
8077
echo "SUCCESS: solc080_success"
8178

82-
execute=$(solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1)
79+
execute=$(solc ./scripts/solidity_tests/solc080_success_warning.sol 2>&1 || true)
8380
if [[ "$execute" != *"Warning: Function state mutability can be restricted to pure"* ]]; then
8481
echo "FAILED: solc080_success_warning"
8582
exit 255
8683
fi
8784
echo "SUCCESS: solc080_success_warning"
8885

89-
execute=$(solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1)
86+
execute=$(solc ./scripts/solidity_tests/solc080_fail_compile.sol 2>&1 || true)
9087
if [[ "$execute" != *"Error: Explicit type conversion not allowed"* ]]; then
9188
echo "FAILED: solc080_fail_compile"
9289
exit 255
@@ -100,11 +97,11 @@ if [[ "$execute" != *"Switched global version to 0.8.9"* ]]; then
10097
echo "FAILED: use - always install"
10198
exit 255
10299
fi
103-
echo "SUCCESS: use - always install"
100+
echo "SUCCESS: use - always install"
104101

105102
UNINSTALL_PATH=$HOME/.solc-select/artifacts/solc-0.8.1
106103
rm -rf $UNINSTALL_PATH # uninstall solc 0.8.1
107-
execute=$(solc-select use 0.8.1 2>&1)
104+
execute=$(solc-select use 0.8.1 2>&1 || true)
108105
if [[ $execute != *"'0.8.1' must be installed prior to use"* ]]; then
109106
echo "FAILED: use - no install"
110107
exit 255

scripts/test_solc_upgrade.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

34
### Install old version of solc
4-
sudo pip3 uninstall solc-select
5+
sudo pip3 uninstall --yes solc-select
56
sudo pip3 install solc-select
7+
solc-select use 0.8.0 --always-install
68
old_solc_version=$(solc --version)
79
solc-select install 0.4.11 0.5.0 0.6.12 0.7.3 0.8.3
8-
all_old_versions=$(solc-select versions)
10+
all_old_versions=$(solc-select versions | sort)
911

1012
### Install new version of solc
1113
sudo pip3 install -e .
1214
new_solc_version=$(solc --version)
13-
all_new_versions=$(solc-select versions)
15+
all_new_versions=$(solc-select versions | sort)
1416

1517
### halt if solc version is accidentally changed
1618
if [ "$old_solc_version" != "$new_solc_version" ]; then

scripts/test_windows.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#!/usr/bin/env bash
2+
set -euo pipefail
23

34
use_version=$(solc-select use 0.4.5)
45
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
1617
fi
1718
echo "WINDOWS SUCCESS: maximum version"
1819

19-
use_version=$(solc-select use 0.3.9 2>&1)
20+
use_version=$(solc-select use 0.3.9 2>&1 || true)
2021
if [[ $use_version != *"Invalid version - only solc versions above '0.4.5' are available"* ]]; then
2122
echo "WINDOWS FAILED: version too low"
2223
exit 255
2324
fi
2425
echo "WINDOWS SUCCESS: version too low"
2526

26-
use_version=$(solc-select use 0.100.8 2>&1)
27+
use_version=$(solc-select use 0.100.8 2>&1 || true)
2728
if [[ $use_version != *"Invalid version '$latest_release' is the latest available version"* ]]; then
2829
echo "WINDOWS FAILED: version too high"
2930
exit 255

0 commit comments

Comments
 (0)