Skip to content

Commit b89bff1

Browse files
committed
removed compiletest + tests/rustdoc
These are in the other pr
1 parent 15dc831 commit b89bff1

File tree

31 files changed

+34
-318
lines changed

31 files changed

+34
-318
lines changed

src/tools/compiletest/src/command-list.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
1818
"check-test-line-numbers-match",
1919
"compare-output-lines-by-subset",
2020
"compile-flags",
21-
"doc-flags",
2221
"dont-check-compiler-stderr",
2322
"dont-check-compiler-stdout",
2423
"dont-check-failure-status",
@@ -226,7 +225,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
226225
"should-ice",
227226
"stderr-per-bitwidth",
228227
"test-mir-pass",
229-
"unique-doc-out-dir",
230228
"unset-exec-env",
231229
"unset-rustc-env",
232230
// Used by the tidy check `unknown_revision`.

src/tools/compiletest/src/header.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ pub struct TestProps {
9595
pub compile_flags: Vec<String>,
9696
// Extra flags to pass when the compiled code is run (such as --bench)
9797
pub run_flags: Vec<String>,
98-
/// Extra flags to pass to rustdoc but not the compiler.
99-
pub doc_flags: Vec<String>,
10098
// If present, the name of a file that this test should match when
10199
// pretty-printed
102100
pub pp_exact: Option<PathBuf>,
@@ -124,8 +122,6 @@ pub struct TestProps {
124122
pub unset_exec_env: Vec<String>,
125123
// Build documentation for all specified aux-builds as well
126124
pub build_aux_docs: bool,
127-
// Build the documentation for each crate in a unique output directory
128-
pub unique_doc_out_dir: bool,
129125
// Flag to force a crate to be built with the host architecture
130126
pub force_host: bool,
131127
// Check stdout for error-pattern output as well as stderr
@@ -224,10 +220,8 @@ mod directives {
224220
pub const REGEX_ERROR_PATTERN: &'static str = "regex-error-pattern";
225221
pub const COMPILE_FLAGS: &'static str = "compile-flags";
226222
pub const RUN_FLAGS: &'static str = "run-flags";
227-
pub const DOC_FLAGS: &'static str = "doc-flags";
228223
pub const SHOULD_ICE: &'static str = "should-ice";
229224
pub const BUILD_AUX_DOCS: &'static str = "build-aux-docs";
230-
pub const UNIQUE_DOC_OUT_DIR: &'static str = "unique-doc-out-dir";
231225
pub const FORCE_HOST: &'static str = "force-host";
232226
pub const CHECK_STDOUT: &'static str = "check-stdout";
233227
pub const CHECK_RUN_RESULTS: &'static str = "check-run-results";
@@ -273,7 +267,6 @@ impl TestProps {
273267
regex_error_patterns: vec![],
274268
compile_flags: vec![],
275269
run_flags: vec![],
276-
doc_flags: vec![],
277270
pp_exact: None,
278271
aux_builds: vec![],
279272
aux_bins: vec![],
@@ -288,7 +281,6 @@ impl TestProps {
288281
exec_env: vec![],
289282
unset_exec_env: vec![],
290283
build_aux_docs: false,
291-
unique_doc_out_dir: false,
292284
force_host: false,
293285
check_stdout: false,
294286
check_run_results: false,
@@ -385,8 +377,6 @@ impl TestProps {
385377
|r| r,
386378
);
387379

388-
config.push_name_value_directive(ln, DOC_FLAGS, &mut self.doc_flags, |r| r);
389-
390380
fn split_flags(flags: &str) -> Vec<String> {
391381
// Individual flags can be single-quoted to preserve spaces; see
392382
// <https://github.com/rust-lang/rust/pull/115948/commits/957c5db6>.
@@ -424,8 +414,6 @@ impl TestProps {
424414

425415
config.set_name_directive(ln, SHOULD_ICE, &mut self.should_ice);
426416
config.set_name_directive(ln, BUILD_AUX_DOCS, &mut self.build_aux_docs);
427-
config.set_name_directive(ln, UNIQUE_DOC_OUT_DIR, &mut self.unique_doc_out_dir);
428-
429417
config.set_name_directive(ln, FORCE_HOST, &mut self.force_host);
430418
config.set_name_directive(ln, CHECK_STDOUT, &mut self.check_stdout);
431419
config.set_name_directive(ln, CHECK_RUN_RESULTS, &mut self.check_run_results);

src/tools/compiletest/src/runtest.rs

Lines changed: 33 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -729,7 +729,7 @@ impl<'test> TestCx<'test> {
729729
self.maybe_add_external_args(&mut rustc, &self.config.target_rustcflags);
730730
rustc.args(&self.props.compile_flags);
731731

732-
self.compose_and_run_compiler(rustc, Some(src), self.testpaths)
732+
self.compose_and_run_compiler(rustc, Some(src))
733733
}
734734

735735
fn run_debuginfo_test(&self) {
@@ -1585,15 +1585,13 @@ impl<'test> TestCx<'test> {
15851585
passes,
15861586
);
15871587

1588-
self.compose_and_run_compiler(rustc, None, self.testpaths)
1588+
self.compose_and_run_compiler(rustc, None)
15891589
}
15901590

1591-
/// `root_out_dir` and `root_testpaths` refer to the parameters of the actual test being run.
1592-
/// Auxiliaries, no matter how deep, have the same root_out_dir and root_testpaths.
1593-
fn document(&self, root_out_dir: &Path, root_testpaths: &TestPaths) -> ProcRes {
1591+
fn document(&self, out_dir: &Path) -> ProcRes {
15941592
if self.props.build_aux_docs {
15951593
for rel_ab in &self.props.aux_builds {
1596-
let aux_testpaths = self.compute_aux_test_paths(root_testpaths, rel_ab);
1594+
let aux_testpaths = self.compute_aux_test_paths(&self.testpaths, rel_ab);
15971595
let aux_props =
15981596
self.props.from_aux_file(&aux_testpaths.file, self.revision, self.config);
15991597
let aux_cx = TestCx {
@@ -1604,7 +1602,7 @@ impl<'test> TestCx<'test> {
16041602
};
16051603
// Create the directory for the stdout/stderr files.
16061604
create_dir_all(aux_cx.output_base_dir()).unwrap();
1607-
let auxres = aux_cx.document(&root_out_dir, root_testpaths);
1605+
let auxres = aux_cx.document(out_dir);
16081606
if !auxres.status.success() {
16091607
return auxres;
16101608
}
@@ -1614,47 +1612,21 @@ impl<'test> TestCx<'test> {
16141612
let aux_dir = self.aux_output_dir_name();
16151613

16161614
let rustdoc_path = self.config.rustdoc_path.as_ref().expect("--rustdoc-path not passed");
1617-
1618-
// actual --out-dir given to the auxiliary or test, as opposed to the root out dir for the entire
1619-
// test
1620-
let out_dir: Cow<'_, Path> = if self.props.unique_doc_out_dir {
1621-
let file_name = self
1622-
.testpaths
1623-
.file
1624-
.file_name()
1625-
.expect("file name should not be empty")
1626-
.to_str()
1627-
.expect("file name utf8")
1628-
.trim_end_matches(".rs");
1629-
let out_dir = PathBuf::from_iter([
1630-
root_out_dir,
1631-
Path::new("docs"),
1632-
Path::new(file_name),
1633-
Path::new("doc"),
1634-
]);
1635-
create_dir_all(&out_dir).unwrap();
1636-
Cow::Owned(out_dir)
1637-
} else {
1638-
Cow::Borrowed(root_out_dir)
1639-
};
1640-
16411615
let mut rustdoc = Command::new(rustdoc_path);
1642-
let current_dir = output_base_dir(self.config, root_testpaths, self.safe_revision());
1643-
rustdoc.current_dir(current_dir);
1616+
16441617
rustdoc
16451618
.arg("-L")
16461619
.arg(self.config.run_lib_path.to_str().unwrap())
16471620
.arg("-L")
16481621
.arg(aux_dir)
16491622
.arg("-o")
1650-
.arg(out_dir.as_ref())
1623+
.arg(out_dir)
16511624
.arg("--deny")
16521625
.arg("warnings")
16531626
.arg(&self.testpaths.file)
16541627
.arg("-A")
16551628
.arg("internal_features")
1656-
.args(&self.props.compile_flags)
1657-
.args(&self.props.doc_flags);
1629+
.args(&self.props.compile_flags);
16581630

16591631
if self.config.mode == RustdocJson {
16601632
rustdoc.arg("--output-format").arg("json").arg("-Zunstable-options");
@@ -1664,7 +1636,7 @@ impl<'test> TestCx<'test> {
16641636
rustdoc.arg(format!("-Clinker={}", linker));
16651637
}
16661638

1667-
self.compose_and_run_compiler(rustdoc, None, root_testpaths)
1639+
self.compose_and_run_compiler(rustdoc, None)
16681640
}
16691641

16701642
fn exec_compiled_test(&self) -> ProcRes {
@@ -1862,16 +1834,9 @@ impl<'test> TestCx<'test> {
18621834
}
18631835
}
18641836

1865-
/// `root_testpaths` refers to the path of the original test.
1866-
/// the auxiliary and the test with an aux-build have the same `root_testpaths`.
1867-
fn compose_and_run_compiler(
1868-
&self,
1869-
mut rustc: Command,
1870-
input: Option<String>,
1871-
root_testpaths: &TestPaths,
1872-
) -> ProcRes {
1837+
fn compose_and_run_compiler(&self, mut rustc: Command, input: Option<String>) -> ProcRes {
18731838
let aux_dir = self.aux_output_dir();
1874-
self.build_all_auxiliary(root_testpaths, &aux_dir, &mut rustc);
1839+
self.build_all_auxiliary(&self.testpaths, &aux_dir, &mut rustc);
18751840

18761841
rustc.envs(self.props.rustc_env.clone());
18771842
self.props.unset_rustc_env.iter().fold(&mut rustc, Command::env_remove);
@@ -2586,7 +2551,7 @@ impl<'test> TestCx<'test> {
25862551
Vec::new(),
25872552
);
25882553

2589-
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
2554+
let proc_res = self.compose_and_run_compiler(rustc, None);
25902555
let output_path = self.get_filecheck_file("ll");
25912556
(proc_res, output_path)
25922557
}
@@ -2622,7 +2587,7 @@ impl<'test> TestCx<'test> {
26222587
Vec::new(),
26232588
);
26242589

2625-
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
2590+
let proc_res = self.compose_and_run_compiler(rustc, None);
26262591
let output_path = self.get_filecheck_file("s");
26272592
(proc_res, output_path)
26282593
}
@@ -2705,7 +2670,7 @@ impl<'test> TestCx<'test> {
27052670
let out_dir = self.output_base_dir();
27062671
remove_and_create_dir_all(&out_dir);
27072672

2708-
let proc_res = self.document(&out_dir, &self.testpaths);
2673+
let proc_res = self.document(&out_dir);
27092674
if !proc_res.status.success() {
27102675
self.fatal_proc_rec("rustdoc failed!", &proc_res);
27112676
}
@@ -2764,7 +2729,7 @@ impl<'test> TestCx<'test> {
27642729
let aux_dir = new_rustdoc.aux_output_dir();
27652730
new_rustdoc.build_all_auxiliary(&new_rustdoc.testpaths, &aux_dir, &mut rustc);
27662731

2767-
let proc_res = new_rustdoc.document(&compare_dir, &new_rustdoc.testpaths);
2732+
let proc_res = new_rustdoc.document(&compare_dir);
27682733
if !proc_res.status.success() {
27692734
eprintln!("failed to run nightly rustdoc");
27702735
return;
@@ -2888,7 +2853,7 @@ impl<'test> TestCx<'test> {
28882853
let out_dir = self.output_base_dir();
28892854
remove_and_create_dir_all(&out_dir);
28902855

2891-
let proc_res = self.document(&out_dir, &self.testpaths);
2856+
let proc_res = self.document(&out_dir);
28922857
if !proc_res.status.success() {
28932858
self.fatal_proc_rec("rustdoc failed!", &proc_res);
28942859
}
@@ -2964,15 +2929,24 @@ impl<'test> TestCx<'test> {
29642929
fn check_rustdoc_test_option(&self, res: ProcRes) {
29652930
let mut other_files = Vec::new();
29662931
let mut files: HashMap<String, Vec<usize>> = HashMap::new();
2967-
let normalized = fs::canonicalize(&self.testpaths.file).expect("failed to canonicalize");
2968-
let normalized = normalized.to_str().unwrap().replace('\\', "/");
2969-
files.insert(normalized, self.get_lines(&self.testpaths.file, Some(&mut other_files)));
2932+
let cwd = env::current_dir().unwrap();
2933+
files.insert(
2934+
self.testpaths
2935+
.file
2936+
.strip_prefix(&cwd)
2937+
.unwrap_or(&self.testpaths.file)
2938+
.to_str()
2939+
.unwrap()
2940+
.replace('\\', "/"),
2941+
self.get_lines(&self.testpaths.file, Some(&mut other_files)),
2942+
);
29702943
for other_file in other_files {
29712944
let mut path = self.testpaths.file.clone();
29722945
path.set_file_name(&format!("{}.rs", other_file));
2973-
let path = fs::canonicalize(path).expect("failed to canonicalize");
2974-
let normalized = path.to_str().unwrap().replace('\\', "/");
2975-
files.insert(normalized, self.get_lines(&path, None));
2946+
files.insert(
2947+
path.strip_prefix(&cwd).unwrap_or(&path).to_str().unwrap().replace('\\', "/"),
2948+
self.get_lines(&path, None),
2949+
);
29762950
}
29772951

29782952
let mut tested = 0;
@@ -3811,7 +3785,7 @@ impl<'test> TestCx<'test> {
38113785
if let Some(nodejs) = &self.config.nodejs {
38123786
let out_dir = self.output_base_dir();
38133787

3814-
self.document(&out_dir, &self.testpaths);
3788+
self.document(&out_dir);
38153789

38163790
let root = self.config.find_rust_src_root().unwrap();
38173791
let file_stem =
@@ -4127,7 +4101,7 @@ impl<'test> TestCx<'test> {
41274101
rustc.arg(crate_name);
41284102
}
41294103

4130-
let res = self.compose_and_run_compiler(rustc, None, self.testpaths);
4104+
let res = self.compose_and_run_compiler(rustc, None);
41314105
if !res.status.success() {
41324106
self.fatal_proc_rec("failed to compile fixed code", &res);
41334107
}

src/tools/compiletest/src/runtest/coverage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ impl<'test> TestCx<'test> {
191191

192192
rustdoc_cmd.arg(&self.testpaths.file);
193193

194-
let proc_res = self.compose_and_run_compiler(rustdoc_cmd, None, self.testpaths);
194+
let proc_res = self.compose_and_run_compiler(rustdoc_cmd, None);
195195
if !proc_res.status.success() {
196196
self.fatal_proc_rec("rustdoc --test failed!", &proc_res)
197197
}

tests/rustdoc/cross-crate-info/cargo-transitive-no-index/auxiliary/q.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-transitive-no-index/auxiliary/t.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-transitive-no-index/s.rs

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-transitive/auxiliary/q.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-transitive/auxiliary/t.rs

Lines changed: 0 additions & 7 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-transitive/s.rs

Lines changed: 0 additions & 24 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-two-no-index/auxiliary/f.rs

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-two-no-index/e.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/rustdoc/cross-crate-info/cargo-two/auxiliary/f.rs

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)