Provide local paths for file tests. (#2830)

The intent of this change is that instead of paths looking like `explorer/testdata/foo/bar.carbon` (repo-relative), they're now just `bar.carbon` (local). The consequence is that paths should be a bit more durable in various environments, and just paths should be shorter and easier to read.

The explorer's prelude is an exception to this since it comes from data, rather than being the test target. Due to the change in approaches, it needs the regex again.

Uses #2829
This commit is contained in:
Jon Ross-Perkins
2023-05-18 10:20:51 -07:00
committed by GitHub
parent 3c15882f4e
commit 6b7a522b3f
495 changed files with 701 additions and 641 deletions
+1 -1
View File
@@ -9,6 +9,6 @@ package ExplorerTest api;
var x: i32;
fn Main() -> i32 {
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/unformed/dynamic/fail_global.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
// CHECK:STDERR: RUNTIME ERROR: fail_global.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
return x;
}
+1 -1
View File
@@ -16,6 +16,6 @@ fn Main() -> i32 {
x = 0;
}
// Static analysis thinks `x` may be formed, defer the check to run-time.
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/unformed/dynamic/fail_param.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
// CHECK:STDERR: RUNTIME ERROR: fail_param.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
return AddInt(x, 2);
}
@@ -13,6 +13,6 @@ fn Main() -> i32 {
y = 0;
}
// Static analysis thinks `y` may be formed, defer the check to run-time.
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/unformed/dynamic/fail_pattern_declare.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<y>>
// CHECK:STDERR: RUNTIME ERROR: fail_pattern_declare.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<y>>
return y;
}
+1 -1
View File
@@ -12,6 +12,6 @@ fn Main() -> i32 {
x = 0;
}
// Static analysis thinks `x` may be formed, defer the check to run-time.
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/unformed/dynamic/fail_return.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
// CHECK:STDERR: RUNTIME ERROR: fail_return.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
return x;
}
@@ -12,6 +12,6 @@ fn Main() -> i32 {
x = 0;
}
// Static analysis thinks `x` may be formed, defer the check to run-time.
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/unformed/dynamic/fail_returned_var.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
// CHECK:STDERR: RUNTIME ERROR: fail_returned_var.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
return var;
}
+1 -1
View File
@@ -13,7 +13,7 @@ fn Main() -> i32 {
x = 0;
}
// Static analysis thinks `x` may be formed, defer the check to run-time.
// CHECK:STDERR: RUNTIME ERROR: explorer/testdata/unformed/dynamic/fail_rhs_assign.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
// CHECK:STDERR: RUNTIME ERROR: fail_rhs_assign.carbon:[[@LINE+1]]: undefined behavior: access to uninitialized value Uninit<Placeholder<x>>
y = x;
return y;
}
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_compound_assign.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_compound_assign.carbon:[[@LINE+1]]: use of uninitialized variable x
x += 1;
return x;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_field_value.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_field_value.carbon:[[@LINE+1]]: use of uninitialized variable x
var p: auto = {.x = x,};
return 0;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_if_cond.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_if_cond.carbon:[[@LINE+1]]: use of uninitialized variable x
if (x == 0) {
return 0;
}
+1 -1
View File
@@ -13,7 +13,7 @@ fn Main() -> i32 {
if (Foo() == 0) {
return 0;
} else {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_if_else.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_if_else.carbon:[[@LINE+1]]: use of uninitialized variable x
return x;
}
}
+1 -1
View File
@@ -11,7 +11,7 @@ fn Foo() -> i32;
fn Main() -> i32 {
var x: i32;
if (Foo() == 0) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_if_then.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_if_then.carbon:[[@LINE+1]]: use of uninitialized variable x
return x;
}
return 1;
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_increment.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_increment.carbon:[[@LINE+1]]: use of uninitialized variable x
++x;
return x;
}
@@ -9,6 +9,6 @@ package ExplorerTest api;
fn Main() -> i32 {
var (x: i32, y: i32);
x = 1;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_local_pattern_declare.carbon:[[@LINE+1]]: use of uninitialized variable y
// CHECK:STDERR: COMPILATION ERROR: fail_local_pattern_declare.carbon:[[@LINE+1]]: use of uninitialized variable y
return y;
}
@@ -9,7 +9,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
var y: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_local_rhs_assign.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_local_rhs_assign.carbon:[[@LINE+1]]: use of uninitialized variable x
y = x;
return y;
}
+1 -1
View File
@@ -15,7 +15,7 @@ fn Main() -> i32 {
return 2;
}
case 1 => {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_match_clause.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_match_clause.carbon:[[@LINE+1]]: use of uninitialized variable x
return x;
}
default => {
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x : i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_match_expression.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_match_expression.carbon:[[@LINE+1]]: use of uninitialized variable x
match (x) {
case 0 => {
return 1;
+1 -1
View File
@@ -12,6 +12,6 @@ fn AddInt(a: i32, b: i32) -> auto {
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_param.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_param.carbon:[[@LINE+1]]: use of uninitialized variable x
return AddInt(x, 2);
}
+1 -1
View File
@@ -8,6 +8,6 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_return.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_return.carbon:[[@LINE+1]]: use of uninitialized variable x
return x;
}
+1 -1
View File
@@ -8,6 +8,6 @@ package ExplorerTest api;
fn Main() -> i32 {
returned var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_returned_var.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_returned_var.carbon:[[@LINE+1]]: use of uninitialized variable x
return var;
}
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var x: i32;
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_rhs_def.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_rhs_def.carbon:[[@LINE+1]]: use of uninitialized variable x
var y: i32 = x;
return x;
}
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var p: {.x: i32, .y: i32};
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_struct_member_access.carbon:[[@LINE+1]]: use of uninitialized variable p
// CHECK:STDERR: COMPILATION ERROR: fail_struct_member_access.carbon:[[@LINE+1]]: use of uninitialized variable p
p.x = p.y;
return 0;
}
+1 -1
View File
@@ -11,7 +11,7 @@ fn Foo() -> i32;
fn Main() -> i32 {
var (x: i32, y: i32);
while (Foo() == 0) {
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_while_body.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_while_body.carbon:[[@LINE+1]]: use of uninitialized variable x
y = x;
}
return 1;
+1 -1
View File
@@ -8,7 +8,7 @@ package ExplorerTest api;
fn Main() -> i32 {
var (x: i32, y: i32);
// CHECK:STDERR: COMPILATION ERROR: explorer/testdata/unformed/static/fail_while_cond.carbon:[[@LINE+1]]: use of uninitialized variable x
// CHECK:STDERR: COMPILATION ERROR: fail_while_cond.carbon:[[@LINE+1]]: use of uninitialized variable x
while (x == 0) {
y = 1;
}