424 Commits

Author SHA1 Message Date
Ed Page
1fe8ae6c3e docs(test): Document Execs
I'm intentionally being light as I want to pull in a lot of "lessons
learned" from the port to snapbox into the docs and want that as a
dedicated PR to make it easier for the contributors to that effort to
review it.
2024-07-22 08:58:52 -05:00
Ed Page
4674f2b84d docs(test): Organize docs for Execs 2024-07-22 08:58:52 -05:00
Ed Page
f42ae4c9c1 docs(test): Pull RawOutput from API
Its not used anywhere
2024-07-22 08:58:52 -05:00
Ed Page
7762d1f98c docs(test): Document cargo_exe 2024-07-22 08:58:52 -05:00
Ed Page
fa0e66e738 docs(test): Document git_process 2024-07-22 08:58:52 -05:00
Ed Page
504d377c8e docs(test): Document cargo_process 2024-07-22 08:58:52 -05:00
Ed Page
86945a211e docs(test): Document t! 2024-07-22 08:58:52 -05:00
Ed Page
ca9fc47fe0 docs(test): Add high level example 2024-07-22 08:58:52 -05:00
Ed Page
ad6abb54be docs(test): Verify they work 2024-07-22 08:58:52 -05:00
Ed Page
8e524ae561 docs(test): Link to two different docs builds 2024-07-22 08:58:52 -05:00
Ed Page
49deefe477 refactor(test): Reuse 'cargo_home' in more cases 2024-07-19 10:54:17 -05:00
Ed Page
b0e515aa61 fix(test): Move 'cargo_home' from 'install' to 'paths'
This is used outside of `cargo install` contexts and this makes it more
discoverable for those use cases.
2024-07-19 10:50:42 -05:00
bors
dad331c5ba Auto merge of #14269 - epage:test-ext, r=ehuss
fix(test)!: Clarify extension trait role with rename

When browsing the docs, I feel like this will make it easier to tell the role of these traits within the API.
Or in other words, I can easily tell that these fill a support role and for what, so I know when I care to look into them.

We use this naming pattern for
`cargo_test_support::paths::CargoPathExt`.
2024-07-19 15:11:26 +00:00
Ed Page
a49921f829 fix(test)!: Clarify extension trait role with rename
When browsing the docs, I feel like this will make it easier to tell the
role of these traits within the API.
Or in other words, I can easily tell that these fill a support role and
for what, so I know when I care to look into them.

We use this naming pattern for
`cargo_test_support::paths::CargoPathExt`.
2024-07-18 20:52:22 -05:00
Ed Page
879bc9e3c3 feat(test): Re-export ProcessBuilder
Since its tied heavily into the API, this should make it easier to use
and document.
2024-07-18 20:51:43 -05:00
bors
f10c069629 Auto merge of #14266 - epage:path2url, r=weihanglo
fix(test): Move path2url to CargoPathExt::to_url

### What does this PR try to resolve?

This is a small step, like #14243, to improve the clarity of `cargo-test-support`s API.

Overall, I'm trying to make it more obvious on https://docs.rs/cargo-test-support/latest/cargo_test_support/ which items to reach for when.  I figured this is one that could be demoted to `paths` When doing so, I noticed `CargoPathExt`. I figured if we had any extension traits for `Path`, then this is a
reasonable one to add.

### How should we test and review this PR?

### Additional information
2024-07-18 20:57:05 +00:00
Ed Page
d17322dccb fix(test): Move path2url to CargoPathExt::to_url
I was considering moving this into `paths` and noticed `CargoPathExt`.
I figured if we had any extension traits for `Path`, then this is a
reasonable one to add.
2024-07-18 15:41:26 -05:00
Ed Page
3a615ca9c8 feat(test): Add CargoPathExt to prelude 2024-07-18 15:22:29 -05:00
Ed Page
5d4ac652f5 feat(test): Offer CargPathExt for PathBuf 2024-07-18 14:51:57 -05:00
d1t2
df43a23235
test: Update HASH redaction for registry files 2024-07-16 23:07:06 +08:00
Ed Page
090064cc14 feat(test): Add cargo_test to test-support prelude 2024-07-12 15:56:22 -05:00
Ed Page
7fcd580b3b fix(test): Redact elapsed time in the minutes time frame
This came up in #14231
```
---- expected: tests/testsuite/lto.rs:611:27
++++ actual:   stderr
   1    1 | [FRESH] registry-shared v0.0.1
   2    2 | [FRESH] registry v0.0.1
   3    3 | [COMPILING] bar v0.0.0 ([ROOT]/foo/bar)
   4    4 | [RUNNING] `rustc --crate-name bar [..]-C lto [..]--test [..]`
   5    5 | [RUNNING] `rustc --crate-name b [..]-C lto [..]--test [..]`
   6      - [FINISHED] `release` profile [optimized] target(s) in [ELAPSED]s
   7    6 | [RUNNING] `[ROOT]/foo/target/release/deps/bar-[HASH][EXE]`
   8    7 | [RUNNING] `[ROOT]/foo/target/release/deps/b-[HASH][EXE]`
   9    8 | [DOCTEST] bar
  10    9 | [RUNNING] `rustdoc --edition=2015 --crate-type cdylib --crate-type rlib --crate-name bar --test [..]-C lto [..]
       10 + [FINISHED] `release` profile [optimized] target(s) in 1m 00s

