diff --git a/conformance/sv-tests/README.md b/conformance/sv-tests/README.md index 24dc1a681cb..42bd159f1b2 100644 --- a/conformance/sv-tests/README.md +++ b/conformance/sv-tests/README.md @@ -10,10 +10,13 @@ Each test has separate `2state` and `4state` rows (`test`, `state_mode`, `result The official runner owns metadata parsing, compatible-runner filtering, mode priority, library injection, timeouts, expected failures and simulation `:assert:` evaluation. The adapter declares only the driver’s supported -`parsing`, `elaboration` and `simulation` modes. It forwards source files, include -directories, defines, an optional explicit top and the selected state mode to -the Rust driver. Parsing mode stops after preprocessing and syntax parsing; it -does not build semantic module metadata, select a root, elaborate or simulate. +`preprocessing`, `parsing`, `elaboration` and `simulation` modes. It forwards +source files, include directories, defines, an optional explicit top and the +selected state mode to +the Rust driver. Preprocessing mode expands macros and includes, emits the +resulting text, and stops before syntax parsing or root selection. Parsing mode +stops after preprocessing and syntax parsing; it does not build semantic module +metadata, select a root, elaborate or simulate. The official mode priority still chooses elaboration for default cases and for cases that permit both parsing and elaboration. In elaboration and simulation modes, sources without a module still undergo preprocessing and parsing; root @@ -33,6 +36,13 @@ command-line defines apply to each file. | `fail` | the official runner emitted `FAIL` | | `skip` | the official runner skipped an incompatible test or unsupported mode | +All 90 preprocessing cases at the pinned revision now execute in both state +modes, leaving no skipped expectation rows. Each mode reports 89 passes and +one failure: `chapter-22/22.11--pragma-invalid.sv` expects a bare `` `pragma `` +to be rejected, but the preprocessor currently accepts it. This failure remains +visible in the baseline. Upstream preprocessing verdicts check process success +and expected failure; they do not compare the emitted text against a golden file. + The official runner’s process exit code is separate from the case verdict. The wrapper reads its `PASS`/`FAIL` log messages; it does not reconstruct their rules from tool exit codes or `should_fail` metadata. A negative test may pass diff --git a/conformance/sv-tests/expected.tsv b/conformance/sv-tests/expected.tsv index ed9a71b7f0d..6e6ddef53fa 100644 --- a/conformance/sv-tests/expected.tsv +++ b/conformance/sv-tests/expected.tsv @@ -823,36 +823,36 @@ chapter-21/21.7--dumpfile.sv 2state pass chapter-21/21.7--dumpfile.sv 4state pass chapter-21/21.7--dumpports.sv 2state fail chapter-21/21.7--dumpports.sv 4state fail -chapter-22/22.10--celldefine-basic-1.sv 2state skip -chapter-22/22.10--celldefine-basic-1.sv 4state skip -chapter-22/22.10--celldefine-basic-2.sv 2state skip -chapter-22/22.10--celldefine-basic-2.sv 4state skip -chapter-22/22.11--pragma-basic.sv 2state skip -chapter-22/22.11--pragma-basic.sv 4state skip -chapter-22/22.11--pragma-complex.sv 2state skip -chapter-22/22.11--pragma-complex.sv 4state skip -chapter-22/22.11--pragma-invalid.sv 2state skip -chapter-22/22.11--pragma-invalid.sv 4state skip -chapter-22/22.11--pragma-nested.sv 2state skip -chapter-22/22.11--pragma-nested.sv 4state skip -chapter-22/22.11--pragma-number-multi.sv 2state skip -chapter-22/22.11--pragma-number-multi.sv 4state skip -chapter-22/22.11--pragma-number.sv 2state skip -chapter-22/22.11--pragma-number.sv 4state skip -chapter-22/22.12--line-basic.sv 2state skip -chapter-22/22.12--line-basic.sv 4state skip -chapter-22/22.12--line-complex.sv 2state skip -chapter-22/22.12--line-complex.sv 4state skip -chapter-22/22.12--line-illegal-1.sv 2state skip -chapter-22/22.12--line-illegal-1.sv 4state skip -chapter-22/22.12--line-illegal-2.sv 2state skip -chapter-22/22.12--line-illegal-2.sv 4state skip -chapter-22/22.12--line-illegal-3.sv 2state skip -chapter-22/22.12--line-illegal-3.sv 4state skip -chapter-22/22.12--line-illegal-4.sv 2state skip -chapter-22/22.12--line-illegal-4.sv 4state skip -chapter-22/22.12--line-illegal-5.sv 2state skip -chapter-22/22.12--line-illegal-5.sv 4state skip +chapter-22/22.10--celldefine-basic-1.sv 2state pass +chapter-22/22.10--celldefine-basic-1.sv 4state pass +chapter-22/22.10--celldefine-basic-2.sv 2state pass +chapter-22/22.10--celldefine-basic-2.sv 4state pass +chapter-22/22.11--pragma-basic.sv 2state pass +chapter-22/22.11--pragma-basic.sv 4state pass +chapter-22/22.11--pragma-complex.sv 2state pass +chapter-22/22.11--pragma-complex.sv 4state pass +chapter-22/22.11--pragma-invalid.sv 2state fail +chapter-22/22.11--pragma-invalid.sv 4state fail +chapter-22/22.11--pragma-nested.sv 2state pass +chapter-22/22.11--pragma-nested.sv 4state pass +chapter-22/22.11--pragma-number-multi.sv 2state pass +chapter-22/22.11--pragma-number-multi.sv 4state pass +chapter-22/22.11--pragma-number.sv 2state pass +chapter-22/22.11--pragma-number.sv 4state pass +chapter-22/22.12--line-basic.sv 2state pass +chapter-22/22.12--line-basic.sv 4state pass +chapter-22/22.12--line-complex.sv 2state pass +chapter-22/22.12--line-complex.sv 4state pass +chapter-22/22.12--line-illegal-1.sv 2state pass +chapter-22/22.12--line-illegal-1.sv 4state pass +chapter-22/22.12--line-illegal-2.sv 2state pass +chapter-22/22.12--line-illegal-2.sv 4state pass +chapter-22/22.12--line-illegal-3.sv 2state pass +chapter-22/22.12--line-illegal-3.sv 4state pass +chapter-22/22.12--line-illegal-4.sv 2state pass +chapter-22/22.12--line-illegal-4.sv 4state pass +chapter-22/22.12--line-illegal-5.sv 2state pass +chapter-22/22.12--line-illegal-5.sv 4state pass chapter-22/22.3--resetall_basic.sv 2state pass chapter-22/22.3--resetall_basic.sv 4state pass chapter-22/22.3--resetall_illegal.sv 2state pass @@ -871,108 +871,108 @@ chapter-22/22.4--include_via_define.sv 2state pass chapter-22/22.4--include_via_define.sv 4state pass chapter-22/22.4--include_with_comment.sv 2state pass chapter-22/22.4--include_with_comment.sv 4state pass -chapter-22/22.5.1--define-expansion_1.sv 2state skip -chapter-22/22.5.1--define-expansion_1.sv 4state skip -chapter-22/22.5.1--define-expansion_10.sv 2state skip -chapter-22/22.5.1--define-expansion_10.sv 4state skip -chapter-22/22.5.1--define-expansion_11.sv 2state skip -chapter-22/22.5.1--define-expansion_11.sv 4state skip -chapter-22/22.5.1--define-expansion_12.sv 2state skip -chapter-22/22.5.1--define-expansion_12.sv 4state skip -chapter-22/22.5.1--define-expansion_13.sv 2state skip -chapter-22/22.5.1--define-expansion_13.sv 4state skip -chapter-22/22.5.1--define-expansion_14.sv 2state skip -chapter-22/22.5.1--define-expansion_14.sv 4state skip -chapter-22/22.5.1--define-expansion_15.sv 2state skip -chapter-22/22.5.1--define-expansion_15.sv 4state skip -chapter-22/22.5.1--define-expansion_16.sv 2state skip -chapter-22/22.5.1--define-expansion_16.sv 4state skip -chapter-22/22.5.1--define-expansion_17.sv 2state skip -chapter-22/22.5.1--define-expansion_17.sv 4state skip -chapter-22/22.5.1--define-expansion_18.sv 2state skip -chapter-22/22.5.1--define-expansion_18.sv 4state skip -chapter-22/22.5.1--define-expansion_19.sv 2state skip -chapter-22/22.5.1--define-expansion_19.sv 4state skip -chapter-22/22.5.1--define-expansion_2.sv 2state skip -chapter-22/22.5.1--define-expansion_2.sv 4state skip -chapter-22/22.5.1--define-expansion_20.sv 2state skip -chapter-22/22.5.1--define-expansion_20.sv 4state skip -chapter-22/22.5.1--define-expansion_21.sv 2state skip -chapter-22/22.5.1--define-expansion_21.sv 4state skip -chapter-22/22.5.1--define-expansion_22.sv 2state skip -chapter-22/22.5.1--define-expansion_22.sv 4state skip -chapter-22/22.5.1--define-expansion_23.sv 2state skip -chapter-22/22.5.1--define-expansion_23.sv 4state skip -chapter-22/22.5.1--define-expansion_24.sv 2state skip -chapter-22/22.5.1--define-expansion_24.sv 4state skip -chapter-22/22.5.1--define-expansion_25.sv 2state skip -chapter-22/22.5.1--define-expansion_25.sv 4state skip -chapter-22/22.5.1--define-expansion_26.sv 2state skip -chapter-22/22.5.1--define-expansion_26.sv 4state skip -chapter-22/22.5.1--define-expansion_3.sv 2state skip -chapter-22/22.5.1--define-expansion_3.sv 4state skip -chapter-22/22.5.1--define-expansion_4.sv 2state skip -chapter-22/22.5.1--define-expansion_4.sv 4state skip -chapter-22/22.5.1--define-expansion_5.sv 2state skip -chapter-22/22.5.1--define-expansion_5.sv 4state skip -chapter-22/22.5.1--define-expansion_6.sv 2state skip -chapter-22/22.5.1--define-expansion_6.sv 4state skip -chapter-22/22.5.1--define-expansion_7.sv 2state skip -chapter-22/22.5.1--define-expansion_7.sv 4state skip -chapter-22/22.5.1--define-expansion_8.sv 2state skip -chapter-22/22.5.1--define-expansion_8.sv 4state skip -chapter-22/22.5.1--define-expansion_9.sv 2state skip -chapter-22/22.5.1--define-expansion_9.sv 4state skip -chapter-22/22.5.1--define.sv 2state skip -chapter-22/22.5.1--define.sv 4state skip +chapter-22/22.5.1--define-expansion_1.sv 2state pass +chapter-22/22.5.1--define-expansion_1.sv 4state pass +chapter-22/22.5.1--define-expansion_10.sv 2state pass +chapter-22/22.5.1--define-expansion_10.sv 4state pass +chapter-22/22.5.1--define-expansion_11.sv 2state pass +chapter-22/22.5.1--define-expansion_11.sv 4state pass +chapter-22/22.5.1--define-expansion_12.sv 2state pass +chapter-22/22.5.1--define-expansion_12.sv 4state pass +chapter-22/22.5.1--define-expansion_13.sv 2state pass +chapter-22/22.5.1--define-expansion_13.sv 4state pass +chapter-22/22.5.1--define-expansion_14.sv 2state pass +chapter-22/22.5.1--define-expansion_14.sv 4state pass +chapter-22/22.5.1--define-expansion_15.sv 2state pass +chapter-22/22.5.1--define-expansion_15.sv 4state pass +chapter-22/22.5.1--define-expansion_16.sv 2state pass +chapter-22/22.5.1--define-expansion_16.sv 4state pass +chapter-22/22.5.1--define-expansion_17.sv 2state pass +chapter-22/22.5.1--define-expansion_17.sv 4state pass +chapter-22/22.5.1--define-expansion_18.sv 2state pass +chapter-22/22.5.1--define-expansion_18.sv 4state pass +chapter-22/22.5.1--define-expansion_19.sv 2state pass +chapter-22/22.5.1--define-expansion_19.sv 4state pass +chapter-22/22.5.1--define-expansion_2.sv 2state pass +chapter-22/22.5.1--define-expansion_2.sv 4state pass +chapter-22/22.5.1--define-expansion_20.sv 2state pass +chapter-22/22.5.1--define-expansion_20.sv 4state pass +chapter-22/22.5.1--define-expansion_21.sv 2state pass +chapter-22/22.5.1--define-expansion_21.sv 4state pass +chapter-22/22.5.1--define-expansion_22.sv 2state pass +chapter-22/22.5.1--define-expansion_22.sv 4state pass +chapter-22/22.5.1--define-expansion_23.sv 2state pass +chapter-22/22.5.1--define-expansion_23.sv 4state pass +chapter-22/22.5.1--define-expansion_24.sv 2state pass +chapter-22/22.5.1--define-expansion_24.sv 4state pass +chapter-22/22.5.1--define-expansion_25.sv 2state pass +chapter-22/22.5.1--define-expansion_25.sv 4state pass +chapter-22/22.5.1--define-expansion_26.sv 2state pass +chapter-22/22.5.1--define-expansion_26.sv 4state pass +chapter-22/22.5.1--define-expansion_3.sv 2state pass +chapter-22/22.5.1--define-expansion_3.sv 4state pass +chapter-22/22.5.1--define-expansion_4.sv 2state pass +chapter-22/22.5.1--define-expansion_4.sv 4state pass +chapter-22/22.5.1--define-expansion_5.sv 2state pass +chapter-22/22.5.1--define-expansion_5.sv 4state pass +chapter-22/22.5.1--define-expansion_6.sv 2state pass +chapter-22/22.5.1--define-expansion_6.sv 4state pass +chapter-22/22.5.1--define-expansion_7.sv 2state pass +chapter-22/22.5.1--define-expansion_7.sv 4state pass +chapter-22/22.5.1--define-expansion_8.sv 2state pass +chapter-22/22.5.1--define-expansion_8.sv 4state pass +chapter-22/22.5.1--define-expansion_9.sv 2state pass +chapter-22/22.5.1--define-expansion_9.sv 4state pass +chapter-22/22.5.1--define.sv 2state pass +chapter-22/22.5.1--define.sv 4state pass chapter-22/22.5.1--define_and_resetall.sv 2state pass chapter-22/22.5.1--define_and_resetall.sv 4state pass -chapter-22/22.5.1--include-define-expansion.sv 2state skip -chapter-22/22.5.1--include-define-expansion.sv 4state skip -chapter-22/22.5.2--undef-basic.sv 2state skip -chapter-22/22.5.2--undef-basic.sv 4state skip -chapter-22/22.5.2--undef-nonexisting.sv 2state skip -chapter-22/22.5.2--undef-nonexisting.sv 4state skip -chapter-22/22.5.3--undefineall-and-redefine.sv 2state skip -chapter-22/22.5.3--undefineall-and-redefine.sv 4state skip -chapter-22/22.5.3--undefineall-basic.sv 2state skip -chapter-22/22.5.3--undefineall-basic.sv 4state skip -chapter-22/22.6--ifdef-behavioral.sv 2state skip -chapter-22/22.6--ifdef-behavioral.sv 4state skip -chapter-22/22.6--ifdef-chained-nested.sv 2state skip -chapter-22/22.6--ifdef-chained-nested.sv 4state skip -chapter-22/22.6--ifdef-nested.sv 2state skip -chapter-22/22.6--ifdef-nested.sv 4state skip -chapter-22/22.7--timescale-basic-1.sv 2state skip -chapter-22/22.7--timescale-basic-1.sv 4state skip -chapter-22/22.7--timescale-basic-2.sv 2state skip -chapter-22/22.7--timescale-basic-2.sv 4state skip +chapter-22/22.5.1--include-define-expansion.sv 2state pass +chapter-22/22.5.1--include-define-expansion.sv 4state pass +chapter-22/22.5.2--undef-basic.sv 2state pass +chapter-22/22.5.2--undef-basic.sv 4state pass +chapter-22/22.5.2--undef-nonexisting.sv 2state pass +chapter-22/22.5.2--undef-nonexisting.sv 4state pass +chapter-22/22.5.3--undefineall-and-redefine.sv 2state pass +chapter-22/22.5.3--undefineall-and-redefine.sv 4state pass +chapter-22/22.5.3--undefineall-basic.sv 2state pass +chapter-22/22.5.3--undefineall-basic.sv 4state pass +chapter-22/22.6--ifdef-behavioral.sv 2state pass +chapter-22/22.6--ifdef-behavioral.sv 4state pass +chapter-22/22.6--ifdef-chained-nested.sv 2state pass +chapter-22/22.6--ifdef-chained-nested.sv 4state pass +chapter-22/22.6--ifdef-nested.sv 2state pass +chapter-22/22.6--ifdef-nested.sv 4state pass +chapter-22/22.7--timescale-basic-1.sv 2state pass +chapter-22/22.7--timescale-basic-1.sv 4state pass +chapter-22/22.7--timescale-basic-2.sv 2state pass +chapter-22/22.7--timescale-basic-2.sv 4state pass chapter-22/22.7--timescale-basic-3.sv 2state pass chapter-22/22.7--timescale-basic-3.sv 4state pass chapter-22/22.7--timescale-basic-4.sv 2state pass chapter-22/22.7--timescale-basic-4.sv 4state pass -chapter-22/22.7--timescale-module.sv 2state skip -chapter-22/22.7--timescale-module.sv 4state skip -chapter-22/22.7--timescale-reset.sv 2state skip -chapter-22/22.7--timescale-reset.sv 4state skip -chapter-22/22.8--default_nettype-redefinition.sv 2state skip -chapter-22/22.8--default_nettype-redefinition.sv 4state skip -chapter-22/22.8--default_nettype.sv 2state skip -chapter-22/22.8--default_nettype.sv 4state skip -chapter-22/22.9--unconnected_drive-basic-2.sv 2state skip -chapter-22/22.9--unconnected_drive-basic-2.sv 4state skip -chapter-22/22.9--unconnected_drive-basic.sv 2state skip -chapter-22/22.9--unconnected_drive-basic.sv 4state skip +chapter-22/22.7--timescale-module.sv 2state pass +chapter-22/22.7--timescale-module.sv 4state pass +chapter-22/22.7--timescale-reset.sv 2state pass +chapter-22/22.7--timescale-reset.sv 4state pass +chapter-22/22.8--default_nettype-redefinition.sv 2state pass +chapter-22/22.8--default_nettype-redefinition.sv 4state pass +chapter-22/22.8--default_nettype.sv 2state pass +chapter-22/22.8--default_nettype.sv 4state pass +chapter-22/22.9--unconnected_drive-basic-2.sv 2state pass +chapter-22/22.9--unconnected_drive-basic-2.sv 4state pass +chapter-22/22.9--unconnected_drive-basic.sv 2state pass +chapter-22/22.9--unconnected_drive-basic.sv 4state pass chapter-22/22.9--unconnected_drive-invalid-1.sv 2state pass chapter-22/22.9--unconnected_drive-invalid-1.sv 4state pass chapter-22/22.9--unconnected_drive-invalid-2.sv 2state pass chapter-22/22.9--unconnected_drive-invalid-2.sv 4state pass chapter-22/22.9--unconnected_drive-invalid-3.sv 2state pass chapter-22/22.9--unconnected_drive-invalid-3.sv 4state pass -chapter-22/dummy_include.sv 2state skip -chapter-22/dummy_include.sv 4state skip -chapter-22/include_directory/defs.sv 2state skip -chapter-22/include_directory/defs.sv 4state skip +chapter-22/dummy_include.sv 2state pass +chapter-22/dummy_include.sv 4state pass +chapter-22/include_directory/defs.sv 2state pass +chapter-22/include_directory/defs.sv 4state pass chapter-23/23.2--macromodule-definition.sv 2state pass chapter-23/23.2--macromodule-definition.sv 4state pass chapter-23/23.2--module-definition.sv 2state pass @@ -1041,16 +1041,16 @@ chapter-5/5.6.4--compiler-directives-include.sv 2state pass chapter-5/5.6.4--compiler-directives-include.sv 4state pass chapter-5/5.6.4--compiler-directives-pragma.sv 2state pass chapter-5/5.6.4--compiler-directives-pragma.sv 4state pass -chapter-5/5.6.4--compiler-directives-preprocessor-macro_0.sv 2state skip -chapter-5/5.6.4--compiler-directives-preprocessor-macro_0.sv 4state skip +chapter-5/5.6.4--compiler-directives-preprocessor-macro_0.sv 2state pass +chapter-5/5.6.4--compiler-directives-preprocessor-macro_0.sv 4state pass chapter-5/5.6.4--compiler-directives-preprocessor-macro_1.sv 2state pass chapter-5/5.6.4--compiler-directives-preprocessor-macro_1.sv 4state pass chapter-5/5.6.4--compiler-directives-resetall.sv 2state pass chapter-5/5.6.4--compiler-directives-resetall.sv 4state pass chapter-5/5.6.4--compiler-directives-timescale.sv 2state pass chapter-5/5.6.4--compiler-directives-timescale.sv 4state pass -chapter-5/5.6.4--compiler-directives-unconnected-drive.sv 2state skip -chapter-5/5.6.4--compiler-directives-unconnected-drive.sv 4state skip +chapter-5/5.6.4--compiler-directives-unconnected-drive.sv 2state pass +chapter-5/5.6.4--compiler-directives-unconnected-drive.sv 4state pass chapter-5/5.7.1--integers-left-padding-bit.sv 2state pass chapter-5/5.7.1--integers-left-padding-bit.sv 4state pass chapter-5/5.7.1--integers-left-padding.sv 2state pass @@ -1741,48 +1741,48 @@ generic/class/class_test_8.sv 2state pass generic/class/class_test_8.sv 4state pass generic/class/class_test_9.sv 2state pass generic/class/class_test_9.sv 4state pass -generic/desc/desc_test_0.sv 2state skip -generic/desc/desc_test_0.sv 4state skip -generic/desc/desc_test_1.sv 2state skip -generic/desc/desc_test_1.sv 4state skip -generic/desc/desc_test_10.sv 2state skip -generic/desc/desc_test_10.sv 4state skip -generic/desc/desc_test_15.sv 2state skip -generic/desc/desc_test_15.sv 4state skip -generic/desc/desc_test_16.sv 2state skip -generic/desc/desc_test_16.sv 4state skip -generic/desc/desc_test_17.sv 2state skip -generic/desc/desc_test_17.sv 4state skip -generic/desc/desc_test_18.sv 2state skip -generic/desc/desc_test_18.sv 4state skip -generic/desc/desc_test_2.sv 2state skip -generic/desc/desc_test_2.sv 4state skip -generic/desc/desc_test_3.sv 2state skip -generic/desc/desc_test_3.sv 4state skip -generic/desc/desc_test_4.sv 2state skip -generic/desc/desc_test_4.sv 4state skip -generic/desc/desc_test_5.sv 2state skip -generic/desc/desc_test_5.sv 4state skip -generic/desc/desc_test_6.sv 2state skip -generic/desc/desc_test_6.sv 4state skip -generic/desc/desc_test_7.sv 2state skip -generic/desc/desc_test_7.sv 4state skip -generic/desc/desc_test_8.sv 2state skip -generic/desc/desc_test_8.sv 4state skip -generic/desc/desc_test_9.sv 2state skip -generic/desc/desc_test_9.sv 4state skip -generic/empty/empty_test_0.sv 2state skip -generic/empty/empty_test_0.sv 4state skip -generic/empty/empty_test_1.sv 2state skip -generic/empty/empty_test_1.sv 4state skip -generic/empty/empty_test_2.sv 2state skip -generic/empty/empty_test_2.sv 4state skip -generic/empty/empty_test_3.sv 2state skip -generic/empty/empty_test_3.sv 4state skip -generic/empty/empty_test_4.sv 2state skip -generic/empty/empty_test_4.sv 4state skip -generic/empty/empty_test_5.sv 2state skip -generic/empty/empty_test_5.sv 4state skip +generic/desc/desc_test_0.sv 2state pass +generic/desc/desc_test_0.sv 4state pass +generic/desc/desc_test_1.sv 2state pass +generic/desc/desc_test_1.sv 4state pass +generic/desc/desc_test_10.sv 2state pass +generic/desc/desc_test_10.sv 4state pass +generic/desc/desc_test_15.sv 2state pass +generic/desc/desc_test_15.sv 4state pass +generic/desc/desc_test_16.sv 2state pass +generic/desc/desc_test_16.sv 4state pass +generic/desc/desc_test_17.sv 2state pass +generic/desc/desc_test_17.sv 4state pass +generic/desc/desc_test_18.sv 2state pass +generic/desc/desc_test_18.sv 4state pass +generic/desc/desc_test_2.sv 2state pass +generic/desc/desc_test_2.sv 4state pass +generic/desc/desc_test_3.sv 2state pass +generic/desc/desc_test_3.sv 4state pass +generic/desc/desc_test_4.sv 2state pass +generic/desc/desc_test_4.sv 4state pass +generic/desc/desc_test_5.sv 2state pass +generic/desc/desc_test_5.sv 4state pass +generic/desc/desc_test_6.sv 2state pass +generic/desc/desc_test_6.sv 4state pass +generic/desc/desc_test_7.sv 2state pass +generic/desc/desc_test_7.sv 4state pass +generic/desc/desc_test_8.sv 2state pass +generic/desc/desc_test_8.sv 4state pass +generic/desc/desc_test_9.sv 2state pass +generic/desc/desc_test_9.sv 4state pass +generic/empty/empty_test_0.sv 2state pass +generic/empty/empty_test_0.sv 4state pass +generic/empty/empty_test_1.sv 2state pass +generic/empty/empty_test_1.sv 4state pass +generic/empty/empty_test_2.sv 2state pass +generic/empty/empty_test_2.sv 4state pass +generic/empty/empty_test_3.sv 2state pass +generic/empty/empty_test_3.sv 4state pass +generic/empty/empty_test_4.sv 2state pass +generic/empty/empty_test_4.sv 4state pass +generic/empty/empty_test_5.sv 2state pass +generic/empty/empty_test_5.sv 4state pass generic/iface/iface_class_test_0.sv 2state pass generic/iface/iface_class_test_0.sv 4state pass generic/iface/iface_class_test_1.sv 2state pass @@ -1951,20 +1951,20 @@ generic/number/number_test_8.sv 2state pass generic/number/number_test_8.sv 4state pass generic/number/number_test_9.sv 2state pass generic/number/number_test_9.sv 4state pass -generic/preproc/preproc_test_0.sv 2state skip -generic/preproc/preproc_test_0.sv 4state skip -generic/preproc/preproc_test_2.sv 2state skip -generic/preproc/preproc_test_2.sv 4state skip -generic/preproc/preproc_test_4.sv 2state skip -generic/preproc/preproc_test_4.sv 4state skip -generic/preproc/preproc_test_5.sv 2state skip -generic/preproc/preproc_test_5.sv 4state skip -generic/preproc/preproc_test_6.sv 2state skip -generic/preproc/preproc_test_6.sv 4state skip -generic/preproc/preproc_test_7.sv 2state skip -generic/preproc/preproc_test_7.sv 4state skip -generic/preproc/preproc_test_8.sv 2state skip -generic/preproc/preproc_test_8.sv 4state skip +generic/preproc/preproc_test_0.sv 2state pass +generic/preproc/preproc_test_0.sv 4state pass +generic/preproc/preproc_test_2.sv 2state pass +generic/preproc/preproc_test_2.sv 4state pass +generic/preproc/preproc_test_4.sv 2state pass +generic/preproc/preproc_test_4.sv 4state pass +generic/preproc/preproc_test_5.sv 2state pass +generic/preproc/preproc_test_5.sv 4state pass +generic/preproc/preproc_test_6.sv 2state pass +generic/preproc/preproc_test_6.sv 4state pass +generic/preproc/preproc_test_7.sv 2state pass +generic/preproc/preproc_test_7.sv 4state pass +generic/preproc/preproc_test_8.sv 2state pass +generic/preproc/preproc_test_8.sv 4state pass generic/struct/struct_test_0.sv 2state pass generic/struct/struct_test_0.sv 4state pass generic/typedef/typedef_test_0.sv 2state pass diff --git a/conformance/sv-tests/runners/celox.py b/conformance/sv-tests/runners/celox.py index 8eff962dc17..14139297b86 100644 --- a/conformance/sv-tests/runners/celox.py +++ b/conformance/sv-tests/runners/celox.py @@ -14,7 +14,7 @@ def __init__(self): super().__init__( name="celox", executable=os.environ["CELOX_SV_TESTS_DRIVER"], - supported_features={"parsing", "elaboration", "simulation"}, + supported_features={"preprocessing", "parsing", "elaboration", "simulation"}, ) self.url = "https://github.com/celox-sim/celox" diff --git a/conformance/sv-tests/test_runner.py b/conformance/sv-tests/test_runner.py index 9a36b97b2b1..9a82bd03259 100644 --- a/conformance/sv-tests/test_runner.py +++ b/conformance/sv-tests/test_runner.py @@ -89,7 +89,10 @@ def test_official_skips_and_no_module_is_not_preemptively_skipped(self): row = self.case(":type: parsing\n") self.assertEqual((row["mode"], row["result"]), ("parsing", "pass")) self.assertEqual(self.case(":type: parsing\n:should_fail_because: syntax\n", "// EXIT: 1")["result"], "pass") - self.assertEqual(self.case(":type: preprocessing\n")["result"], "skip") + row = self.case(":type: preprocessing\n") + self.assertEqual((row["mode"], row["result"]), ("preprocessing", "pass")) + self.assertEqual(self.case(":type: preprocessing\n", "// EXIT: 1")["result"], "fail") + self.assertEqual(self.case(":type: preprocessing\n:should_fail_because: invalid\n", "// EXIT: 1")["result"], "pass") self.assertEqual(self.case(":compatible-runners: other\n")["result"], "skip") # The source has no module. Its diagnostic still reaches official judgement. row = self.case(body="// OUTPUT: no module diagnostic\n// EXIT: 1") diff --git a/crates/celox/examples/sv_tests.rs b/crates/celox/examples/sv_tests.rs index 8ff75d497fd..80b5fe80b36 100644 --- a/crates/celox/examples/sv_tests.rs +++ b/crates/celox/examples/sv_tests.rs @@ -4,7 +4,7 @@ //! sv-tests. This process reports only compiler/simulator success or failure. //! //! ```text -//! sv_tests --mode parsing|elaboration|simulation --state-mode 2state|4state \ +//! sv_tests --mode preprocessing|parsing|elaboration|simulation --state-mode 2state|4state \ //! [--top NAME] [--define NAME[=VALUE]] [--include DIR] -- FILE... //! ``` @@ -14,6 +14,7 @@ use std::{collections::BTreeSet, env, path::PathBuf, process::ExitCode}; #[derive(Clone, Copy, Debug, PartialEq, Eq)] enum Mode { + Preprocessing, Parsing, Elaboration, Simulation, @@ -52,6 +53,7 @@ fn parse_options(args: &[String]) -> Result { match arg.as_str() { "--mode" if mode.is_none() => { mode = Some(match value.as_str() { + "preprocessing" => Mode::Preprocessing, "parsing" => Mode::Parsing, "elaboration" => Mode::Elaboration, "simulation" => Mode::Simulation, @@ -143,6 +145,12 @@ fn run(options: &Options) -> Result<(), String> { .map_err(|error| error.to_string()) }) .collect::>()?; + if options.mode == Mode::Preprocessing { + for text in &texts { + print!("{text}"); + } + return Ok(()); + } let sources: Vec<_> = texts .iter() .zip(&options.files) @@ -164,7 +172,9 @@ fn run(options: &Options) -> Result<(), String> { .map_err(|error| error.to_string())?; let top = select_top(&parsed, options.top.as_deref())?; match options.mode { - Mode::Parsing => unreachable!("parsing returned before root selection"), + Mode::Preprocessing | Mode::Parsing => { + unreachable!("preprocessing and parsing returned before root selection") + } // A Simulator rejects designs with processes, which it does not run. Mode::Elaboration => celox::Simulation::from_sv_sources(sources, &top) .four_state(options.four_state) @@ -242,7 +252,7 @@ fn main() -> ExitCode { Ok(options) => options, Err(error) => { eprintln!( - "{error}\nusage: sv_tests --mode parsing|elaboration|simulation --state-mode 2state|4state [--top NAME] [--define NAME[=VALUE]] [--include DIR] -- FILE..." + "{error}\nusage: sv_tests --mode preprocessing|parsing|elaboration|simulation --state-mode 2state|4state [--top NAME] [--define NAME[=VALUE]] [--include DIR] -- FILE..." ); return ExitCode::from(2); } @@ -295,7 +305,7 @@ mod tests { assert_eq!(o.includes, [PathBuf::from("headers")]); assert_eq!(o.files, [PathBuf::from("a.sv"), PathBuf::from("b.sv")]); for args in [ - vec!["--mode", "preprocessing", "--state-mode", "2state", "a.sv"], + vec!["--mode", "unknown", "--state-mode", "2state", "a.sv"], vec!["--mode", "elaboration", "--state-mode", "both", "a.sv"], vec![ "--mode", @@ -356,6 +366,28 @@ mod tests { } } + #[test] + fn preprocessing_stops_before_syntax_and_reports_directive_errors() { + let dir = tempfile::tempdir().unwrap(); + let path = fixture( + dir.path(), + "tokens.sv", + "`define WORD expanded\n`WORD\nmodule unfinished;", + ); + let mut opts = fixture_options(vec![path], Mode::Preprocessing); + run(&opts).unwrap(); + opts.mode = Mode::Parsing; + assert!(run(&opts).is_err()); + let path = fixture(dir.path(), "invalid.sv", "`include \"missing.svh\"\n"); + assert!(run(&fixture_options(vec![path], Mode::Preprocessing)).is_err()); + assert_eq!( + options(&["--mode", "preprocessing", "--state-mode", "2state", "a.sv"]) + .unwrap() + .mode, + Mode::Preprocessing + ); + } + #[test] fn parsing_stops_before_metadata_roots_elaboration_and_simulation() { let dir = tempfile::tempdir().unwrap();