mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-05 22:02:55 +01:00
Merge and label stdout/stderr for FileCheck (#2283)
Adds a simple script to merge stdout/stderr and put on labels. This is hidden to the RUN line using lit.cfg.py. This is my solution to addressing how errors printed by the toolchain break sorting of stdout output; just put stdout first. We could also have toggles for interleaving output or such, which might help test whether we do it properly. This also moves some previous-distributed replacement logic into lit_autoupdate_base.py: I think having that adjacent to lit.cfg.py is probably the better choice, and it reduces duplication in toolchain scripts. It happens here because I need to change the resulting commands to include the merge.
This commit is contained in:
+3
-3
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: -2
|
||||
// CHECK:STDOUT: result: -2
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 0
|
||||
// CHECK:STDOUT: result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-3
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -11,7 +11,7 @@ package ExplorerTest api;
|
||||
fn Bad[T:! Type](x: {.a: i32, .b: T}) {}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T}`
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_extra_field.carbon:[[@LINE+1]]: mismatch in field names, source field `c` not in destination type `{.a: i32, .b: T}`
|
||||
Bad({.b = 5, .a = 7, .c = 2});
|
||||
return 0;
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -11,7 +11,7 @@ package ExplorerTest api;
|
||||
fn Bad[T:! Type](x: {.a: i32, .b: T}) {}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}`
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_implicit_conversion_missing_field.carbon:[[@LINE+1]]: mismatch in field names, destination field `b` not in source type `{.a: i32}`
|
||||
Bad({.a = 5});
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,13 +2,13 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK:SYNTAX ERROR: {{.*}}/explorer/testdata/generic_function/fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
|
||||
// CHECK:STDERR: SYNTAX ERROR: {{.*}}/explorer/testdata/generic_function/fail_missing_exclam.carbon:[[@LINE+1]]: illegal binding pattern in implicit parameter list
|
||||
fn F[T: Type]();
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
fn id[T:! Type](x: T) -> T {
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
|
||||
// CHECK:could not find implementation of interface AddWith(U = i32) for T
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_addable.carbon:[[@LINE+2]]: type error in `+`:
|
||||
// CHECK:STDERR: could not find implementation of interface AddWith(U = i32) for T
|
||||
return x + 0;
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -2,13 +2,13 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: Expected a type, but got 42
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_not_type.carbon:[[@LINE+1]]: Expected a type, but got 42
|
||||
fn F[a:! 42]();
|
||||
|
||||
fn Main() -> i32 {
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -13,8 +13,8 @@ fn fst[T:! Type](x: T, y: T) -> T {
|
||||
}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type:
|
||||
// CHECK: i32
|
||||
// CHECK: bool
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_mismatch.carbon:[[@LINE+3]]: deduced multiple different values for T:! Type:
|
||||
// CHECK:STDERR: i32
|
||||
// CHECK:STDERR: bool
|
||||
return fst(0, true);
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package ExplorerTest api;
|
||||
@@ -13,6 +13,6 @@ fn id[T:! Type](x: i32) -> i32 {
|
||||
}
|
||||
|
||||
fn Main() -> i32 {
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_unused.carbon:[[@LINE+1]]: could not deduce type argument for type parameter T in call
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_type_deduction_unused.carbon:[[@LINE+1]]: could not deduce type argument for type parameter T in call
|
||||
return id(0);
|
||||
}
|
||||
|
||||
+3
-3
@@ -2,8 +2,8 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{not} %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{not} %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{not} %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
|
||||
package Foo api;
|
||||
@@ -15,7 +15,7 @@ fn Get[T:! ()](n: T) -> i32 { return 2; }
|
||||
|
||||
fn Main() -> i32 {
|
||||
var x : X = {};
|
||||
// CHECK:COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
|
||||
// CHECK:STDERR: COMPILATION ERROR: {{.*}}/explorer/testdata/generic_function/fail_wrong_variable_substituation.carbon:[[@LINE+1]]: cannot convert deduced value class X for T to parameter type ()
|
||||
Get(x);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 0
|
||||
// CHECK:STDOUT: result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 4213
|
||||
// CHECK:STDOUT: result: 4213
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 1
|
||||
// CHECK:STDOUT: result: 1
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 1
|
||||
// CHECK:STDOUT: result: 1
|
||||
|
||||
package ExplorerTest api;
|
||||
class A(T:! Type) {
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 0
|
||||
// CHECK:STDOUT: result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 0
|
||||
// CHECK:STDOUT: result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 1
|
||||
// CHECK:STDOUT: result: 1
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
+3
-3
@@ -2,10 +2,10 @@
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
// RUN: %{explorer} %s 2>&1 | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s 2>&1 | %{FileCheck-allow-unmatched} %s
|
||||
// RUN: %{explorer} %s | %{FileCheck-strict} %s
|
||||
// RUN: %{explorer-trace} %s | %{FileCheck-allow-unmatched} %s
|
||||
// AUTOUPDATE: %{explorer} %s
|
||||
// CHECK:result: 0
|
||||
// CHECK:STDOUT: result: 0
|
||||
|
||||
package ExplorerTest api;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user