-
Notifications
You must be signed in to change notification settings - Fork 246
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix running tests with
RUST_BACKTRACE=1
(#1761)
The previous version of test output used the `:?` formatter for `anyhow::Error` which would include the native backtrace when `RUST_BACKTRACE=1` is set. This commit updates formatters to use `:#` which is a bit less readable but doesn't include the backtrace when this env var is set. Additionally a test is added to CI to ensure this doesn't regress in the future. This is adapted from #1578. Closes #1578
- Loading branch information
1 parent
d4a6dc2
commit c4a77ae
Showing
58 changed files
with
192 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-default-export-sig-mismatch/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: type mismatch for function `a`: expected `[I32, I32] -> [I32]` but found `[] -> []` | ||
failed to decode world from module: module was not valid: type mismatch for function `a`: expected `[I32, I32] -> [I32]` but found `[] -> []` |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-empty-module-import/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: no top-level imported function `foo` specified | ||
failed to decode world from module: module was not valid: no top-level imported function `foo` specified |
7 changes: 1 addition & 6 deletions
7
crates/wit-component/tests/components/error-export-sig-mismatch/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: failed to validate exported interface `foo` | ||
2: type mismatch for function `a`: expected `[I32, I32] -> [I32]` but found `[] -> []` | ||
failed to decode world from module: module was not valid: failed to validate exported interface `foo`: type mismatch for function `a`: expected `[I32, I32] -> [I32]` but found `[] -> []` |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-import-resource-rep/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: no top-level imported function `[resource-rep]a` specified | ||
failed to decode world from module: module was not valid: no top-level imported function `[resource-rep]a` specified |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-import-resource-wrong-signature/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: type mismatch for function `[resource-drop]a`: expected `[I32] -> []` but found `[I32] -> [I32]` | ||
failed to decode world from module: module was not valid: type mismatch for function `[resource-drop]a`: expected `[I32] -> []` but found `[I32] -> [I32]` |
7 changes: 1 addition & 6 deletions
7
crates/wit-component/tests/components/error-import-sig-mismatch/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: failed to validate import interface `foo` | ||
2: type mismatch for function `bar`: expected `[I32, I32] -> []` but found `[] -> []` | ||
failed to decode world from module: module was not valid: failed to validate import interface `foo`: type mismatch for function `bar`: expected `[I32, I32] -> []` but found `[] -> []` |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-invalid-module-import/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: module is only allowed to import functions | ||
failed to decode world from module: module was not valid: module is only allowed to import functions |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-missing-default-export/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: module does not export required function `a` | ||
failed to decode world from module: module was not valid: module does not export required function `a` |
7 changes: 1 addition & 6 deletions
7
crates/wit-component/tests/components/error-missing-export/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: failed to validate exported interface `foo` | ||
2: module does not export required function `foo#a` | ||
failed to decode world from module: module was not valid: failed to validate exported interface `foo`: module does not export required function `foo#a` |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-missing-import-func/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: module requires an import interface named `foo` | ||
failed to decode world from module: module was not valid: module requires an import interface named `foo` |
6 changes: 1 addition & 5 deletions
6
crates/wit-component/tests/components/error-missing-import/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to decode world from module | ||
|
||
Caused by: | ||
0: module was not valid | ||
1: module requires an import interface named `foo` | ||
failed to decode world from module: module was not valid: module requires an import interface named `foo` |
5 changes: 1 addition & 4 deletions
5
crates/wit-component/tests/components/error-missing-module-metadata/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
failed to register indirect shims for main module | ||
|
||
Caused by: | ||
missing component metadata for import of `new::log` | ||
failed to register indirect shims for main module: missing component metadata for import of `new::log` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge interface `a` | ||
1: expected type `a` to be present | ||
failed to merge package `foo:foo` into existing copy: failed to merge interface `a`: expected type `a` to be present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge interface `a` | ||
1: expected function `a` to be present | ||
failed to merge package `foo:foo` into existing copy: failed to merge interface `a`: expected function `a` to be present |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge world `foo` | ||
1: import `b` not found in target world | ||
failed to merge package `foo:foo` into existing copy: failed to merge world `foo`: import `b` not found in target world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge world `foo` | ||
1: world contains different number of imports than expected | ||
failed to merge package `foo:foo` into existing copy: failed to merge world `foo`: world contains different number of imports than expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge world `foo` | ||
1: world contains different number of exports than expected | ||
failed to merge package `foo:foo` into existing copy: failed to merge world `foo`: world contains different number of exports than expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge world `foo` | ||
1: export `b` not found in target world | ||
failed to merge package `foo:foo` into existing copy: failed to merge world `foo`: export `b` not found in target world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1 @@ | ||
failed to merge package `foo:foo` into existing copy | ||
|
||
Caused by: | ||
0: failed to merge world `foo` | ||
1: import `a` not found in target world | ||
failed to merge package `foo:foo` into existing copy: failed to merge world `foo`: import `a` not found in target world |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 2 additions & 5 deletions
7
crates/wit-component/tests/targets/error-missing-export/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
failed to validate encoded bytes | ||
|
||
Caused by: | ||
type mismatch for import `foobar` | ||
missing export named `test:foo/bar` (at offset 0x1d5) | ||
failed to validate encoded bytes: type mismatch for import `foobar` | ||
missing export named `test:foo/bar` (at offset 0x1d5) |
7 changes: 2 additions & 5 deletions
7
crates/wit-component/tests/targets/error-missing-import/error.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,2 @@ | ||
failed to validate encoded bytes | ||
|
||
Caused by: | ||
type mismatch for import `foobar` | ||
missing import named `test:foo/foo` (at offset 0x175) | ||
failed to validate encoded bytes: type mismatch for import `foobar` | ||
missing import named `test:foo/foo` (at offset 0x175) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
this type is not gated by a feature but its interface is gated by a feature | ||
|
||
Caused by: | ||
found a reference to a interface which is excluded due to its feature not being activated | ||
--> tests/ui/parse-fail/bad-gate3.wit:5:8 | ||
| | ||
5 | type a = u32; | ||
| ^ | ||
this type is not gated by a feature but its interface is gated by a feature: found a reference to a interface which is excluded due to its feature not being activated | ||
--> tests/ui/parse-fail/bad-gate3.wit:5:8 | ||
| | ||
5 | type a = u32; | ||
| ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to update function `[constructor]a` | ||
|
||
Caused by: | ||
found a reference to a type which is excluded due to its feature not being activated | ||
--> tests/ui/parse-fail/bad-gate4.wit:6:5 | ||
| | ||
6 | constructor(); | ||
| ^---------- | ||
failed to update function `[constructor]a`: found a reference to a type which is excluded due to its feature not being activated | ||
--> tests/ui/parse-fail/bad-gate4.wit:6:5 | ||
| | ||
6 | constructor(); | ||
| ^---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to update function `[static]a.x` | ||
|
||
Caused by: | ||
found a reference to a type which is excluded due to its feature not being activated | ||
--> tests/ui/parse-fail/bad-gate5.wit:9:5 | ||
| | ||
9 | x: static func(); | ||
| ^ | ||
failed to update function `[static]a.x`: found a reference to a type which is excluded due to its feature not being activated | ||
--> tests/ui/parse-fail/bad-gate5.wit:9:5 | ||
| | ||
9 | x: static func(); | ||
| ^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg1] | ||
|
||
Caused by: | ||
0: failed to parse package: tests/ui/parse-fail/bad-pkg1 | ||
1: interface or world `nonexistent` not found in package | ||
--> tests/ui/parse-fail/bad-pkg1/root.wit:4:7 | ||
| | ||
4 | use nonexistent.{}; | ||
| ^---------- | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg1]: failed to parse package: tests/ui/parse-fail/bad-pkg1: interface or world `nonexistent` not found in package | ||
--> tests/ui/parse-fail/bad-pkg1/root.wit:4:7 | ||
| | ||
4 | use nonexistent.{}; | ||
| ^---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg2] | ||
|
||
Caused by: | ||
interface not found in package | ||
--> tests/ui/parse-fail/bad-pkg2/root.wit:4:15 | ||
| | ||
4 | use foo:bar/nonexistent.{}; | ||
| ^---------- | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg2]: interface not found in package | ||
--> tests/ui/parse-fail/bad-pkg2/root.wit:4:15 | ||
| | ||
4 | use foo:bar/nonexistent.{}; | ||
| ^---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg3] | ||
|
||
Caused by: | ||
interface not found in package | ||
--> tests/ui/parse-fail/bad-pkg3/root.wit:4:15 | ||
| | ||
4 | use foo:bar/baz.{}; | ||
| ^-- | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg3]: interface not found in package | ||
--> tests/ui/parse-fail/bad-pkg3/root.wit:4:15 | ||
| | ||
4 | use foo:bar/baz.{}; | ||
| ^-- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg4] | ||
|
||
Caused by: | ||
type `a-name` not defined in interface | ||
--> tests/ui/parse-fail/bad-pkg4/root.wit:3:20 | ||
| | ||
3 | use foo:bar/baz.{a-name}; | ||
| ^----- | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg4]: type `a-name` not defined in interface | ||
--> tests/ui/parse-fail/bad-pkg4/root.wit:3:20 | ||
| | ||
3 | use foo:bar/baz.{a-name}; | ||
| ^----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg5] | ||
|
||
Caused by: | ||
type `nonexistent` not defined in interface | ||
--> tests/ui/parse-fail/bad-pkg5/root.wit:3:20 | ||
| | ||
3 | use foo:bar/baz.{nonexistent}; | ||
| ^---------- | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg5]: type `nonexistent` not defined in interface | ||
--> tests/ui/parse-fail/bad-pkg5/root.wit:3:20 | ||
| | ||
3 | use foo:bar/baz.{nonexistent}; | ||
| ^---------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,5 @@ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg6] | ||
|
||
Caused by: | ||
package not found | ||
--> tests/ui/parse-fail/bad-pkg6/root.wit:3:7 | ||
| | ||
3 | use foo:bar/baz.{}; | ||
| ^------ | ||
failed to resolve directory while parsing WIT for path [tests/ui/parse-fail/bad-pkg6]: package not found | ||
--> tests/ui/parse-fail/bad-pkg6/root.wit:3:7 | ||
| | ||
3 | use foo:bar/baz.{}; | ||
| ^------ |
Oops, something went wrong.