Skip to content

Commit f4828ff

Browse files
jshasyphar
authored andcommitted
builder tests: expect single target for CI build
1 parent 602a39e commit f4828ff

File tree

2 files changed

+46
-26
lines changed

2 files changed

+46
-26
lines changed

src/docbuilder/rustwide_builder.rs

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -911,16 +911,6 @@ mod tests {
911911
.map(|v| v.as_str().unwrap().to_owned())
912912
.collect();
913913
targets.sort();
914-
assert_eq!(
915-
targets,
916-
vec![
917-
"i686-pc-windows-msvc",
918-
"i686-unknown-linux-gnu",
919-
"x86_64-apple-darwin",
920-
"x86_64-pc-windows-msvc",
921-
"x86_64-unknown-linux-gnu",
922-
]
923-
);
924914

925915
let web = env.frontend();
926916

@@ -947,26 +937,51 @@ mod tests {
947937
web,
948938
)?;
949939

950-
// other targets too
951-
for target in DEFAULT_TARGETS {
952-
let target_docs_present = storage.exists_in_archive(
953-
&doc_archive,
954-
&format!("{}/{}/index.html", target, crate_path),
955-
)?;
940+
assert!(!storage.exists_in_archive(
941+
&doc_archive,
942+
&format!("{}/{}/index.html", default_target, crate_path),
943+
)?);
944+
945+
let default_target_url = format!(
946+
"/{}/{}/{}/{}/index.html",
947+
crate_, version, default_target, crate_path
948+
);
949+
assert_redirect(
950+
&default_target_url,
951+
&format!("/{}/{}/{}/index.html", crate_, version, crate_path),
952+
web,
953+
)?;
956954

957-
let target_url = format!(
958-
"/{}/{}/{}/{}/index.html",
959-
crate_, version, target, crate_path
955+
// Non-dist toolchains only have a single target, and of course
956+
// if include_default_targets is false we won't have this full list
957+
// of targets.
958+
if builder.toolchain.as_dist().is_some() && env.config().include_default_targets {
959+
assert_eq!(
960+
targets,
961+
vec![
962+
"i686-pc-windows-msvc",
963+
"i686-unknown-linux-gnu",
964+
"x86_64-apple-darwin",
965+
"x86_64-pc-windows-msvc",
966+
"x86_64-unknown-linux-gnu",
967+
]
960968
);
961969

962-
if target == &default_target {
963-
assert!(!target_docs_present);
964-
assert_redirect(
965-
&target_url,
966-
&format!("/{}/{}/{}/index.html", crate_, version, crate_path),
967-
web,
970+
// other targets too
971+
for target in DEFAULT_TARGETS {
972+
if target == &default_target {
973+
continue;
974+
}
975+
let target_docs_present = storage.exists_in_archive(
976+
&doc_archive,
977+
&format!("{}/{}/index.html", target, crate_path),
968978
)?;
969-
} else {
979+
980+
let target_url = format!(
981+
"/{}/{}/{}/{}/index.html",
982+
crate_, version, target, crate_path
983+
);
984+
970985
assert!(target_docs_present);
971986
assert_success(&target_url, web)?;
972987
}
@@ -1061,6 +1076,9 @@ mod tests {
10611076
let crate_ = "windows-win";
10621077
let version = "2.4.1";
10631078
let mut builder = RustwideBuilder::init(env).unwrap();
1079+
if builder.toolchain.as_ci().is_some() {
1080+
return Ok(());
1081+
}
10641082
assert!(builder.build_package(crate_, version, PackageKind::CratesIo)?);
10651083

10661084
let storage = env.storage();

src/test/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,8 @@ impl TestEnvironment {
279279
// are actually different.
280280
config.cache_control_stale_while_revalidate = Some(86400);
281281

282+
config.include_default_targets = true;
283+
282284
config
283285
}
284286

0 commit comments

Comments
 (0)