Skip to content

Commit d3cbfdf

Browse files
committed
removed compiletest + tests/rustdoc
These are in the other pr
1 parent 41d6ce2 commit d3cbfdf

File tree

31 files changed

+34
-319
lines changed

31 files changed

+34
-319
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",
@@ -225,7 +224,6 @@ const KNOWN_DIRECTIVE_NAMES: &[&str] = &[
225224
"should-ice",
226225
"stderr-per-bitwidth",
227226
"test-mir-pass",
228-
"unique-doc-out-dir",
229227
"unset-exec-env",
230228
"unset-rustc-env",
231229
// 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
@@ -96,8 +96,6 @@ pub struct TestProps {
9696
pub compile_flags: Vec<String>,
9797
// Extra flags to pass when the compiled code is run (such as --bench)
9898
pub run_flags: Vec<String>,
99-
/// Extra flags to pass to rustdoc but not the compiler.
100-
pub doc_flags: Vec<String>,
10199
// If present, the name of a file that this test should match when
102100
// pretty-printed
103101
pub pp_exact: Option<PathBuf>,
@@ -125,8 +123,6 @@ pub struct TestProps {
125123
pub unset_exec_env: Vec<String>,
126124
// Build documentation for all specified aux-builds as well
127125
pub build_aux_docs: bool,
128-
// Build the documentation for each crate in a unique output directory
129-
pub unique_doc_out_dir: bool,
130126
// Flag to force a crate to be built with the host architecture
131127
pub force_host: bool,
132128
// Check stdout for error-pattern output as well as stderr
@@ -225,10 +221,8 @@ mod directives {
225221
pub const REGEX_ERROR_PATTERN: &'static str = "regex-error-pattern";
226222
pub const COMPILE_FLAGS: &'static str = "compile-flags";
227223
pub const RUN_FLAGS: &'static str = "run-flags";
228-
pub const DOC_FLAGS: &'static str = "doc-flags";
229224
pub const SHOULD_ICE: &'static str = "should-ice";
230225
pub const BUILD_AUX_DOCS: &'static str = "build-aux-docs";
231-
pub const UNIQUE_DOC_OUT_DIR: &'static str = "unique-doc-out-dir";
232226
pub const FORCE_HOST: &'static str = "force-host";
233227
pub const CHECK_STDOUT: &'static str = "check-stdout";
234228
pub const CHECK_RUN_RESULTS: &'static str = "check-run-results";
@@ -274,7 +268,6 @@ impl TestProps {
274268
regex_error_patterns: vec![],
275269
compile_flags: vec![],
276270
run_flags: vec![],
277-
doc_flags: vec![],
278271
pp_exact: None,
279272
aux_builds: vec![],
280273
aux_bins: vec![],
@@ -289,7 +282,6 @@ impl TestProps {
289282
exec_env: vec![],
290283
unset_exec_env: vec![],
291284
build_aux_docs: false,
292-
unique_doc_out_dir: false,
293285
force_host: false,
294286
check_stdout: false,
295287
check_run_results: false,
@@ -386,8 +378,6 @@ impl TestProps {
386378
|r| r,
387379
);
388380

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

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

src/tools/compiletest/src/runtest.rs

Lines changed: 33 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ use colored::Colorize;
2121
use miropt_test_tools::{files_for_miropt_test, MiroptTest, MiroptTestFile};
2222
use regex::{Captures, Regex};
2323
use rustfix::{apply_suggestions, get_suggestions_from_json, Filter};
24-
use std::borrow::Cow;
2524
use std::collections::{HashMap, HashSet};
2625
use std::env;
2726
use std::ffi::{OsStr, OsString};
@@ -732,7 +731,7 @@ impl<'test> TestCx<'test> {
732731
self.maybe_add_external_args(&mut rustc, &self.config.target_rustcflags);
733732
rustc.args(&self.props.compile_flags);
734733

735-
self.compose_and_run_compiler(rustc, Some(src), self.testpaths)
734+
self.compose_and_run_compiler(rustc, Some(src))
736735
}
737736

738737
fn run_debuginfo_test(&self) {
@@ -1588,15 +1587,13 @@ impl<'test> TestCx<'test> {
15881587
passes,
15891588
);
15901589

1591-
self.compose_and_run_compiler(rustc, None, self.testpaths)
1590+
self.compose_and_run_compiler(rustc, None)
15921591
}
15931592

1594-
/// `root_out_dir` and `root_testpaths` refer to the parameters of the actual test being run.
1595-
/// Auxiliaries, no matter how deep, have the same root_out_dir and root_testpaths.
1596-
fn document(&self, root_out_dir: &Path, root_testpaths: &TestPaths) -> ProcRes {
1593+
fn document(&self, out_dir: &Path) -> ProcRes {
15971594
if self.props.build_aux_docs {
15981595
for rel_ab in &self.props.aux_builds {
1599-
let aux_testpaths = self.compute_aux_test_paths(root_testpaths, rel_ab);
1596+
let aux_testpaths = self.compute_aux_test_paths(&self.testpaths, rel_ab);
16001597
let aux_props =
16011598
self.props.from_aux_file(&aux_testpaths.file, self.revision, self.config);
16021599
let aux_cx = TestCx {
@@ -1607,7 +1604,7 @@ impl<'test> TestCx<'test> {
16071604
};
16081605
// Create the directory for the stdout/stderr files.
16091606
create_dir_all(aux_cx.output_base_dir()).unwrap();
1610-
let auxres = aux_cx.document(&root_out_dir, root_testpaths);
1607+
let auxres = aux_cx.document(out_dir);
16111608
if !auxres.status.success() {
16121609
return auxres;
16131610
}
@@ -1617,47 +1614,21 @@ impl<'test> TestCx<'test> {
16171614
let aux_dir = self.aux_output_dir_name();
16181615

16191616
let rustdoc_path = self.config.rustdoc_path.as_ref().expect("--rustdoc-path not passed");
1620-
1621-
// actual --out-dir given to the auxiliary or test, as opposed to the root out dir for the entire
1622-
// test
1623-
let out_dir: Cow<'_, Path> = if self.props.unique_doc_out_dir {
1624-
let file_name = self
1625-
.testpaths
1626-
.file
1627-
.file_name()
1628-
.expect("file name should not be empty")
1629-
.to_str()
1630-
.expect("file name utf8")
1631-
.trim_end_matches(".rs");
1632-
let out_dir = PathBuf::from_iter([
1633-
root_out_dir,
1634-
Path::new("docs"),
1635-
Path::new(file_name),
1636-
Path::new("doc"),
1637-
]);
1638-
create_dir_all(&out_dir).unwrap();
1639-
Cow::Owned(out_dir)
1640-
} else {
1641-
Cow::Borrowed(root_out_dir)
1642-
};
1643-
16441617
let mut rustdoc = Command::new(rustdoc_path);
1645-
let current_dir = output_base_dir(self.config, root_testpaths, self.safe_revision());
1646-
rustdoc.current_dir(current_dir);
1618+
16471619
rustdoc
16481620
.arg("-L")
16491621
.arg(self.config.run_lib_path.to_str().unwrap())
16501622
.arg("-L")
16511623
.arg(aux_dir)
16521624
.arg("-o")
1653-
.arg(out_dir.as_ref())
1625+
.arg(out_dir)
16541626
.arg("--deny")
16551627
.arg("warnings")
16561628
.arg(&self.testpaths.file)
16571629
.arg("-A")
16581630
.arg("internal_features")
1659-
.args(&self.props.compile_flags)
1660-
.args(&self.props.doc_flags);
1631+
.args(&self.props.compile_flags);
16611632

16621633
if self.config.mode == RustdocJson {
16631634
rustdoc.arg("--output-format").arg("json").arg("-Zunstable-options");
@@ -1667,7 +1638,7 @@ impl<'test> TestCx<'test> {
16671638
rustdoc.arg(format!("-Clinker={}", linker));
16681639
}
16691640

1670-
self.compose_and_run_compiler(rustdoc, None, root_testpaths)
1641+
self.compose_and_run_compiler(rustdoc, None)
16711642
}
16721643

16731644
fn exec_compiled_test(&self) -> ProcRes {
@@ -1865,16 +1836,9 @@ impl<'test> TestCx<'test> {
18651836
}
18661837
}
18671838

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

18791843
rustc.envs(self.props.rustc_env.clone());
18801844
self.props.unset_rustc_env.iter().fold(&mut rustc, Command::env_remove);
@@ -2589,7 +2553,7 @@ impl<'test> TestCx<'test> {
25892553
Vec::new(),
25902554
);
25912555

2592-
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
2556+
let proc_res = self.compose_and_run_compiler(rustc, None);
25932557
let output_path = self.get_filecheck_file("ll");
25942558
(proc_res, output_path)
25952559
}
@@ -2625,7 +2589,7 @@ impl<'test> TestCx<'test> {
26252589
Vec::new(),
26262590
);
26272591

2628-
let proc_res = self.compose_and_run_compiler(rustc, None, self.testpaths);
2592+
let proc_res = self.compose_and_run_compiler(rustc, None);
26292593
let output_path = self.get_filecheck_file("s");
26302594
(proc_res, output_path)
26312595
}
@@ -2708,7 +2672,7 @@ impl<'test> TestCx<'test> {
27082672
let out_dir = self.output_base_dir();
27092673
remove_and_create_dir_all(&out_dir);
27102674

2711-
let proc_res = self.document(&out_dir, &self.testpaths);
2675+
let proc_res = self.document(&out_dir);
27122676
if !proc_res.status.success() {
27132677
self.fatal_proc_rec("rustdoc failed!", &proc_res);
27142678
}
@@ -2767,7 +2731,7 @@ impl<'test> TestCx<'test> {
27672731
let aux_dir = new_rustdoc.aux_output_dir();
27682732
new_rustdoc.build_all_auxiliary(&new_rustdoc.testpaths, &aux_dir, &mut rustc);
27692733

2770-
let proc_res = new_rustdoc.document(&compare_dir, &new_rustdoc.testpaths);
2734+
let proc_res = new_rustdoc.document(&compare_dir);
27712735
if !proc_res.status.success() {
27722736
eprintln!("failed to run nightly rustdoc");
27732737
return;
@@ -2890,7 +2854,7 @@ impl<'test> TestCx<'test> {
28902854
let out_dir = self.output_base_dir();
28912855
remove_and_create_dir_all(&out_dir);
28922856

2893-
let proc_res = self.document(&out_dir, &self.testpaths);
2857+
let proc_res = self.document(&out_dir);
28942858
if !proc_res.status.success() {
28952859
self.fatal_proc_rec("rustdoc failed!", &proc_res);
28962860
}
@@ -2966,15 +2930,24 @@ impl<'test> TestCx<'test> {
29662930
fn check_rustdoc_test_option(&self, res: ProcRes) {
29672931
let mut other_files = Vec::new();
29682932
let mut files: HashMap<String, Vec<usize>> = HashMap::new();
2969-
let normalized = fs::canonicalize(&self.testpaths.file).expect("failed to canonicalize");
2970-
let normalized = normalized.to_str().unwrap().replace('\\', "/");
2971-
files.insert(normalized, self.get_lines(&self.testpaths.file, Some(&mut other_files)));
2933+
let cwd = env::current_dir().unwrap();
2934+
files.insert(
2935+
self.testpaths
2936+
.file
2937+
.strip_prefix(&cwd)
2938+
.unwrap_or(&self.testpaths.file)
2939+
.to_str()
2940+
.unwrap()
2941+
.replace('\\', "/"),
2942+
self.get_lines(&self.testpaths.file, Some(&mut other_files)),
2943+
);
29722944
for other_file in other_files {
29732945
let mut path = self.testpaths.file.clone();
29742946
path.set_file_name(&format!("{}.rs", other_file));
2975-
let path = fs::canonicalize(path).expect("failed to canonicalize");
2976-
let normalized = path.to_str().unwrap().replace('\\', "/");
2977-
files.insert(normalized, self.get_lines(&path, None));
2947+
files.insert(
2948+
path.strip_prefix(&cwd).unwrap_or(&path).to_str().unwrap().replace('\\', "/"),
2949+
self.get_lines(&path, None),
2950+
);
29782951
}
29792952

29802953
let mut tested = 0;
@@ -3813,7 +3786,7 @@ impl<'test> TestCx<'test> {
38133786
if let Some(nodejs) = &self.config.nodejs {
38143787
let out_dir = self.output_base_dir();
38153788

3816-
self.document(&out_dir, &self.testpaths);
3789+
self.document(&out_dir);
38173790

38183791
let root = self.config.find_rust_src_root().unwrap();
38193792
let file_stem =
@@ -4129,7 +4102,7 @@ impl<'test> TestCx<'test> {
41294102
rustc.arg(crate_name);
41304103
}
41314104

4132-
let res = self.compose_and_run_compiler(rustc, None, self.testpaths);
4105+
let res = self.compose_and_run_compiler(rustc, None);
41334106
if !res.status.success() {
41344107
self.fatal_proc_rec("failed to compile fixed code", &res);
41354108
}

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)