mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Move common.sh from test/externalTests to scripts/externalTests
This commit is contained in:
parent
778d6f4b26
commit
28a959295b
@ -1,34 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
def run_cmd(command: str, env: dict = None, logfile: str = None) -> int:
|
|
||||||
"""
|
|
||||||
Args:
|
|
||||||
command: command to run
|
|
||||||
logfile: log file name
|
|
||||||
env: dictionary holding key-value pairs for bash environment variables
|
|
||||||
Returns:
|
|
||||||
int: The exit status of the command. Exit status codes are:
|
|
||||||
0 -> Success
|
|
||||||
1-255 -> Failure
|
|
||||||
"""
|
|
||||||
if logfile is None:
|
|
||||||
logfile = os.devnull
|
|
||||||
if env is None:
|
|
||||||
env = os.environ.copy()
|
|
||||||
with open(
|
|
||||||
file=logfile,
|
|
||||||
mode='w',
|
|
||||||
encoding='utf8'
|
|
||||||
) as log:
|
|
||||||
ret = subprocess.run(
|
|
||||||
command,
|
|
||||||
shell=True,
|
|
||||||
check=True,
|
|
||||||
executable='/bin/bash',
|
|
||||||
env=env,
|
|
||||||
stdout=log if not logfile else None,
|
|
||||||
stderr=None
|
|
||||||
)
|
|
||||||
return ret.returncode
|
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
SOLJSON="$1"
|
SOLJSON="$1"
|
||||||
VERSION="$2"
|
VERSION="$2"
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ set -e
|
|||||||
export NODE_OPTIONS="--max-old-space-size=4096"
|
export NODE_OPTIONS="--max-old-space-size=4096"
|
||||||
|
|
||||||
source scripts/common.sh
|
source scripts/common.sh
|
||||||
source test/externalTests/common.sh
|
source scripts/externalTests/common.sh
|
||||||
|
|
||||||
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
REPO_ROOT=$(realpath "$(dirname "$0")/../..")
|
||||||
|
|
||||||
|
@ -23,13 +23,7 @@ from argparse import ArgumentParser, Namespace
|
|||||||
import os
|
import os
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
# Our scripts/ is not a proper Python package so we need to modify PYTHONPATH to import from it
|
|
||||||
# pragma pylint: disable=import-error,wrong-import-position
|
|
||||||
SCRIPTS_DIR = Path(__file__).parents[1] / "scripts"
|
|
||||||
sys.path.insert(0, str(SCRIPTS_DIR))
|
|
||||||
|
|
||||||
from common.shell_command import run_cmd
|
|
||||||
|
|
||||||
EXTERNAL_TESTS_DIR = Path(__file__).parent / "externalTests"
|
EXTERNAL_TESTS_DIR = Path(__file__).parent / "externalTests"
|
||||||
|
|
||||||
@ -39,13 +33,10 @@ class ExternalTestNotFound(Exception):
|
|||||||
|
|
||||||
|
|
||||||
def detect_external_tests() -> dict:
|
def detect_external_tests() -> dict:
|
||||||
# TODO: Remove `file_path.stem != "common"` when we complete the migration
|
|
||||||
# of the external tests to python, since there will be no more
|
|
||||||
# common.sh script in the externalTests folder.
|
|
||||||
return {
|
return {
|
||||||
file_path.stem: file_path
|
file_path.stem: file_path
|
||||||
for file_path in Path(EXTERNAL_TESTS_DIR).iterdir()
|
for file_path in Path(EXTERNAL_TESTS_DIR).iterdir()
|
||||||
if file_path.is_file() and file_path.suffix == ".sh" and file_path.stem != "common"
|
if file_path.is_file() and file_path.suffix == ".sh"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user