mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-11-23 15:52:42 +00:00
This has is a nice-to-have for me. Frequently I want to run a specific test, and end up digging through output to be able to copy-paste the run line. This uses TIP lines to inject the command into the file when using AUTOUPDATE. Note, one of the reasons I want this is because "bazel test //toolchain/testing:file_test --test_output=all" has been regularly exceeding bazel's output limit for me (workaround is either opening the output file or specifying an obscure output limit flag), making it a little harder for me to get the commands. However, frequently I'm adding a file and want to iterate on it, so that's really the use case I have in mind here.
99 lines
6.4 KiB
Plaintext
99 lines
6.4 KiB
Plaintext
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
|
// Exceptions. See /LICENSE for license information.
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
|
//
|
|
// AUTOUPDATE
|
|
// TIP: To test this file alone, run:
|
|
// TIP: bazel test //toolchain/testing:file_test --test_arg=--file_tests=toolchain/check/testdata/eval/fail_aggregate.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/check/testdata/eval/fail_aggregate.carbon
|
|
|
|
// TODO: This creates an array temporary, which we don't yet support evaluating.
|
|
|
|
// CHECK:STDERR: fail_aggregate.carbon:[[@LINE+3]]:43: ERROR: Array bound is not a constant.
|
|
// CHECK:STDERR: var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]];
|
|
// CHECK:STDERR: ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
var array_index: [i32; 1] = (0,) as [i32; ((5, 7, 1, 9) as [i32; 4])[2]];
|
|
|
|
// CHECK:STDOUT: --- fail_aggregate.carbon
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: constants {
|
|
// CHECK:STDOUT: %Int32: type = fn_type @Int32 [template]
|
|
// CHECK:STDOUT: %.1: type = tuple_type () [template]
|
|
// CHECK:STDOUT: %struct: Int32 = struct_value () [template]
|
|
// CHECK:STDOUT: %.2: i32 = int_literal 1 [template]
|
|
// CHECK:STDOUT: %.3: type = array_type %.2, i32 [template]
|
|
// CHECK:STDOUT: %.4: type = ptr_type [i32; 1] [template]
|
|
// CHECK:STDOUT: %.5: i32 = int_literal 0 [template]
|
|
// CHECK:STDOUT: %.6: type = tuple_type (i32) [template]
|
|
// CHECK:STDOUT: %.7: i32 = int_literal 5 [template]
|
|
// CHECK:STDOUT: %.8: i32 = int_literal 7 [template]
|
|
// CHECK:STDOUT: %.9: i32 = int_literal 9 [template]
|
|
// CHECK:STDOUT: %.10: type = tuple_type (i32, i32, i32, i32) [template]
|
|
// CHECK:STDOUT: %.11: i32 = int_literal 4 [template]
|
|
// CHECK:STDOUT: %.12: type = array_type %.11, i32 [template]
|
|
// CHECK:STDOUT: %.13: type = ptr_type [i32; 4] [template]
|
|
// CHECK:STDOUT: %.14: i32 = int_literal 2 [template]
|
|
// CHECK:STDOUT: %.15: i32 = int_literal 3 [template]
|
|
// CHECK:STDOUT: %array: [i32; 4] = tuple_value (%.7, %.8, %.2, %.9) [template]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: file {
|
|
// CHECK:STDOUT: package: <namespace> = namespace [template] {
|
|
// CHECK:STDOUT: .Core = %Core
|
|
// CHECK:STDOUT: .array_index = %array_index
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT: %Core: <namespace> = namespace [template] {}
|
|
// CHECK:STDOUT: %import_ref.1: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: %int.make_type_32: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %.loc16_24: i32 = int_literal 1 [template = constants.%.2]
|
|
// CHECK:STDOUT: %.loc16_19.1: type = value_of_initializer %int.make_type_32 [template = i32]
|
|
// CHECK:STDOUT: %.loc16_19.2: type = converted %int.make_type_32, %.loc16_19.1 [template = i32]
|
|
// CHECK:STDOUT: %.loc16_25: type = array_type %.loc16_24, i32 [template = constants.%.3]
|
|
// CHECK:STDOUT: %array_index.var: ref [i32; 1] = var array_index
|
|
// CHECK:STDOUT: %array_index: ref [i32; 1] = bind_name array_index, %array_index.var
|
|
// CHECK:STDOUT: %import_ref.2: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: %import_ref.3: Int32 = import_ref ir3, inst+3, loaded [template = constants.%struct]
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @Int32() -> type = "int.make_type_32";
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: fn @__global_init() {
|
|
// CHECK:STDOUT: !entry:
|
|
// CHECK:STDOUT: %.loc16_30: i32 = int_literal 0 [template = constants.%.5]
|
|
// CHECK:STDOUT: %.loc16_32: (i32,) = tuple_literal (%.loc16_30)
|
|
// CHECK:STDOUT: %int.make_type_32.loc16_38: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %.loc16_45: i32 = int_literal 5 [template = constants.%.7]
|
|
// CHECK:STDOUT: %.loc16_48: i32 = int_literal 7 [template = constants.%.8]
|
|
// CHECK:STDOUT: %.loc16_51: i32 = int_literal 1 [template = constants.%.2]
|
|
// CHECK:STDOUT: %.loc16_54: i32 = int_literal 9 [template = constants.%.9]
|
|
// CHECK:STDOUT: %.loc16_55.1: (i32, i32, i32, i32) = tuple_literal (%.loc16_45, %.loc16_48, %.loc16_51, %.loc16_54)
|
|
// CHECK:STDOUT: %int.make_type_32.loc16_61: init type = call constants.%struct() [template = i32]
|
|
// CHECK:STDOUT: %.loc16_66: i32 = int_literal 4 [template = constants.%.11]
|
|
// CHECK:STDOUT: %.loc16_61.1: type = value_of_initializer %int.make_type_32.loc16_61 [template = i32]
|
|
// CHECK:STDOUT: %.loc16_61.2: type = converted %int.make_type_32.loc16_61, %.loc16_61.1 [template = i32]
|
|
// CHECK:STDOUT: %.loc16_67: type = array_type %.loc16_66, i32 [template = constants.%.12]
|
|
// CHECK:STDOUT: %.loc16_55.2: ref [i32; 4] = temporary_storage
|
|
// CHECK:STDOUT: %.loc16_55.3: i32 = int_literal 0 [template = constants.%.5]
|
|
// CHECK:STDOUT: %.loc16_55.4: ref i32 = array_index %.loc16_55.2, %.loc16_55.3
|
|
// CHECK:STDOUT: %.loc16_55.5: init i32 = initialize_from %.loc16_45 to %.loc16_55.4 [template = constants.%.7]
|
|
// CHECK:STDOUT: %.loc16_55.6: i32 = int_literal 1 [template = constants.%.2]
|
|
// CHECK:STDOUT: %.loc16_55.7: ref i32 = array_index %.loc16_55.2, %.loc16_55.6
|
|
// CHECK:STDOUT: %.loc16_55.8: init i32 = initialize_from %.loc16_48 to %.loc16_55.7 [template = constants.%.8]
|
|
// CHECK:STDOUT: %.loc16_55.9: i32 = int_literal 2 [template = constants.%.14]
|
|
// CHECK:STDOUT: %.loc16_55.10: ref i32 = array_index %.loc16_55.2, %.loc16_55.9
|
|
// CHECK:STDOUT: %.loc16_55.11: init i32 = initialize_from %.loc16_51 to %.loc16_55.10 [template = constants.%.2]
|
|
// CHECK:STDOUT: %.loc16_55.12: i32 = int_literal 3 [template = constants.%.15]
|
|
// CHECK:STDOUT: %.loc16_55.13: ref i32 = array_index %.loc16_55.2, %.loc16_55.12
|
|
// CHECK:STDOUT: %.loc16_55.14: init i32 = initialize_from %.loc16_54 to %.loc16_55.13 [template = constants.%.9]
|
|
// CHECK:STDOUT: %.loc16_55.15: init [i32; 4] = array_init (%.loc16_55.5, %.loc16_55.8, %.loc16_55.11, %.loc16_55.14) to %.loc16_55.2 [template = constants.%array]
|
|
// CHECK:STDOUT: %.loc16_57.1: init [i32; 4] = converted %.loc16_55.1, %.loc16_55.15 [template = constants.%array]
|
|
// CHECK:STDOUT: %.loc16_70: i32 = int_literal 2 [template = constants.%.14]
|
|
// CHECK:STDOUT: %.loc16_57.2: ref [i32; 4] = temporary %.loc16_55.2, %.loc16_57.1
|
|
// CHECK:STDOUT: %.loc16_71.1: ref i32 = array_index %.loc16_57.2, %.loc16_70
|
|
// CHECK:STDOUT: %.loc16_71.2: i32 = bind_value %.loc16_71.1
|
|
// CHECK:STDOUT: assign file.%array_index.var, <error>
|
|
// CHECK:STDOUT: return
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|