Skip to content

Commit 806bee1

Browse files
authored
Shift from ARGS to EXTRA-ARGS where possible (#5602)
Adds minimal defaults for codegen so that those tests don't need to specify the full command line. Moves driver/testdata/compile to check/testdata/basics/raw_sem_ir, which seems like it better reflects the focus. Removes the textual IR test because we have plenty of those now. Moves a multiline token diagnostic test to parse because (a) diagnostics doesn't have other tests and (b) this is really testing the way that parse structures the location. Drops `--include-diagnostic-kind` from some driver tests that aren't testing a diagnostic, so the flag felt a bit like noise (even before this change, there are a few tests that don't specify it because they're not intended to test an emitted diagnostic, just high-level diagnostic behaviors). Adds some comments to reflect my understanding of why a test exists, when I was pausing to think about it. Modifies the stdin test to do more dumps; which happens to expose we currently misbehave.
1 parent 20c2059 commit 806bee1

21 files changed

+129
-129
lines changed

toolchain/check/testdata/basics/no_prelude/dump_raw_builtins.carbon renamed to toolchain/check/testdata/basics/raw_sem_ir/builtins.carbon

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --phase=check --dump-raw-sem-ir --builtin-sem-ir %s
5+
// EXTRA-ARGS: --no-prelude-import --dump-raw-sem-ir --builtin-sem-ir
66
//
77
// AUTOUPDATE
88
// TIP: To test this file alone, run:
9-
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/no_prelude/dump_raw_builtins.carbon
9+
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/raw_sem_ir/builtins.carbon
1010
// TIP: To dump output, run:
11-
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/no_prelude/dump_raw_builtins.carbon
11+
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/builtins.carbon
1212

1313
// CHECK:STDOUT: ---
14-
// CHECK:STDOUT: filename: dump_raw_builtins.carbon
14+
// CHECK:STDOUT: filename: builtins.carbon
1515
// CHECK:STDOUT: sem_ir:
1616
// CHECK:STDOUT: import_irs:
1717
// CHECK:STDOUT: ir0: {decl_id: inst<none>, is_export: false}
@@ -74,3 +74,4 @@
7474
// CHECK:STDOUT: inst_block4:
7575
// CHECK:STDOUT: 0: inst14
7676
// CHECK:STDOUT: ...
77+
// CHECK:STDOUT:

toolchain/driver/testdata/compile/multifile_raw_ir.carbon renamed to toolchain/check/testdata/basics/raw_sem_ir/multifile.carbon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --phase=check --dump-raw-sem-ir %s
5+
// EXTRA-ARGS: --no-prelude-import --dump-raw-sem-ir --no-dump-sem-ir
66
//
77
// Check that raw IR dumping works as expected.
88
//
99
// AUTOUPDATE
1010
// TIP: To test this file alone, run:
11-
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/multifile_raw_ir.carbon
11+
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/raw_sem_ir/multifile.carbon
1212
// TIP: To dump output, run:
13-
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/multifile_raw_ir.carbon
13+
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/multifile.carbon
1414

1515
// --- a.carbon
1616
package A;

toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon renamed to toolchain/check/testdata/basics/raw_sem_ir/multifile_with_textual_ir.carbon

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --phase=check --dump-sem-ir --dump-raw-sem-ir %s
5+
// EXTRA-ARGS: --no-prelude-import --dump-raw-sem-ir --dump-sem-ir-ranges=if-present
66
//
77
// Check that we can combine textual IR and raw IR dumping in one compile.
88
//
99
// AUTOUPDATE
1010
// TIP: To test this file alone, run:
11-
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon
11+
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/raw_sem_ir/multifile_with_textual_ir.carbon
1212
// TIP: To dump output, run:
13-
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/multifile_raw_and_textual_ir.carbon
13+
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/multifile_with_textual_ir.carbon
1414

1515
// --- a.carbon
1616
package A;

toolchain/driver/testdata/compile/raw_ir.carbon renamed to toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --phase=check --dump-raw-sem-ir %s
5+
// EXTRA-ARGS: --no-prelude-import --dump-raw-sem-ir --no-dump-sem-ir
66
//
77
// Check that raw IR dumping works as expected.
88
//
99
// AUTOUPDATE
1010
// TIP: To test this file alone, run:
11-
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/raw_ir.carbon
11+
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon
1212
// TIP: To dump output, run:
13-
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/raw_ir.carbon
13+
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/one_file.carbon
1414

1515
fn Foo[T:! type](n: T) -> (T, ()) {
1616
return (n, ());
1717
}
1818

1919
// CHECK:STDOUT: ---
20-
// CHECK:STDOUT: filename: raw_ir.carbon
20+
// CHECK:STDOUT: filename: one_file.carbon
2121
// CHECK:STDOUT: sem_ir:
2222
// CHECK:STDOUT: import_irs:
2323
// CHECK:STDOUT: ir0: {decl_id: inst<none>, is_export: false}

toolchain/driver/testdata/compile/raw_and_textual_ir.carbon renamed to toolchain/check/testdata/basics/raw_sem_ir/one_file_with_textual_ir.carbon

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --phase=check --dump-sem-ir --dump-raw-sem-ir %s
5+
// EXTRA-ARGS: --no-prelude-import --dump-raw-sem-ir --dump-sem-ir-ranges=if-present
66
//
77
// Check that we can combine textual IR and raw IR dumping in one compile.
88
//
99
// AUTOUPDATE
1010
// TIP: To test this file alone, run:
11-
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/driver/testdata/compile/raw_and_textual_ir.carbon
11+
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/basics/raw_sem_ir/one_file_with_textual_ir.carbon
1212
// TIP: To dump output, run:
13-
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/driver/testdata/compile/raw_and_textual_ir.carbon
13+
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/basics/raw_sem_ir/one_file_with_textual_ir.carbon
1414

1515
fn Foo(n: ()) -> ((), ()) {
1616
return (n, ());
1717
}
1818

1919
// CHECK:STDOUT: ---
20-
// CHECK:STDOUT: filename: raw_and_textual_ir.carbon
20+
// CHECK:STDOUT: filename: one_file_with_textual_ir.carbon
2121
// CHECK:STDOUT: sem_ir:
2222
// CHECK:STDOUT: import_irs:
2323
// CHECK:STDOUT: ir0: {decl_id: inst<none>, is_export: false}
@@ -186,7 +186,7 @@ fn Foo(n: ()) -> ((), ()) {
186186
// CHECK:STDOUT: 1: inst36
187187
// CHECK:STDOUT: ...
188188
// CHECK:STDOUT:
189-
// CHECK:STDOUT: --- raw_and_textual_ir.carbon
189+
// CHECK:STDOUT: --- one_file_with_textual_ir.carbon
190190
// CHECK:STDOUT:
191191
// CHECK:STDOUT: constants {
192192
// CHECK:STDOUT: %empty_tuple.type: type = tuple_type () [concrete]

toolchain/codegen/testdata/assembly/basic.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --target=x86_64-unknown-linux-gnu --output=- %s
5+
// EXTRA-ARGS: --no-prelude-import --target=x86_64-unknown-linux-gnu --output=-
66
//
77
// To test this file alone, run:
88
// bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/codegen/testdata/assembly/basic.carbon

toolchain/codegen/testdata/fail_target_triple.carbon

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --target=x86_687-unknown-linux-gnu --output=- %s
5+
// EXTRA-ARGS: --no-prelude-import --target=x86_687-unknown-linux-gnu --output=-
6+
//
67
// No autoupdate because the message comes from LLVM.
78
// To test this file alone, run:
89
// bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/codegen/testdata/fail_target_triple.carbon

toolchain/codegen/testdata/objcode/basic.carbon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Exceptions. See /LICENSE for license information.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44
//
5-
// ARGS: --include-diagnostic-kind compile --no-prelude-import --target=x86_64-unknown-linux-gnu --output=%t %s
5+
// EXTRA-ARGS: --no-prelude-import --target=x86_64-unknown-linux-gnu --output=%t
66
//
77
// TODO: Add a way to write some basic tests for object file outputs.
88
// AUTOUPDATE

toolchain/diagnostics/BUILD

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ load("//bazel/manifest:defs.bzl", "manifest")
77

88
package(default_visibility = ["//visibility:public"])
99

10-
filegroup(
11-
name = "testdata",
12-
srcs = glob(["testdata/**/*.carbon"]),
13-
)
14-
1510
cc_library(
1611
name = "diagnostic_emitter",
1712
srcs = [

toolchain/diagnostics/testdata/fail_multiline_token.carbon

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)