]> git.lizzy.rs Git - rust.git/commitdiff
Save coverage file in build_base path, not /tmp
authorPhilipp Hansch <dev@phansch.net>
Mon, 25 Mar 2019 21:48:35 +0000 (22:48 +0100)
committerPhilipp Hansch <dev@phansch.net>
Mon, 25 Mar 2019 21:48:35 +0000 (22:48 +0100)
src/bootstrap/flags.rs
src/tools/compiletest/src/common.rs
src/tools/compiletest/src/main.rs
src/tools/compiletest/src/runtest.rs

index 23719378c840af4ca4cf5ba10e9799be1b78fd6d..a1f89d6c86f1d8a345b405307050cb2e2fcb5573 100644 (file)
@@ -193,7 +193,7 @@ pub fn parse(args: &[String]) -> Flags {
                     "",
                     "rustfix-coverage",
                     "enable this to generate a Rustfix coverage file, which is saved in \
-                        `/tmp/rustfix_missing_coverage.txt`",
+                        `/<build_base>/rustfix_missing_coverage.txt`",
                 );
             }
             "bench" => {
index 7a15d753e2df1d8b55900021a7514d8d7e46ea4e..9d4effb4f58607c0118713687d837f7ec9669d4f 100644 (file)
@@ -247,7 +247,7 @@ pub struct Config {
 
     /// If true, this will generate a coverage file with UI test files that run `MachineApplicable`
     /// diagnostics but are missing `run-rustfix` annotations. The generated coverage file is
-    /// created in `/tmp/rustfix_missing_coverage.txt`
+    /// created in `/<build_base>/rustfix_missing_coverage.txt`
     pub rustfix_coverage: bool,
 
     // Configuration for various run-make tests frobbing things like C compilers
index 1045ea1bf0c96d9c91038aec742d173b49a8192d..b9ddf04fad9871903107da2dd08b8782df18b7a0 100644 (file)
@@ -237,7 +237,7 @@ pub fn parse_config(args: Vec<String>) -> Config {
             "",
             "rustfix-coverage",
             "enable this to generate a Rustfix coverage file, which is saved in \
-                `/tmp/rustfix_missing_coverage.txt`",
+                `./<build_base>/rustfix_missing_coverage.txt`",
         )
         .optflag("h", "help", "show this message");
 
@@ -486,9 +486,10 @@ pub fn run_tests(config: &Config) {
     // we first make sure that the coverage file does not exist.
     // It will be created later on.
     if config.rustfix_coverage {
-        let coverage_file_path = Path::new("/tmp/rustfix_missing_coverage.txt");
+        let mut coverage_file_path = config.build_base.clone();
+        coverage_file_path.push("rustfix_missing_coverage.txt");
         if coverage_file_path.exists() {
-            if let Err(e) = fs::remove_file(coverage_file_path) {
+            if let Err(e) = fs::remove_file(&coverage_file_path) {
                 panic!("Could not delete {} due to {}", coverage_file_path.display(), e)
             }
         }
index 0ca656bb13328c39f0666ccc51aa79ae9fae11e4..c18b6db9a010fc9b6ca2e1c4ae6c3887fb0ff32f 100644 (file)
@@ -2829,11 +2829,14 @@ fn run_ui_test(&self) {
             if suggestions.len() > 0
                 && !self.props.run_rustfix
                 && !self.props.rustfix_only_machine_applicable {
-                    let coverage_file_path = Path::new("/tmp/rustfix_missing_coverage.txt");
+                    let mut coverage_file_path = self.config.build_base.clone();
+                    coverage_file_path.push("rustfix_missing_coverage.txt");
+                    debug!("coverage_file_path: {}", coverage_file_path.display());
+
                     let mut file = OpenOptions::new()
                         .create(true)
                         .append(true)
-                        .open(coverage_file_path)
+                        .open(coverage_file_path.as_path())
                         .expect("could not create or open file");
 
                     if let Err(_) = writeln!(file, "{}", self.testpaths.file.display()) {