mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-03 10:25:49 +01: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.
39 lines
1.8 KiB
Plaintext
39 lines
1.8 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/lower/testdata/operators/assignment.carbon
|
|
// TIP: To dump output, run:
|
|
// TIP: bazel run //toolchain/testing:file_test -- --dump_output --file_tests=toolchain/lower/testdata/operators/assignment.carbon
|
|
|
|
fn Main() {
|
|
var a: i32 = 12;
|
|
a = 9;
|
|
var b: (i32, i32);
|
|
b = (1, 2);
|
|
}
|
|
|
|
// CHECK:STDOUT: ; ModuleID = 'assignment.carbon'
|
|
// CHECK:STDOUT: source_filename = "assignment.carbon"
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: @tuple.loc15_5 = internal constant { i32, i32 } { i32 1, i32 2 }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: define void @Main() {
|
|
// CHECK:STDOUT: entry:
|
|
// CHECK:STDOUT: %a.var = alloca i32, align 4
|
|
// CHECK:STDOUT: store i32 12, ptr %a.var, align 4
|
|
// CHECK:STDOUT: store i32 9, ptr %a.var, align 4
|
|
// CHECK:STDOUT: %b.var = alloca { i32, i32 }, align 8
|
|
// CHECK:STDOUT: %.loc15_12.2.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 0
|
|
// CHECK:STDOUT: %.loc15_12.4.tuple.elem = getelementptr inbounds { i32, i32 }, ptr %b.var, i32 0, i32 1
|
|
// CHECK:STDOUT: call void @llvm.memcpy.p0.p0.i64(ptr align 4 %b.var, ptr align 4 @tuple.loc15_5, i64 8, i1 false)
|
|
// CHECK:STDOUT: ret void
|
|
// CHECK:STDOUT: }
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: ; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
|
|
// CHECK:STDOUT: declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #0
|
|
// CHECK:STDOUT:
|
|
// CHECK:STDOUT: attributes #0 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
|