Skip to content

Commit 2ab62d7

Browse files
authored
Merge pull request #15996 from ethereum/cmdlineTests_go_to_test_dir
cmdline tests are executed in their respective test directory
2 parents 8cf3305 + 2fa170e commit 2ab62d7

File tree

292 files changed

+984
-979
lines changed
  • test
    • cmdlineTests
      • abi_via_ir
      • abiencoderv2_no_warning
      • asm_json
      • asm_json_no_pretty_print
      • ast_compact_json_no_pretty_json
      • ast_compact_json_storage_layout_specifier
      • ast_compact_json_with_base_path
      • ast_ir
      • combined_json_abi
      • combined_json_generated_sources
      • combined_json_no_pretty_print
      • combined_json_stop_after_parsing
      • combined_json_with_base_path
      • combined_json_with_devdoc
      • combined_json_with_userdoc
      • constant_optimizer_yul
      • debug_info_in_yul_and_evm_asm_print_all
      • debug_info_in_yul_and_evm_asm_print_location_only
      • debug_info_in_yul_and_evm_asm_print_none
      • debug_info_in_yul_snippet_escaping
      • dup_opt_peephole
      • error_codes
      • ethdebug_eof_container_osaka
      • events_in_abi
      • evm_version_byzantium
      • evm_version_constantinople
      • evmasm_difficulty_post_paris
      • evmasm_difficulty_pre_paris
      • evmasm_prevrandao_post_paris
      • evmasm_prevrandao_pre_paris
      • evmasm_transient_storage_inline_assembly
      • evmasm_transient_storage_inline_assembly_via_ir
      • evmasm_transient_storage_state_variable
      • evmasm_transient_storage_state_variable_via_ir
      • exp_base_literal
      • function_debug_info
      • function_debug_info_via_yul
      • hashes
      • inline_assembly_function_name_clash
      • ir_compiler_inheritance_nosubobjects
      • ir_compiler_subobjects
      • ir_optimized_transient_storage_value_type
      • ir_optimized_with_optimize
      • ir_subobject_order
      • ir_unoptimized_with_optimize
      • ir_unoptimized_with_optimize_via_ir
      • ir_with_assembly_no_memoryguard_creation
      • ir_with_assembly_no_memoryguard_runtime
      • keccak_optimization_deploy_code
      • keccak_optimization_low_runs
      • linking_qualified_library_name
      • linking_solidity
      • linking_solidity_unresolved_references
      • linking_strict_assembly
      • linking_strict_assembly_qualified_library_qualified_reference
      • linking_strict_assembly_qualified_library_unqualified_reference
      • linking_strict_assembly_same_library_name_different_files
      • linking_strict_assembly_unqualified_library_qualified_reference
      • linking_strict_assembly_unqualified_library_unqualified_reference
      • linking_strict_assembly_unresolved_references
      • linking_unqualified_library_name
      • mcopy_bytes_array_abi_decode
      • mcopy_bytes_array_returned_from_function
      • mcopy_string_literal_returned_from_function
      • memoryguard_shadowing_by_inline_assembly_identifiers
      • message_format
      • message_format_utf8
      • metadata
      • model_checker_bmc_loop_iterations
      • model_checker_bmc_loop_iterations_no_argument
      • model_checker_contracts_all
      • model_checker_contracts_all_explicit
      • model_checker_contracts_inexistent_contract
      • model_checker_contracts_inexistent_source
      • model_checker_contracts_one_contract_missing
      • model_checker_contracts_only_one
      • model_checker_engine_all
      • model_checker_engine_bmc
      • model_checker_engine_chc
      • model_checker_ext_calls_trusted_chc
      • model_checker_ext_calls_untrusted_chc
      • model_checker_invariants_all
      • model_checker_invariants_contract
      • model_checker_invariants_contract_eld
      • model_checker_invariants_contract_reentrancy
      • model_checker_invariants_reentrancy
      • model_checker_show_proved_safe_default_all_engines
      • model_checker_show_proved_safe_default_bmc
      • model_checker_show_proved_safe_default_chc
      • model_checker_show_proved_safe_true_all_engines
      • model_checker_show_proved_safe_true_bmc
      • model_checker_show_proved_safe_true_chc
      • model_checker_show_unproved_true_all_engines
      • model_checker_show_unproved_true_chc
      • model_checker_show_unsupported_true_all_engines
      • model_checker_show_unsupported_true_bmc
      • model_checker_show_unsupported_true_chc
      • model_checker_solvers_cvc5
      • model_checker_solvers_cvc5_eld
      • model_checker_solvers_eld
      • model_checker_solvers_z3
      • model_checker_solvers_z3_implicit
      • model_checker_solvers_z3_smtlib2
      • model_checker_targets_all_all_engines
      • model_checker_targets_all_bmc
      • model_checker_targets_all_chc
      • model_checker_targets_assert_bmc
      • model_checker_targets_assert_chc
      • model_checker_targets_balance_bmc
      • model_checker_targets_constant_condition_bmc
      • model_checker_targets_default_all_engines
      • model_checker_targets_default_bmc
      • model_checker_targets_default_chc
      • model_checker_targets_div_by_zero_bmc
      • model_checker_targets_div_by_zero_chc
      • model_checker_targets_out_of_bounds_chc
      • model_checker_targets_overflow_bmc
      • model_checker_targets_overflow_chc
      • model_checker_targets_pop_empty_chc
      • model_checker_targets_underflow_bmc
      • model_checker_targets_underflow_chc
      • model_checker_targets_underflow_overflow_assert_bmc
      • model_checker_targets_underflow_overflow_assert_chc
      • model_checker_targets_underflow_overflow_bmc
      • model_checker_targets_underflow_overflow_chc
      • name_simplifier
      • no_cbor_metadata
      • no_contract_combined_json
      • no_import_callback
      • object_compiler
      • optimize_full_storage_write
      • optimizer_BlockDeDuplicator
      • optimizer_array_sload
      • optimizer_inliner_add
      • optimizer_inliner_call_from_constructor
      • optimizer_inliner_dynamic_reference
      • optimizer_inliner_dynamic_reference_constructor
      • optimizer_inliner_inc
      • optimizer_inliner_multireturn
      • optimizer_user_yul
      • require_overload
      • require_with_error_ir
      • require_with_string_ir
      • revert_strings
      • stack_too_deep_from_code_transform
      • standard_debug_info_in_yul_and_evm_asm_print_all
      • standard_debug_info_in_yul_and_evm_asm_print_location_only
      • standard_debug_info_in_yul_and_evm_asm_print_none
      • standard_debug_info_in_yul_and_evm_asm_print_snippet_only
      • standard_irOptimized_ast_requested
      • standard_ir_ast_requested
      • standard_metadata
      • standard_optimizer_invalid_detail_type
      • standard_optimizer_invalid_details
      • standard_optimizer_no_yul
      • standard_optimizer_yul
      • standard_optimizer_yulDetails
      • standard_optimizer_yulDetails_no_object
      • standard_optimizer_yulDetails_optimiserSteps
      • standard_optimizer_yulDetails_optimiserSteps_invalid_abbreviation
      • standard_optimizer_yulDetails_optimiserSteps_invalid_nested_delimiter
      • standard_optimizer_yulDetails_optimiserSteps_mutliple_delimiters
      • standard_optimizer_yulDetails_optimiserSteps_nested_brackets
      • standard_optimizer_yulDetails_optimiserSteps_nesting_too_deep
      • standard_optimizer_yulDetails_optimiserSteps_no_yul
      • standard_optimizer_yulDetails_optimiserSteps_type
      • standard_optimizer_yulDetails_optimiserSteps_unbalanced_closing_bracket
      • standard_optimizer_yulDetails_optimiserSteps_unbalanced_opening_bracket
      • standard_optimizer_yulDetails_optimiserSteps_with_cleanup_sequence
      • standard_optimizer_yulDetails_optimiserSteps_with_empty_cleanup_sequence
      • standard_optimizer_yulDetails_optimiserSteps_with_empty_optimisation_sequence
      • standard_optimizer_yulDetails_optimiserSteps_with_empty_sequence
      • standard_optimizer_yulDetails_optimiserSteps_with_empty_sequence_no_yul
      • standard_optimizer_yulDetails_optimiserSteps_with_whitespace_newline_sequence_no_yul
      • standard_optimizer_yulDetails_without_yul
      • standard_outputs_on_analysis_error_fatal
      • standard_outputs_on_analysis_error_fatal_after_current_step
      • standard_outputs_on_analysis_error_non_fatal
      • standard_outputs_on_compilation_error
      • standard_outputs_on_parsing_error
      • standard_stack_too_deep_from_code_transform
      • standard_stop_after_parsing_ast_requested
      • standard_stop_after_parsing_bytecode_requested
      • standard_stop_after_parsing_non_binary_output_requested
      • standard_undeployable_contract_all_outputs
      • standard_urls_existing_and_missing
      • standard_urls_missing
      • standard_yul_cfg_json_export
      • standard_yul_code_generation_error
      • standard_yul_debug_info_ethdebug_compatible_output
      • standard_yul_debug_info_ethdebug_incompatible_output
      • standard_yul_debug_info_ethdebug_verbatim_unimplemented
      • standard_yul_debug_info_print_all
      • standard_yul_debug_info_print_location_only
      • standard_yul_debug_info_print_none
      • standard_yul_debug_info_print_snippet_only
      • standard_yul_ethdebug_assign_immutable
      • standard_yul_ethdebug_bytecode_ir
      • standard_yul_ethdebug_bytecode_iroptimized
      • standard_yul_ethdebug_deployed_bytecode
      • standard_yul_ethdebug_deployed_bytecode_and_bytecode
      • standard_yul_ethdebug_ir
      • standard_yul_ethdebug_iroptimize
      • standard_yul_ethdebug_optimize_ir
      • standard_yul_ethdebug_optimize_iroptimized
      • stop_after_parsing_ast
      • storage_layout_transient_value_types
      • storage_layout_user_defined
      • storage_layout_user_defined_no_pretty_print
      • strict_asm_ast_compact_json
      • strict_asm_debug_info_print_all
      • strict_asm_debug_info_print_location_only
      • strict_asm_debug_info_print_none
      • strict_asm_eof_container_osaka
      • strict_asm_eof_dataloadn_osaka
      • strict_asm_evm_version_byzantium
      • strict_asm_evm_version_constantinople
      • strict_asm_jump
      • strict_asm_msize_with_optimizer
      • strict_asm_msize_without_optimizer
      • strict_asm_only_cr
      • strict_asm_optimizer_steps
      • strict_asm_output_selection_asm_only
      • strict_asm_output_selection_bin_only
      • strict_asm_output_selection_ir_optimized_only
      • strict_asm_warning
      • strict_asm_warning_and_error_optimize
      • strict_asm_warning_optimize
      • strict_asm_warning_optimize_unreachable
      • strict_asm_yul_cfg_json_export
      • structured_documentation_source_location
      • too_long_line
      • too_long_line_both_sides_short
      • too_long_line_edge_in
      • too_long_line_edge_out
      • too_long_line_left_short
      • too_long_line_multiline
      • too_long_line_right_short
      • transient_storage_layout
      • transient_storage_layout_value_types
      • transient_storage_layout_value_types_interleaved_with_storage
      • transient_storage_layout_value_types_packed
      • undeployable_contract_empty_outputs
      • viair_abicoder_v1
      • viair_msize_without_optimizer
      • viair_subobject_optimization
      • viair_subobjects
      • yul_cfg_json_export
      • yul_function_name_clashes
      • yul_function_name_clashes_different_params
      • yul_optimize_runs
      • yul_optimizer_disabled_sequence_empty
      • yul_optimizer_steps
      • yul_optimizer_steps_nested_brackets
      • yul_optimizer_steps_short_sequence
      • yul_optimizer_steps_with_empty_cleanup_sequence
      • yul_optimizer_steps_with_empty_optimization_sequence
      • yul_optimizer_steps_without_optimize_empty_sequence
      • yul_verbatim
      • yul_verbatim_msize

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

