Skip to content

Commit d808bd4

Browse files
committed
Save coverage file in build_base path, not /tmp
1 parent 98d7c54 commit d808bd4

File tree

4 files changed

+11
-7
lines changed

4 files changed

+11
-7
lines changed

src/bootstrap/flags.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ To learn more about a subcommand, run `./x.py <subcommand> -h`"
193193
"",
194194
"rustfix-coverage",
195195
"enable this to generate a Rustfix coverage file, which is saved in \
196-
`/tmp/rustfix_missing_coverage.txt`",
196+
`/<build_base>/rustfix_missing_coverage.txt`",
197197
);
198198
}
199199
"bench" => {

src/tools/compiletest/src/common.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ pub struct Config {
247247

248248
/// If true, this will generate a coverage file with UI test files that run `MachineApplicable`
249249
/// diagnostics but are missing `run-rustfix` annotations. The generated coverage file is
250-
/// created in `/tmp/rustfix_missing_coverage.txt`
250+
/// created in `/<build_base>/rustfix_missing_coverage.txt`
251251
pub rustfix_coverage: bool,
252252

253253
// Configuration for various run-make tests frobbing things like C compilers

src/tools/compiletest/src/main.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
237237
"",
238238
"rustfix-coverage",
239239
"enable this to generate a Rustfix coverage file, which is saved in \
240-
`/tmp/rustfix_missing_coverage.txt`",
240+
`./<build_base>/rustfix_missing_coverage.txt`",
241241
)
242242
.optflag("h", "help", "show this message");
243243

@@ -486,9 +486,10 @@ pub fn run_tests(config: &Config) {
486486
// we first make sure that the coverage file does not exist.
487487
// It will be created later on.
488488
if config.rustfix_coverage {
489-
let coverage_file_path = Path::new("/tmp/rustfix_missing_coverage.txt");
489+
let mut coverage_file_path = config.build_base.clone();
490+
coverage_file_path.push("rustfix_missing_coverage.txt");
490491
if coverage_file_path.exists() {
491-
if let Err(e) = fs::remove_file(coverage_file_path) {
492+
if let Err(e) = fs::remove_file(&coverage_file_path) {
492493
panic!("Could not delete {} due to {}", coverage_file_path.display(), e)
493494
}
494495
}

src/tools/compiletest/src/runtest.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -2829,11 +2829,14 @@ impl<'test> TestCx<'test> {
28292829
if suggestions.len() > 0
28302830
&& !self.props.run_rustfix
28312831
&& !self.props.rustfix_only_machine_applicable {
2832-
let coverage_file_path = Path::new("/tmp/rustfix_missing_coverage.txt");
2832+
let mut coverage_file_path = self.config.build_base.clone();
2833+
coverage_file_path.push("rustfix_missing_coverage.txt");
2834+
debug!("coverage_file_path: {}", coverage_file_path.display());
2835+
28332836
let mut file = OpenOptions::new()
28342837
.create(true)
28352838
.append(true)
2836-
.open(coverage_file_path)
2839+
.open(coverage_file_path.as_path())
28372840
.expect("could not create or open file");
28382841

28392842
if let Err(_) = writeln!(file, "{}", self.testpaths.file.display()) {

0 commit comments

Comments
 (0)