424 Commits

Author SHA1 Message Date
Lin Yihai
35d5fae5b6 test: support publish package with a public field. 2024-01-03 04:08:59 +08:00
renovate[bot]
647dc34c27
chore(deps): update alpine docker tag to v3.19 2024-01-01 01:19:21 +00:00
Eric Huss
1aa769240d Add more options to registry test support. 2023-11-30 16:39:08 -08:00
bors
65d0eb536d Auto merge of #12997 - hi-rustin:rustin-patch-cargo-test-support, r=epage
cargo-test-support: Add features to the default Cargo.toml file
2023-11-22 01:47:31 +00:00
David Tolnay
65bb09d434
Handle $message_type in JSON diagnostics 2023-11-19 20:37:16 -08:00
hi-rustin
504c4b2fbb Add optional flag to manifest for dependencies
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-11-19 22:04:04 +08:00
hi-rustin
12d7818192 Add features to the default Cargo.toml file
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-11-19 22:03:57 +08:00
Eric Huss
2eac6f5c0c Fix clippy-wrapper test race condition. 2023-11-18 17:23:29 -08:00
Weihang Lo
7a4754a1d3
lint: allow print_stdout and print_stderr 2023-11-16 11:35:21 -05:00
Weihang Lo
870f9ea7b3
lint: allow disallow_methods 2023-11-16 11:35:21 -05:00
Weihang Lo
1539b3dfc1
lint: dogfood ourselves lints table in manifest
These lint rules are from src/lib.rs. We aim to remove
them in the source code once `Zlints` hit stable.
2023-11-16 11:35:21 -05:00
Eric Huss
56c8d90d13 Use walkdir's built-in sorting option. 2023-11-11 10:56:59 -08:00
Eric Huss
da3ca05677 Add a global cache garbage collector.
This adds a garbage collector which will remove old files from cargo's
global cache.

A general overview of the changes here:

- `cargo::core::global_cache_tracker` contains the `GlobalCacheTracker`
  which handles the interface to a sqlite database which stores
  timestamps of the last time a file was used.
- `DeferredGlobalLastUse` is a type that implements an optimization for
  collecting last-use timestamps so that they can be flushed to disk all
  at once.
- `cargo::core::gc` contains the `Gc` type which is the interface for
  performing garbage collection. It coordinates with the
  `GlobalCacheTracker` for determining what to delete.
- Garbage collection can either be automatic or manual. The automatic
  garbage collection supports some config options for defining when
  it runs and how much it deletes.
- Manual garbage collection can be performed via options to `cargo
  clean`.
- `cargo clean` uses the new package cache locking system to coordinate
  access to the package cache to prevent interference with other cargo
  commands running concurrently.
2023-11-11 10:56:58 -08:00
Ed Page
293f2250d6 feat(doc): Print the generated docs links
I've wanted something like this myself.  I dislike using `--open`
because I tend to move up to re-run my `cargo doc` run but then have to
edit it to remove `--open`.
Also makes it annoying when opening docs when `cargo doc` is wrapped by
a tool like `make`.

This was previously attempted in #5592:
- Unlike the request in #5562, this aligns with #5592 in always printing
  rather than using a flag as this seems generally useful
- Unlike #5592, this prints as an alternative to "Opening" to keep
  things light
- Unlike #5592, this prints afterwards as the link is only valid then

Fixes #5562
2023-10-19 10:51:56 -05:00
Eric Huss
b4982adfd9 Add a new package cache locking system.
This introduces a new `CacheLocker` which manages locks on the package
cache. Instead of either being "locked" or "not locked", the new locker
supports multiple modes:

- Shared lock: Cargo can read from the package sources, along with any
  other cargos reading at the same time.
- Download exclusive lock: Only one cargo can perform downloads.
  Download locks do not interfere with Shared locks, since it is
  expected that downloading does not modify existing files (only adds
  new ones).
- Mutate exclusive lock: Only one cargo can have this lock, and it also
  prevents shared locks. This is so that the cargo can modify the
  package cache (such as deleting files) without breaking concurrent
  processes.
2023-10-08 14:16:51 -07:00
Eric Huss
b85ef38187 Add test helpers for waiting for an operation with a timeout. 2023-10-08 14:16:51 -07:00
Eric Huss
83fff2d1b1 Add a test helper for retrying a function multiple times. 2023-10-08 14:16:51 -07:00
Ed Page
37c6f3d085 fix(test): Add back in newlines to diffs
Errors like this aren't too helpful
```
error: stderr did not match:
1   1     error: failed to parse manifest at `[..]`2   2     3   3     Caused by:4   4       TOML parse error at line 3, column 275   5         |6   6       3 |                 version = 17
  7         |                           ^8        -  invalid type: integer `1`, expected SemVer version    8    +  invalid type: integer `1`, expected a string or workspace
```