292 files changed

+984
-979
lines changed

test/cmdlineTests.sh

+25-20
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ EOF
225225
if jq 'has("ethdebug")' "$stdout_path" --exit-status > /dev/null; then
226226
local temporary_file
227227
temporary_file=$(mktemp -t cmdline-ethdebug-XXXXXX.tmp)
228-
if [[ -e ${tdir}/strip-ethdebug ]]; then
228+
if [[ -e strip-ethdebug ]]; then
229229
jq --indent 4 '
230230
(. | .. | objects | select(has("ethdebug"))) |= (.ethdebug = "<ETHDEBUG DEBUG DATA REMOVED>")
231231
' "$stdout_path" > "$temporary_file"
@@ -350,9 +350,11 @@ test_solc_behaviour "${0}" "ctx:=/some/remapping/target" "" "" 1 "" "Error: Inva
350350

351351
printTask "Running general commandline tests..."
352352
(
353-
cd "$REPO_ROOT"/test/cmdlineTests/
354353
for tdir in "${selected_tests[@]}"
355354
do
355+
# go back to the test root dir
356+
cd "$REPO_ROOT"/test/cmdlineTests/
357+
356358
if ! [[ -d $tdir ]]
357359
then
358360
fail "Test directory not found: $tdir"
@@ -377,18 +379,21 @@ printTask "Running general commandline tests..."
377379
fi
378380
fi
379381

380-
scriptFiles="$(ls -1 "${tdir}/test."* 2> /dev/null || true)"
382+
# jump into test dir
383+
cd "${tdir}"
384+
385+
scriptFiles="$(ls -1 "test."* 2> /dev/null || true)"
381386
scriptCount="$(echo "${scriptFiles}" | wc -w)"
382387

383-
inputFiles="$(ls -1 "${tdir}/input."* 2> /dev/null || true)"
388+
inputFiles="$(ls -1 "input."* 2> /dev/null || true)"
384389
inputCount="$(echo "${inputFiles}" | wc -w)"
385390
(( inputCount <= 1 )) || fail "Ambiguous input. Found input files in multiple formats:"$'\n'"${inputFiles}"
386391
(( scriptCount <= 1 )) || fail "Ambiguous input. Found script files in multiple formats:"$'\n'"${scriptFiles}"
387392
(( inputCount == 0 || scriptCount == 0 )) || fail "Ambiguous input. Found both input and script files:"$'\n'"${inputFiles}"$'\n'"${scriptFiles}"
388393

389394
if (( scriptCount == 1 ))
390395
then
391-
if ! "$scriptFiles"
396+
if ! "./$scriptFiles"
392397
then
393398
fail "Test script ${scriptFiles} failed."
394399
fi
@@ -399,38 +404,38 @@ printTask "Running general commandline tests..."
399404
# Use printf to get rid of the trailing newline
400405
inputFile=$(printf "%s" "${inputFiles}")
401406

402-
if [ "${inputFile}" = "${tdir}/input.json" ]
407+
if [ "${inputFile}" = "input.json" ]
403408
then
404-
! [ -e "${tdir}/stdin" ] || fail "Found a file called 'stdin' but redirecting standard input in JSON mode is not allowed."
409+
! [ -e "stdin" ] || fail "Found a file called 'stdin' but redirecting standard input in JSON mode is not allowed."
405410

406411
stdin="${inputFile}"
407412
inputFile=""
408-
stdout="$(cat "${tdir}/output.json" 2>/dev/null || true)"
409-
stdoutExpectationFile="${tdir}/output.json"
413+
stdout="$(cat "output.json" 2>/dev/null || true)"
414+
stdoutExpectationFile="output.json"
410415
prettyPrintFlags=""
411-
if [[ ! -f "${tdir}/no-pretty-print" ]]
416+
if [[ ! -f "no-pretty-print" ]]
412417
then
413418
prettyPrintFlags="--pretty-json --json-indent 4"
414419
fi
415420

416-
command_args="--standard-json ${prettyPrintFlags} "$(cat "${tdir}/args" 2>/dev/null || true)
421+
command_args="--standard-json ${prettyPrintFlags} "$(cat "args" 2>/dev/null || true)
417422
else
418-
if [ -e "${tdir}/stdin" ]
423+
if [ -e "stdin" ]
419424
then
420-
stdin="${tdir}/stdin"
421-
[ -f "${tdir}/stdin" ] || fail "'stdin' is not a regular file."
425+
stdin="stdin"
426+
[ -f "stdin" ] || fail "'stdin' is not a regular file."
422427
else
423428
stdin=""
424429
fi
425430

426-
stdout="$(cat "${tdir}/output" 2>/dev/null || true)"
427-
stdoutExpectationFile="${tdir}/output"
428-
command_args=$(cat "${tdir}/args" 2>/dev/null || true)
431+
stdout="$(cat "output" 2>/dev/null || true)"
432+
stdoutExpectationFile="output"
433+
command_args=$(cat "args" 2>/dev/null || true)
429434
fi
430-
exitCodeExpectationFile="${tdir}/exit"
435+
exitCodeExpectationFile="exit"
431436
exitCode=$(cat "$exitCodeExpectationFile" 2>/dev/null || true)
432-
err="$(cat "${tdir}/err" 2>/dev/null || true)"
433-
stderrExpectationFile="${tdir}/err"
437+
err="$(cat "err" 2>/dev/null || true)"
438+
stderrExpectationFile="err"
434439
test_solc_behaviour "$inputFile" \
435440
"$command_args" \
436441
"$stdin" \

test/cmdlineTests/abi_via_ir/output

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
======= abi_via_ir/input.sol:C =======
2+
======= input.sol:C =======
33
Contract JSON ABI
44
[
55
{
@@ -101,7 +101,7 @@ Contract JSON ABI
101101
}
102102
]
103103

104-
======= abi_via_ir/input.sol:L =======
104+
======= input.sol:L =======
105105
Contract JSON ABI
106106
[
107107
{
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11

2-
======= abiencoderv2_no_warning/input.sol:C =======
2+
======= input.sol:C =======
33
Function signatures:
44
3fc03eeb: f((uint256))

test/cmdlineTests/asm_json/output

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
======= asm_json/input.sol:C =======
2+
======= input.sol:C =======
33
EVM assembly:
44
{
55
".code": [
@@ -1573,7 +1573,7 @@ EVM assembly:
15731573
}
15741574
},
15751575
"sourceList": [
1576-
"asm_json/input.sol",
1576+
"input.sol",
15771577
"#utility.yul"
15781578
]
15791579
}

test/cmdlineTests/asm_json_no_pretty_print/output

+2-2
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
JSON AST (compact format):
22

33

4-
======= ast_compact_json_no_pretty_json/input.sol =======
5-
{"absolutePath":"ast_compact_json_no_pretty_json/input.sol","exportedSymbols":{"C":[2]},"id":3,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"canonicalName":"C","contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":2,"linearizedBaseContracts":[2],"name":"C","nameLocation":"69:1:0","nodeType":"ContractDefinition","nodes":[],"scope":3,"src":"60:13:0","usedErrors":[],"usedEvents":[]}],"src":"36:38:0"}
4+
======= input.sol =======
5+
{"absolutePath":"input.sol","exportedSymbols":{"C":[2]},"id":3,"license":"GPL-3.0","nodeType":"SourceUnit","nodes":[{"id":1,"literals":["solidity",">=","0.0"],"nodeType":"PragmaDirective","src":"36:22:0"},{"abstract":false,"baseContracts":[],"canonicalName":"C","contractDependencies":[],"contractKind":"contract","fullyImplemented":true,"id":2,"linearizedBaseContracts":[2],"name":"C","nameLocation":"69:1:0","nodeType":"ContractDefinition","nodes":[],"scope":3,"src":"60:13:0","usedErrors":[],"usedEvents":[]}],"src":"36:38:0"}

