mirror of
				https://github.com/ethereum/solidity
				synced 2023-10-03 13:03:40 +00:00 
			
		
		
		
	Merge pull request #10146 from ethereum/stop-after-parsing-script
Fix test/stopAfterParseTests.sh for macos.
This commit is contained in:
		
						commit
						b6f7640801
					
				| @ -1,6 +1,12 @@ | |||||||
| #! /usr/bin/env bash | #!/usr/bin/env bash | ||||||
| 
 | 
 | ||||||
| REPO_ROOT=$(readlink -f "$(dirname "$0")"/..) | set -e | ||||||
|  | 
 | ||||||
|  | READLINK=readlink | ||||||
|  | if [[ "$OSTYPE" == "darwin"* ]]; then | ||||||
|  | 	READLINK=greadlink | ||||||
|  | fi | ||||||
|  | REPO_ROOT=$(${READLINK} -f "$(dirname "$0")"/..) | ||||||
| SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build} | SOLIDITY_BUILD_DIR=${SOLIDITY_BUILD_DIR:-${REPO_ROOT}/build} | ||||||
| SOLC=${SOLIDITY_BUILD_DIR}/solc/solc | SOLC=${SOLIDITY_BUILD_DIR}/solc/solc | ||||||
| SPLITSOURCES=${REPO_ROOT}/scripts/splitSources.py | SPLITSOURCES=${REPO_ROOT}/scripts/splitSources.py | ||||||
| @ -11,15 +17,18 @@ cd "$FILETMP" || exit 1 | |||||||
| 
 | 
 | ||||||
| function testFile() | function testFile() | ||||||
| { | { | ||||||
|  | 	set +e | ||||||
| 	ALLOUTPUT=$($SOLC --combined-json ast,compact-format --pretty-json "$@" --stop-after parsing 2>&1) | 	ALLOUTPUT=$($SOLC --combined-json ast,compact-format --pretty-json "$@" --stop-after parsing 2>&1) | ||||||
| 	if test $? -ne 0; then | 	local RESULT=$? | ||||||
|  | 	set -e | ||||||
|  | 	if test ${RESULT} -ne 0; then | ||||||
| 		# solc returned failure. Compilation errors and unimplemented features | 		# solc returned failure. Compilation errors and unimplemented features | ||||||
| 		# are okay, everything else is a failed test (segfault) | 		# are okay, everything else is a failed test (segfault) | ||||||
| 		if ! echo "$ALLOUTPUT" | grep -e "Unimplemented feature:" -e "Error:" -q; then | 		if ! echo "$ALLOUTPUT" | grep -e "Unimplemented feature:" -e "Error:" -q; then | ||||||
| 			echo -n "Test failed on "; | 			echo -n "Test failed on " | ||||||
| 			echo "$@" | 			echo "$@" | ||||||
| 			echo "$ALLOUTPUT" | 			echo "$ALLOUTPUT" | ||||||
| 			return 1; | 			return 1 | ||||||
| 		fi | 		fi | ||||||
| 	else | 	else | ||||||
| 		echo -n . | 		echo -n . | ||||||
| @ -29,8 +38,10 @@ function testFile() | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| while read -r file; do | while read -r file; do | ||||||
|  | 	set +e | ||||||
| 	OUTPUT=$($SPLITSOURCES "$file") | 	OUTPUT=$($SPLITSOURCES "$file") | ||||||
| 	RETURN_CODE=$? | 	RETURN_CODE=$? | ||||||
|  | 	set -e | ||||||
| 	FAILED=0 | 	FAILED=0 | ||||||
| 
 | 
 | ||||||
| 	if [ $RETURN_CODE -eq 0 ] | 	if [ $RETURN_CODE -eq 0 ] | ||||||
| @ -38,8 +49,7 @@ while read -r file; do | |||||||
| 		# shellcheck disable=SC2086 | 		# shellcheck disable=SC2086 | ||||||
| 		testFile $OUTPUT | 		testFile $OUTPUT | ||||||
| 		FAILED=$? | 		FAILED=$? | ||||||
| 
 | 		rm -r "${FILETMP:?}"/* | ||||||
| 		rm "${FILETMP:?}/"* -r |  | ||||||
| 	elif [ $RETURN_CODE -eq 1 ] | 	elif [ $RETURN_CODE -eq 1 ] | ||||||
| 	then | 	then | ||||||
| 		testFile "$file" | 		testFile "$file" | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user