Skip to content

Commit bd39f5d

Browse files
Merge pull request #784 from Skgland/follow-up-to-770
Follow up to 770 and minor fixes
2 parents e2229ea + 36a63f5 commit bd39f5d

File tree

10 files changed

+42
-26
lines changed

10 files changed

+42
-26
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ tera = "1.19.1"
6868
thiserror = "1.0.38"
6969
tokio = "1.24"
7070
toml = "0.8.6"
71-
url = "2"
71+
url = { version = "2", features = ["serde"] }
7272
walkdir = "2"
7373
warp = "0.3"
7474
zstd = "0.13.0"

docs/bot-usage.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -107,15 +107,17 @@ available:
107107
* `top-{n}`: run the experiment on the `n` most downloaded crates on
108108
[crates.io](crates.io) (e.g. `top-100`).
109109
* `random-{n}`: run the experiment on `n` randomly selected crates (e.g. `random-20`).
110-
* `list:{...}`: run the experiment on the specified crates.
110+
* `list:{...}`: run the experiment on the comma-seperated list of crates.
111+
* `{url}`: run the experiment on the crates specified in the file specified by `{url}`,
112+
The url must start with `http[s]://` and must point to a list in the format of a crater runs [`retry-regressed-list.txt`][retry-list].
111113

112-
For `list:`, the value after the colon can either be a comma-separated list of
113-
crates to run or a link to a newline-separated list of crates ([example][list]).
114-
For example, `list:lazy_static,brson/hello-rs` and `list:https://git.io/Jes7o`
115-
will both run an experiment on the `lazy_static` crate and the git repo at
116-
`github.com/brson/hello-rs`. A link must begin with `http[s]://`.
114+
### Examples
117115

118-
[list]: https://gist.githubusercontent.com/ecstatic-morse/837c558b63fc73ab469bfbf4ad419a1f/raw/example-crate-list
116+
Both of the following will run an experiment on the `lazy_static` crate and the git repo at `github.com/brson/hello-rs`
117+
- `crates=list:lazy_static,brson/hello-rs`
118+
- `crates=https://git.io/Jes7o`
119+
120+
[retry-list]: https://crater-reports.s3.amazonaws.com/pr-133502-3/retry-regressed-list.txt
119121

120122
[Go back to the TOC][h-toc]
121123

src/crates/lists.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -130,10 +130,6 @@ pub(crate) fn get_crates(
130130
crates.push(krate);
131131
}
132132
}
133-
134-
if !desired.is_empty() {
135-
bail!("missing desired crates: {:?}", desired);
136-
}
137133
}
138134

139135
CrateSelect::Random(n) => {

src/report/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -517,10 +517,10 @@ fn compare(
517517
}
518518
}
519519

520-
(PrepareFail(_), _) | (_, PrepareFail(_)) => Comparison::PrepareFail,
521-
(Error, _) | (_, Error) => Comparison::Error,
522520
(Skipped, _) | (_, Skipped) => Comparison::Skipped,
523521
(BrokenCrate(_), _) | (_, BrokenCrate(_)) => Comparison::Broken,
522+
(PrepareFail(_), _) | (_, PrepareFail(_)) => Comparison::PrepareFail,
523+
(Error, _) | (_, Error) => Comparison::Error,
524524
(TestFail(_) | TestPass, TestSkipped) | (TestSkipped, TestFail(_) | TestPass) => {
525525
panic!("can't compare {res1} and {res2}");
526526
}
@@ -838,6 +838,8 @@ mod tests {
838838
// PrepareFail
839839
PrepareFail(Unknown), BuildFail(Unknown) => PrepareFail;
840840
BuildFail(Unknown), PrepareFail(Unknown) => PrepareFail;
841+
PrepareFail(Unknown), Error => PrepareFail;
842+
Error, PrepareFail(Unknown) => PrepareFail;
841843

842844
// Errors
843845
Error, TestPass => Error;
@@ -870,6 +872,11 @@ mod tests {
870872
TestSkipped, BrokenCrate(BrokenReason::Unknown) => Broken;
871873
TestFail(Unknown), BrokenCrate(BrokenReason::Unknown) => Broken;
872874
BuildFail(Unknown), BrokenCrate(BrokenReason::Unknown) => Broken;
875+
876+
PrepareFail(Unknown), BrokenCrate(BrokenReason::Unknown) => Broken;
877+
BrokenCrate(BrokenReason::Unknown), PrepareFail(Unknown) => Broken;
878+
BrokenCrate(BrokenReason::Unknown), Error => Broken;
879+
Error, BrokenCrate(BrokenReason::Unknown) => Broken;
873880
]
874881
);
875882