test/cmdlineTests/ast_compact_json_storage_layout_specifier/output

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
JSON AST (compact format):
22

33

4-
======= ast_compact_json_storage_layout_specifier/input.sol =======
4+
======= input.sol =======
55
{
6-
"absolutePath": "ast_compact_json_storage_layout_specifier/input.sol",
6+
"absolutePath": "input.sol",
77
"exportedSymbols": {
88
"C": [
99
6

test/cmdlineTests/ast_compact_json_with_base_path/output

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
JSON AST (compact format):
22

33

4-
======= ast_compact_json_with_base_path/c.sol =======
4+
======= c.sol =======
55
{
6-
"absolutePath": "ast_compact_json_with_base_path/c.sol",
6+
"absolutePath": "c.sol",
77
"exportedSymbols": {
88
"C": [
99
5
@@ -46,9 +46,9 @@ JSON AST (compact format):
4646
],
4747
"src": "36:38:0"
4848
}
49-
======= ast_compact_json_with_base_path/input.sol =======
49+
======= input.sol =======
5050
{
51-
"absolutePath": "ast_compact_json_with_base_path/input.sol",
51+
"absolutePath": "input.sol",
5252
"exportedSymbols": {
5353
"C": [
5454
5
@@ -69,7 +69,7 @@ JSON AST (compact format):
6969
"src": "36:22:1"
7070
},
7171
{
72-
"absolutePath": "ast_compact_json_with_base_path/c.sol",
72+
"absolutePath": "c.sol",
7373
"file": "./c.sol",
7474
"id": 2,
7575
"nameLocation": "-1:-1:-1",

0 commit comments

Comments
 (0)