From c4c62a5591bdaa061ef6bab7fc18b29ff02a00c4 Mon Sep 17 00:00:00 2001 From: Zalathar Date: Fri, 18 Oct 2024 13:30:31 +1100 Subject: [PATCH] Rename `inputs` to `common_inputs_stamp` The new name makes it clearer that this is a timestamp, and is collected from input files considered common to all tests. --- src/tools/compiletest/src/lib.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/tools/compiletest/src/lib.rs b/src/tools/compiletest/src/lib.rs index acf4860cc631..5c148e371434 100644 --- a/src/tools/compiletest/src/lib.rs +++ b/src/tools/compiletest/src/lib.rs @@ -547,7 +547,7 @@ pub fn test_opts(config: &Config) -> test::TestOpts { struct TestCollectorCx { config: Arc, cache: HeadersCache, - inputs: Stamp, + common_inputs_stamp: Stamp, modified_tests: Vec, } @@ -565,13 +565,13 @@ struct TestCollector { /// because filtering is handled later by libtest. pub fn collect_and_make_tests(config: Arc) -> Vec { debug!("making tests from {:?}", config.src_base.display()); - let inputs = common_inputs_stamp(&config); + let common_inputs_stamp = common_inputs_stamp(&config); let modified_tests = modified_tests(&config, &config.src_base).unwrap_or_else(|err| { panic!("modified_tests got error from dir: {}, error: {}", config.src_base.display(), err) }); let cache = HeadersCache::load(&config); - let cx = TestCollectorCx { config, cache, inputs, modified_tests }; + let cx = TestCollectorCx { config, cache, common_inputs_stamp, modified_tests }; let mut collector = TestCollector { tests: vec![], found_paths: HashSet::new(), poisoned: false }; @@ -592,7 +592,13 @@ pub fn collect_and_make_tests(config: Arc) -> Vec { tests } -/// Returns a stamp constructed from input files common to all test cases. +/// Returns the most recent last-modified timestamp from among the input files +/// that are considered relevant to all tests (e.g. the compiler, std, and +/// compiletest itself). +/// +/// (Some of these inputs aren't actually relevant to _all_ tests, but they are +/// common to some subset of tests, and are hopefully unlikely to be modified +/// while working on other tests.) fn common_inputs_stamp(config: &Config) -> Stamp { let rust_src_dir = config.find_rust_src_root().expect("Could not find Rust source root"); @@ -902,14 +908,14 @@ fn is_up_to_date( // Check the timestamp of the stamp file against the last modified time // of all files known to be relevant to the test. - let mut inputs = cx.inputs.clone(); + let mut inputs_stamp = cx.common_inputs_stamp.clone(); for path in files_related_to_test(&cx.config, testpaths, props, revision) { - inputs.add_path(&path); + inputs_stamp.add_path(&path); } // If no relevant files have been modified since the stamp file was last // written, the test is up-to-date. - inputs < Stamp::from_path(&stamp_name) + inputs_stamp < Stamp::from_path(&stamp_name) } /// The maximum of a set of file-modified timestamps.