Update with SNAPSHOTS=overwrite
```
2024-07-10 16:42:21 -05:00
Ed Page
5ed63926d3 test(test): Verify elapsed redaction 2024-07-10 16:40:47 -05:00
Ed Page
a10b3ca8b2 refactor(test): Split out 'pure' redactions for testing 2024-07-10 16:37:12 -05:00
Ed Page
c8113d3a1c refactor(test): Move compare tests into a mod 2024-07-10 16:33:14 -05:00
bors
753ae28c06 Auto merge of #14161 - choznerol:issue-14039-snapshot-port-freshness, r=weihanglo
test: Auto-redact `... after last build at ...`; Migrate `freshness` to Snapbox
2024-07-03 21:53:31 +00:00
Lawrence Chou
bbc18d7009
Auto-redact dirty reason like 1719325877.527949100s, 61549498ns after last build at 1719325877.466399602s
7dcf764cbc/src/cargo/core/compiler/fingerprint/dirty_reason.rs (L131)
2024-07-03 23:48:14 +08:00
bors
a0b280398c Auto merge of #14171 - heisen-li:dir_doc, r=weihanglo
test:migrate `doc/directory/docscrape` to snapbox

### What does this PR try to resolve?

Complete the following file migration:
```
 tests/testsuite/directory.rs
 tests/testsuite/doc.rs
 tests/testsuite/docscrape.rs
```

part of #14039
2024-07-03 03:09:49 +00:00
heisen-li
78983534df add opening redact 2024-07-03 09:59:13 +08:00
bors
9441b91186 Auto merge of #14159 - dieterplex:migrate-git-snapbox, r=weihanglo
test: Migrate git to snapbox

Part of #14039.

There is a case need to modify regex for file size redaction.
2024-06-28 13:05:10 +00:00
d1t2
ed027736e7
test: Allow redact file size w/o fraction
`cargo clean` shows file size without fraction in summary when the size
is lower than 1024. And we need to avoid matching things like `%2B%23..`
found in other test cases, the trailing `\s` is added to regex.
2024-06-27 16:58:52 +08:00
eth3lbert
03a0b5c999
Auto-redact not found 2024-06-27 12:55:34 +08:00
eth3lbert
cfabfe5467
test: Auto-redact target dir hashes 2024-06-23 11:10:15 +08:00
eth3lbert
91569f84b0
test: Add auto-redaction for not found error 2024-06-22 05:13:58 +08:00
Ed Page
fd8a91d185 fix(test): Un-redact Packaged files
This is a partial revert of ##14121
(e11d1722bb6e1e58c91adb1964993c74b45f4293)

Our focus for redacting (auto or with globs) includes
- run-specific information (timing, hashes, platform-specific wording)
- rustc-specific information

(We tend to use globs for rustc-specific information because there might
be some very specific times we need to care about some of the details)

However, "Packaged files" does not fit into any of that and, for now, we
are erring on the side of redacting less, rather than more, with the
move to snapbox.
As we see how it works out and what the underlying requirements are, we
can revisit this.
2024-06-21 11:05:41 -04:00
bors
922960916d Auto merge of #14121 - dieterplex:redact-file-num, r=weihanglo
test: Auto-redact file number

This is from <https://github.com/rust-lang/cargo/pull/14096#discussion_r1648889843>.

Although the number of files in `cargo package` is important,
we have `validate_crate_contents` and `validate_upload_with_contents`
that verify the exact contents.
Redacting `Packaged` status should be fine.
2024-06-21 13:14:27 +00:00
d1t2
e11d1722bb
test: Auto-redact file number 2024-06-19 20:00:56 +08:00
Weihang Lo
6a684edcb6
test: fix the [FINISHED] escape 2024-06-18 13:58:56 -04:00
Weihang Lo
153856fe14
test: prefer raw string for regex reduction 2024-06-18 13:58:13 -04:00
Weihang Lo
f4985827d7
chore: bump cargo-test-{support,macro} due to public API changes 2024-06-17 11:37:21 -04:00
Lawrence Chou
fde1321381
Remove Execs::run_expect_error to avoid #14076 2024-06-16 09:13:24 +08:00
renovate[bot]
a018e3a946
chore(deps): update msrv (1 version) to v1.79 2024-06-13 17:27:19 +00:00
Scott Schafer
190ef86d06
test: Auto-redact file hash 2024-06-12 13:27:08 -06:00
Scott Schafer
875a25fba7
test: Auto-redact exit status 2024-06-12 13:27:08 -06:00
Scott Schafer
02459b707f
test: Auto-redact bench timing results 2024-06-12 13:27:08 -06:00
Scott Schafer
6a7b15a61e
test: Auto-redact host target and alt target 2024-06-12 13:27:08 -06:00
Scott Schafer
d7de93777d
test: Only compile regex replacements once 2024-06-12 13:26:54 -06:00
Scott Schafer
6914c2958f
test: Merge common redactions 2024-06-12 09:28:24 -06:00
bors
4dcbca118a Auto merge of #13926 - tweag:overlay, r=epage
Add local registry overlays

This PR adds (private to cargo internals) support for local registry overlays, in which you can locally pretend to add packages to remote registries; the local packages will have the same source ids as the remote registry that you're overlaying.

There are two ways to set up these overlays: programmatically using `GlobalContext::local_overlays` and through the `__CARGO_TEST_PACKAGE_CONFUSION_VULNERABILITY_DO_NOT_USE_THIS` environment variable. You can't set up these overlays with `.cargo/config`.

The motivation for this is [packaging workspaces](https://github.com/rust-lang/cargo/issues/10948). When we're packing a workspace, we'd like to be able to pretend (for lockfile generation and verification) that some workspace packages are already published even though they aren't.
2024-06-11 16:27:02 +00:00
Weihang Lo
c5a6a6cfa4
test: auto-redact elapsed time from libtest output 2024-06-10 20:54:32 -04:00