src/runner/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ pub(super) fn run_test(
253253
let mut build = build_dir.build(ctx.toolchain, krate, sandbox);
254254

255255
for patch in ctx.toolchain.patches.iter() {
256-
build = build.patch_with_git(&patch.name, &patch.repo, &patch.branch);
256+
build = build.patch_with_git(&patch.name, patch.repo.as_str(), &patch.branch);
257257
}
258258

259259
detect_broken(build.run(|build| {

src/runner/worker.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,16 +144,14 @@ impl<'a> Worker<'a> {
144144
error!("task {task:?} failed");
145145
utils::report_failure(&e);
146146

147-
let mut result = if self.config.is_broken(&task.krate) {
147+
let result = if let Some(OverrideResult(res)) = e.downcast_ref() {
148+
res.clone()
149+
} else if self.config.is_broken(&task.krate) {
148150
TestResult::BrokenCrate(BrokenReason::Unknown)
149151
} else {
150152
TestResult::Error
151153
};
152154

153-
if let Some(OverrideResult(res)) = e.downcast_ref() {
154-
result = res.clone();
155-
}
156-
157155
Err((e, result))
158156
}
159157

src/server/reports.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn reports_thread(data: &Data, github_data: Option<&GithubData>) -> Fallible<()>
124124
)
125125
.line(
126126
"newspaper",
127-
format!("[Open the full report]({report_url})."),
127+
format!("[Open the summary report]({report_url})."),
128128
)
129129
.note(
130130
"warning",

src/toolchain.rs

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,8 @@ pub enum ToolchainParseError {
105105
InvalidFlag(String),
106106
#[error("invalid toolchain SHA: {0} is missing a `try#` or `master#` prefix")]
107107
PrefixMissing(String),
108+
#[error("invalid url {0:?}: {1}")]
109+
InvalidUrl(String, url::ParseError),
108110
}
109111

110112
lazy_static! {
@@ -187,7 +189,9 @@ impl FromStr for Toolchain {
187189
#[derive(Serialize, Deserialize, PartialEq, Eq, Hash, Debug, Clone)]
188190
pub struct CratePatch {
189191
pub name: String,
190-
pub repo: String,
192+
// cargo currently doesn't accept scp-style "URLs" rust-lang/crates#1851
193+
// so ensure its a proper URL
194+
pub repo: url::Url,
191195
pub branch: String,
192196
}
193197

@@ -202,7 +206,8 @@ impl FromStr for CratePatch {
202206
} else {
203207
Ok(CratePatch {
204208
name: params[0].into(),
205-
repo: params[1].into(),
209+
repo: url::Url::parse(params[1])
210+
.map_err(|err| ToolchainParseError::InvalidUrl(params[1].into(), err))?,
206211
branch: params[2].into(),
207212
})
208213
}
@@ -291,7 +296,7 @@ mod tests {
291296
ci_try: $ci_try,
292297
patches: vec![CratePatch {
293298
name: "example".to_string(),
294-
repo: "https://git.example.com/some/repo".to_string(),
299+
repo: url::Url::parse("https://git.example.com/some/repo").unwrap(),
295300
branch: "master".to_string()
296301
}]
297302
});
@@ -306,7 +311,7 @@ mod tests {
306311
ci_try: $ci_try,
307312
patches: vec![CratePatch {
308313
name: "example".to_string(),
309-
repo: "https://git.example.com/some/repo".to_string(),
314+
repo: url::Url::parse("https://git.example.com/some/repo").unwrap(),
310315
branch: "master".to_string()
311316
}]
312317
});
@@ -358,6 +363,13 @@ mod tests {
358363
assert!(Toolchain::from_str("stable+rustdocflags=").is_err());
359364
assert!(Toolchain::from_str("stable+donotusethisflag=ever").is_err());
360365
assert!(Toolchain::from_str("stable+patch=").is_err());
366+
assert!(matches!(
367+
Toolchain::from_str(
368+
"stable+patch=getrandom=git@github.com:rust-random/getrandom=backports/v0.2"
369+
)
370+
.unwrap_err(),
371+
super::ToolchainParseError::InvalidUrl(..)
372+
));
361373
assert!(Toolchain::from_str("try#1234+target=").is_err());
362374
assert!(Toolchain::from_str("0000000000000000000000000000000000000000").is_err());
363375
}

templates/ui/experiment.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ <h1>Experiment <b>{{ experiment.name }}</b></h1>
1010
<div class="toolbar">
1111
{% if experiment.report_url %}
1212
<a rel="noopener" target="_blank" class="button" href="{{ experiment.report_url }}">
13-
Open full report
13+
Open summary report
1414
</a>
1515
{% endif %}
1616
{% if experiment.github_url %}

0 commit comments

Comments
 (0)