This was broken in #12581
2023-09-29 20:02:53 -05:00
Ed Page
796398563a refactor(test): Switch termcolor to anstream 2023-09-29 10:16:15 -05:00
cui fliter
c8f4d234bb Fix some typos
Signed-off-by: cui fliter <imcusg@gmail.com>
2023-09-24 23:10:07 +08:00
Eric Huss
ebea09d8f4 Fix spurious errors with networking tests. 2023-09-22 13:37:26 -07:00
Eric Huss
495ed7ebe2 Add a summary to cargo clean.
This adds a summary at the end when `cargo clean` finishes that displays
how many files and bytes were removed.
2023-09-19 18:16:40 -07:00
Weihang Lo
aef3bd22d3
lint: fix errors for rust 2018 idioms 2023-09-14 13:43:48 +08:00
Weihang Lo
f9d82a1703
lint: remove unused dbg! 2023-09-14 13:43:47 +08:00
Jacob Finkelman
205fd1a765 libgit2 fixed upstream 2023-09-11 19:25:45 +00:00
Jacob Finkelman
44666f7377 Ues strip_prefix for cleaner code 2023-09-07 17:57:28 +00:00
bors
282424e42d Auto merge of #12635 - ehuss:with-stdout-unordered, r=weihanglo
Add with_stdout_unordered.

This adds the `with_stdout_unordered` method to cargo's test system so that tests can use it to check stdout but ignoring the order of lines. Nothing in this PR actually uses this method, but it is added to support #12634. I also expect it could potentially be useful in other cases in the future.
2023-09-07 06:26:51 +00:00
Eric Huss
0adb9f1b2a Add with_stdout_unordered.
This adds Execs::with_stdout_unordered to check stdout ignoring the
order of lines.
2023-09-06 21:40:56 -07:00
Eric Huss
8964f3fd5d Fix example for creating a git project test. 2023-09-06 18:56:12 -07:00
Jacob Finkelman
16b330bc59 stop using lazy_static 2023-09-01 21:38:03 +00:00
Deadbeef
b2b34e4ca2 update tests 2023-08-25 01:43:29 +00:00
Ed Page
7a65c826a0 fix: Set MSRV for internal packages
For now, I'm punting on packages we generally expect others to use
2023-08-22 16:46:47 -05:00
renovate[bot]
a63bc76577
chore(deps): update alpine docker tag to v3.18 2023-08-01 02:18:33 +00:00
Arlo Siemsen
2b39792aef Credential provider implementation 2023-07-21 16:02:24 -05:00
Ed Page
5d80aa263d refactor: Provide workspace-level default license 2023-07-17 13:21:41 -05:00
Ed Page
f358359a17 refactor: Provide a workspace-level default edition 2023-07-17 13:21:40 -05:00
Eric Huss
75bcada1eb Show a better error when container tests fail. 2023-06-13 11:15:39 -07:00
Ed Page
b2b4d9771f test(cli): Verify precedence over external subcommands 2023-06-09 13:16:12 -05:00
Weihang Lo
c977baa9cf
refactor: rename RegistryPackage to IndexPackage
This is a better name to reflect it is from "index" files.
2023-06-07 23:01:55 +01:00
Weihang Lo
fa7cc198aa
refactor: replace some usages of lazy_static with OnceLock
* Some usages still wait for `LazyCell`.
* `TEST_ROOTS` is no longer used. Removed.
2023-06-01 22:11:20 +01:00
Weihang Lo
7b4e32d64b
test: set retry sleep to 1ms for all tests 2023-05-27 11:28:58 +01:00
WANG Rui
6a9cb23923 Remove useless drop of copy type 2023-05-13 16:51:30 +08:00
Weihang Lo
0bffcbcb8a
chore: publish = false for pkgs not meant to be published
These tree packages are considered to be published something.
To reduce the logic of xtask-unpubilshed, let's flag them false for now.
We can always set it `true` when needed.
2023-05-05 16:24:19 +01:00
bors
33c64109fe Auto merge of #12055 - QiangHeisenberg:crates-io-doc-test, r=weihanglo
fix:  doc-test failures

### What does this PR try to resolve?

When I read the source code, I found that the `Registry::new_handle` document test failed and seemed to be missing parameters;

There is no change in this [PR](https://github.com/rust-lang/cargo/pull/10592/files#diff-12973056cf99e8de997011a8738a6740a7dfd06142a73f122f3b35218db37351).
2023-05-04 14:30:42 +00:00
QiangHeisenberg
ff7ff7d50d Added the no_run attribute 2023-05-04 16:25:12 +08:00
QiangHeisenberg
ea0d487b99 fix cargo-test-support doc test 2023-05-04 11:16:34 +08:00
Scott Schafer
34b8c39d77 chore: Use [workspace.dependencies] 2023-04-28 09:56:09 -05:00
Ed Page
07e3bb880d feat(test): Manual publishes set 'rust_version' in Index 2023-04-26 15:59:22 -05:00
Eric Huss
ac25009500 Update windows-sys 2023-04-23 12:40:00 -07:00
hi-rustin
08169fd015 Add rustc_shim_for_cargo_fix and wrapped_clippy_driver to reuse code
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
2023-04-14 11:23:41 +08:00