Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
r0qs committed Apr 4, 2023
1 parent 054d9f8 commit 47b4ec0
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
13 changes: 10 additions & 3 deletions test/externalTests/exttest/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,15 @@ def __post_init__(self):
def selected_presets(self):
return self.compile_only_presets + self.settings_presets


class InvalidConfigError(Exception):
pass


class WrongBinaryType(Exception):
pass


class TestRunner(metaclass=ABCMeta):
@staticmethod
def on_local_test_dir(fn):
Expand Down Expand Up @@ -213,7 +216,9 @@ def parse_solc_version(solc_version_string):
if solc_version_match:
solc_full_version = solc_version_match.group(1)
else:
raise RuntimeError(f"Solc version could not be found in: {solc_version_string}.")
raise RuntimeError(
f"Solc version could not be found in: {solc_version_string}."
)
return solc_full_version


Expand Down Expand Up @@ -253,8 +258,10 @@ def setup_solc(config: TestConfig, test_dir: Path) -> (str, str):
run_cmd("npm install")
run_cmd("npm run build")

if mimetypes.guess_type(sc_config.binary_path)[0] != 'application/javascript':
raise WrongBinaryType(f"Provided soljson.js is expected to be of the type application/javascript but it is not.")
if mimetypes.guess_type(sc_config.binary_path)[0] != "application/javascript":
raise WrongBinaryType(
f"Provided soljson.js is expected to be of the type application/javascript but it is not."
)

copyfile(sc_config.binary_path, solc_dir / "dist/soljson.js")
solc_version_output = subprocess.getoutput(f"node {solc_bin} --version")
Expand Down
48 changes: 24 additions & 24 deletions test/externalTests/prb-math.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,30 @@
try:
args = parse_command_line("PRBMath external tests", sys.argv[1:])

runner_config = TestConfig(**{
"repo_url": "https://github.com/PaulRBerg/prb-math.git",
"ref_type": "branch",
"ref": "main",
"config_file": "foundry.toml",
"config_var": "config",
"build_dependency": "rust",
"compile_only_presets": [],
"settings_presets": [
"ir-optimize-evm+yul",
"legacy-optimize-evm-only",
"legacy-optimize-evm+yul",
"legacy-no-optimize"
],
"evm_version": f"{CURRENT_EVM_VERSION}",
"solc": {
"binary_type": f"{args.solc_binary_type}",
"binary_path": f"{args.solc_binary_path}",
"branch": "master",
"install_dir": "solc/"
runner_config = TestConfig(
**{
"repo_url": "https://github.com/PaulRBerg/prb-math.git",
"ref_type": "branch",
"ref": "main",
"config_file": "foundry.toml",
"config_var": "config",
"build_dependency": "rust",
"compile_only_presets": [],
"settings_presets": [
"ir-optimize-evm+yul",
"legacy-optimize-evm-only",
"legacy-optimize-evm+yul",
"legacy-no-optimize",
],
"evm_version": f"{CURRENT_EVM_VERSION}",
"solc": {
"binary_type": f"{args.solc_binary_type}",
"binary_path": f"{args.solc_binary_path}",
"branch": "master",
"install_dir": "solc/",
},
}
})
)

run_test(
"PRBMath",
Expand All @@ -65,8 +67,6 @@
test_fn=None,
),
)
except (
InvalidConfigError
) as exception:
except InvalidConfigError as exception:
print(f"Error while processing test: {exception}", file=sys.stderr)
sys.exit(1)

0 comments on commit 47b4ec0

Please sign in to comment.