Skip to content

Commit cb5feac

Browse files
committed
Add new cargo stable benchmark
1 parent 88542ee commit cb5feac

File tree

354 files changed

+129502
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

354 files changed

+129502
-0
lines changed

collector/compile-benchmarks/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ Rust code being written today.
140140

141141
- **encoding**: An old crate providing character encoding support. Contains
142142
some large tables.
143+
- **cargo**: An old version of Cargo, corresponding to the 1.24.0 Rust release.
144+
Two of its dependencies (`socket2` and `url`) had to be vendored, to provide patches
145+
so that it can compile with old rustc.
143146
- **futures**: v0.1.0 of the popular `futures` crate, which was used by many
144147
Rust programs. Newer versions of this crate (e.g. v0.3.21 from February 2021)
145148
contain very little code, instead relying on sub-crates. This makes them less

collector/compile-benchmarks/REUSE.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,21 @@ path = "bitmaps-3.2.1-new-solver/**"
2727
SPDX-License-Identifier = "MPL-2.0"
2828
SPDX-FileCopyrightText = "Bodil Stokke"
2929

30+
[[annotations]]
31+
path = "cargo/**"
32+
SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)"
33+
SPDX-License-Identifier = "MIT OR Apache-2.0"
34+
35+
[[annotations]]
36+
path = "cargo/socket2-0.2.3/**"
37+
SPDX-FileCopyrightText = "Alex Crichton"
38+
SPDX-License-Identifier = "MIT OR Apache-2.0"
39+
40+
[[annotations]]
41+
path = "cargo/url-1.5.1/**"
42+
SPDX-FileCopyrightText = "The rust-url developers"
43+
SPDX-License-Identifier = "MIT OR Apache-2.0"
44+
3045
[[annotations]]
3146
path = "cargo-0.87.1/**"
3247
SPDX-FileCopyrightText = "The Rust Project Developers (see https://thanks.rust-lang.org)"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/target
2+
.cargo
3+
/config.stamp
4+
/Makefile
5+
/config.mk
6+
src/doc/build
7+
src/etc/*.pyc
8+
src/registry/target
9+
src/registry/Cargo.lock
10+
rustc
11+
__pycache__
12+
.idea/
13+
*.iml
14+
*.swp
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
language: rust
2+
rust: stable
3+
sudo: required
4+
dist: trusty
5+
6+
git:
7+
depth: 1
8+
9+
cache:
10+
directories:
11+
- $HOME/.cargo/bin/
12+
13+
matrix:
14+
include:
15+
- env: TARGET=x86_64-unknown-linux-gnu
16+
ALT=i686-unknown-linux-gnu
17+
- env: TARGET=x86_64-apple-darwin
18+
ALT=i686-apple-darwin
19+
os: osx
20+
21+
- env: TARGET=x86_64-unknown-linux-gnu
22+
ALT=i686-unknown-linux-gnu
23+
rust: beta
24+
25+
- env: TARGET=x86_64-unknown-linux-gnu
26+
ALT=i686-unknown-linux-gnu
27+
rust: nightly
28+
install:
29+
- mdbook --help || cargo install mdbook --force
30+
script:
31+
- cargo test
32+
- cargo doc --no-deps
33+
- sh src/ci/dox.sh
34+
after_success: |
35+
[ $TRAVIS_BRANCH = master ] &&
36+
[ $TRAVIS_PULL_REQUEST = false ] &&
37+
[ $(uname -s) = Linux ] &&
38+
pip install ghp-import --user &&
39+
$HOME/.local/bin/ghp-import -n target/doc &&
40+
git push -qf https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages 2>&1 >/dev/null
41+
42+
exclude:
43+
- rust: stable
44+
45+
before_script:
46+
- rustup target add $ALT
47+
script:
48+
- cargo test
49+
50+
env:
51+
global:
52+
- secure: "hWheSLilMM4DXChfSy2XsDlLw338X2o+fw8bE590xxU2TzngFW8GUfq7lGfZEp/l4SNNIS6ROU/igyttCZtxZMANZ4aMQZR5E8Fp4yPOyE1pZLDH/LdQVXnROsfburQJeq+GIYIbZ01Abzh5ClpgLg5KX0H627uj063zZ7Ljo/w="
53+
54+
notifications:
55+
email:
56+
on_success: never
57+
addons:
58+
apt:
59+
packages:
60+
- gcc-multilib
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/src/cargo/lib.rs b/src/cargo/lib.rs
2+
index f20118b8..350d8e47 100755
3+
--- a/src/cargo/lib.rs
4+
+++ b/src/cargo/lib.rs
5+
@@ -98,6 +98,8 @@ impl fmt::Display for VersionInfo {
6+
}
7+
};
8+
9+
+ println!("testing");
10+
+
11+
if let Some(ref cfg) = self.cfg_info {
12+
if let Some(ref ci) = cfg.commit_info {
13+
write!(f, " ({} {})",
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Cargo Architecture
2+
3+
This document gives a high level overview of Cargo internals. You may
4+
find it useful if you want to contribute to Cargo or if you are
5+
interested in the inner workings of Cargo.
6+
7+
8+
## Subcommands
9+
10+
Cargo is organized as a set of subcommands. All subcommands live in
11+
`src/bin` directory. However, only `src/bin/cargo.rs` file produces an
12+
executable, other files inside the `bin` directory are submodules. See
13+
`src/bin/cargo.rs` for how these subcommands get wired up with the
14+
main executable.
15+
16+
A typical subcommand, such as `src/bin/build.rs`, parses command line
17+
options, reads the configuration files, discovers the Cargo project in
18+
the current directory and delegates the actual implementation to one
19+
of the functions in `src/cargo/ops/mod.rs`. This short file is a good
20+
place to find out about most of the things that Cargo can do.
21+
22+
23+
## Important Data Structures
24+
25+
There are some important data structures which are used throughout
26+
Cargo.
27+
28+
`Config` is available almost everywhere and holds "global"
29+
information, such as `CARGO_HOME` or configuration from
30+
`.cargo/config` files. The `shell` method of `Config` is the entry
31+
point for printing status messages and other info to the console.
32+
33+
`Workspace` is the description of the workspace for the current
34+
working directory. Each workspace contains at least one
35+
`Package`. Each package corresponds to a single `Cargo.toml`, and may
36+
define several `Target`s, such as the library, binaries, integration
37+
test or examples. Targets are crates (each target defines a crate
38+
root, like `src/lib.rs` or `examples/foo.rs`) and are what is actually
39+
compiled by `rustc`.
40+
41+
A typical package defines the single library target and several
42+
auxiliary ones. Packages are a unit of dependency in Cargo, and when
43+
package `foo` depends on package `bar`, that means that each target
44+
from `foo` needs the library target from `bar`.
45+
46+
`PackageId` is the unique identifier of a (possibly remote)
47+
package. It consist of three components: name, version and source
48+
id. Source is the place where the source code for package comes
49+
from. Typical sources are crates.io, a git repository or a folder on
50+
the local hard drive.
51+
52+
`Resolve` is the representation of a directed acyclic graph of package
53+
dependencies, which uses `PackageId`s for nodes. This is the data
54+
structure that is saved to the lock file. If there is no lockfile,
55+
Cargo constructs a resolve by finding a graph of packages which
56+
matches declared dependency specification according to semver.
57+
58+
59+
## Persistence
60+
61+
Cargo is a non-daemon command line application, which means that all
62+
the information used by Cargo must be persisted on the hard drive. The
63+
main sources of information are `Cargo.toml` and `Cargo.lock` files,
64+
`.cargo/config` configuration files and the globally shared registry
65+
of packages downloaded from crates.io, usually located at
66+
`~/.cargo/registry`. See `src/sources/registry` for the specifics of
67+
the registry storage format.
68+
69+
70+
## Concurrency
71+
72+
Cargo is mostly single threaded. The only concurrency inside a single
73+
instance of Cargo happens during compilation, when several instances
74+
of `rustc` are invoked in parallel to build independent
75+
targets. However there can be several different instances of Cargo
76+
process running concurrently on the system. Cargo guarantees that this
77+
is always safe by using file locks when accessing potentially shared
78+
data like the registry or the target directory.
79+
80+
81+
## Tests
82+
83+
Cargo has an impressive test suite located in the `tests` folder. Most
84+
of the test are integration: a project structure with `Cargo.toml` and
85+
rust source code is created in a temporary directory, `cargo` binary
86+
is invoked via `std::process::Command` and then stdout and stderr are
87+
verified against the expected output. To simplify testing, several
88+
macros of the form `[MACRO]` are used in the expected output. For
89+
example, `[..]` matches any string and `[/]` matches `/` on Unixes and
90+
`\` on windows.
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# Contributing to Cargo
2+
3+
Thank you for your interest in contributing to Cargo! Good places to
4+
start are this document, [ARCHITECTURE.md](ARCHITECTURE.md), which
5+
describes the high-level structure of Cargo and [E-easy] bugs on the
6+
issue tracker.
7+
8+
If you have a general question about Cargo or it's internals, feel free to ask
9+
on [IRC].
10+
11+
## Code of Conduct
12+
13+
All contributors are expected to follow our [Code of Conduct].
14+
15+
## Bug reports
16+
17+
We can't fix what we don't know about, so please report problems liberally. This
18+
includes problems with understanding the documentation, unhelpful error messages
19+
and unexpected behavior.
20+
21+
**If you think that you have identified an issue with Cargo that might compromise
22+
its users' security, please do not open a public issue on GitHub. Instead,
23+
we ask you to refer to Rust's [security policy].**
24+
25+
Opening an issue is as easy as following [this
26+
link][new-issues] and filling out the fields.
27+
Here's a template that you can use to file an issue, though it's not necessary to
28+
use it exactly:
29+
30+
<short summary of the problem>
31+
32+
I tried this: <minimal example that causes the problem>
33+
34+
I expected to see this happen: <explanation>
35+
36+
Instead, this happened: <explanation>
37+
38+
I'm using <output of `cargo --version`>
39+
40+
All three components are important: what you did, what you expected, what
41+
happened instead. Please use https://gist.github.com/ if your examples run long.
42+
43+
## Working on issues
44+
45+
If you're looking for somewhere to start, check out the [E-easy][E-Easy] tag.
46+
47+
Feel free to ask for guidelines on how to tackle a problem on [IRC] or open a
48+
[new issue][new-issues]. This is especially important if you want to add new
49+
features to Cargo or make large changes to the already existing code-base.
50+
Cargo's core developers will do their best to provide help.
51+
52+
If you start working on an already-filed issue, post a comment on this issue to
53+
let people know that somebody is working it. Feel free to ask for comments if
54+
you are unsure about the solution you would like to submit.
55+
56+
While Cargo does make use of some Rust-features available only through the
57+
`nightly` toolchain, it must compile on stable Rust. Code added to Cargo
58+
is encouraged to make use of the latest stable features of the language and
59+
`stdlib`.
60+
61+
We use the "fork and pull" model [described here][development-models], where
62+
contributors push changes to their personal fork and create pull requests to
63+
bring those changes into the source repository. This process is partly
64+
automated: Pull requests are made against Cargo's master-branch, tested and
65+
reviewed. Once a change is approved to be merged, a friendly bot merges the
66+
changes into an internal branch, runs the full test-suite on that branch
67+
and only then merges into master. This ensures that Cargo's master branch
68+
passes the test-suite at all times.
69+
70+
Your basic steps to get going:
71+
72+
* Fork Cargo and create a branch from master for the issue you are working on.
73+
* Please adhere to the code style that you see around the location you are
74+
working on.
75+
* [Commit as you go][githelp].
76+
* Include tests that cover all non-trivial code. The existing tests
77+
in `test/` provide templates on how to test Cargo's behavior in a
78+
sandbox-environment. The internal crate `cargotest` provides a vast amount
79+
of helpers to minimize boilerplate.
80+
* Make sure `cargo test` passes. If you do not have the cross-compilers
81+
installed locally, ignore the cross-compile test failures or disable them by
82+
using `CFG_DISABLE_CROSS_TESTS=1 cargo test`. Note that some tests are enabled
83+
only on `nightly` toolchain. If you can, test both toolchains.
84+
* Push your commits to GitHub and create a pull request against Cargo's
85+
`master` branch.
86+
87+
## Pull requests
88+
89+
After the pull request is made, a friendly bot will automatically assign a
90+
reviewer; the review-process will make sure that the proposed changes are
91+
sound. Please give the assigned reviewer sufficient time, especially during
92+
weekends. If you don't get a reply, you may poke the core developers on [IRC].
93+
94+
A merge of Cargo's master-branch and your changes is immediately queued
95+
to be tested after the pull request is made. In case unforeseen
96+
problems are discovered during this step (e.g. a failure on a platform you
97+
originally did not develop on), you may ask for guidance. Push additional
98+
commits to your branch to tackle these problems.
99+
100+
The reviewer might point out changes deemed necessary. Please add them as
101+
extra commits; this ensures that the reviewer can see what has changed since
102+
the code was previously reviewed. Large or tricky changes may require several
103+
passes of review and changes.
104+
105+
Once the reviewer approves your pull request, a friendly bot picks it up
106+
and [merges][mergequeue] it into Cargo's `master` branch.
107+
108+
## Contributing to the documentation
109+
110+
To contribute to the documentation, all you need to do is change the markdown
111+
files in the `src/doc` directory. To view the rendered version of changes you
112+
have made locally, run:
113+
114+
```sh
115+
sh src/ci/dox.sh
116+
open target/doc/index.html
117+
```
118+
119+
120+
## Issue Triage
121+
122+
Sometimes an issue will stay open, even though the bug has been fixed. And
123+
sometimes, the original bug may go stale because something has changed in the
124+
meantime.
125+
126+
It can be helpful to go through older bug reports and make sure that they are
127+
still valid. Load up an older issue, double check that it's still true, and
128+
leave a comment letting us know if it is or is not. The [least recently
129+
updated sort][lru] is good for finding issues like this.
130+
131+
Contributors with sufficient permissions on the Rust-repository can help by
132+
adding labels to triage issues:
133+
134+
* Yellow, **A**-prefixed labels state which **area** of the project an issue
135+
relates to.
136+
137+
* Magenta, **B**-prefixed labels identify bugs which are **blockers**.
138+
139+
* Light purple, **C**-prefixed labels represent the **category** of an issue.
140+
141+
* Dark purple, **Command**-prefixed labels mean the issue has to do with a
142+
specific cargo command.
143+
144+
* Green, **E**-prefixed labels explain the level of **experience** or
145+
**effort** necessary to fix the issue. [**E-mentor**][E-mentor] issues also
146+
have some instructions on how to get started.
147+
148+
* Red, **I**-prefixed labels indicate the **importance** of the issue. The
149+
[I-nominated][inom] label indicates that an issue has been nominated for
150+
prioritizing at the next triage meeting.
151+
152+
* Purple gray, **O**-prefixed labels are the **operating system** or platform
153+
that this issue is specific to.
154+
155+
* Orange, **P**-prefixed labels indicate a bug's **priority**. These labels
156+
are only assigned during triage meetings and replace the [I-nominated][inom]
157+
label.
158+
159+
* The light orange **relnotes** label marks issues that should be documented in
160+
the release notes of the next release.
161+
162+
163+
[githelp]: https://dont-be-afraid-to-commit.readthedocs.io/en/latest/git/commandlinegit.html
164+
[development-models]: https://help.github.com/articles/about-collaborative-development-models/
165+
[gist]: https://gist.github.com/
166+
[new-issues]: https://github.com/rust-lang/cargo/issues/new
167+
[mergequeue]: https://buildbot2.rust-lang.org/homu/queue/cargo
168+
[security policy]: https://www.rust-lang.org/security.html
169+
[lru]: https://github.com/rust-lang/cargo/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-asc
170+
[E-easy]: https://github.com/rust-lang/cargo/labels/E-easy
171+
[E-mentor]: https://github.com/rust-lang/cargo/labels/E-mentor
172+
[Code of Conduct]: https://www.rust-lang.org/conduct.html
173+
[IRC]: https://kiwiirc.com/client/irc.mozilla.org/cargo

0 commit comments

Comments
 (0)