]> granicus.if.org Git - clang/commitdiff
[CrashReproducer] Provide a clean dir path for -fmodules-cache-path
authorBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 9 Dec 2016 03:11:48 +0000 (03:11 +0000)
committerBruno Cardoso Lopes <bruno.cardoso@gmail.com>
Fri, 9 Dec 2016 03:11:48 +0000 (03:11 +0000)
The most common workflow with module reproducers involves deleting the
module cache before running the script. This happens because leftovers
from the crash are present in the cache and could trigger unrelated and
confusing errors, misleading from the initial reproduction intent.
Change this to point to a clean path but leave the leftovers untouched.

rdar://problem/28655070

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289176 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/Job.cpp
test/Modules/crash-vfs-path-emptydir-entries.m
test/Modules/crash-vfs-path-symlink-component.m
test/Modules/crash-vfs-path-symlink-topheader.m
test/Modules/crash-vfs-path-traversal.m
test/Modules/crash-vfs-relative-incdir.m
test/Modules/crash-vfs-relative-overlay.m
test/Modules/crash-vfs-run-reproducer.m

index 94ea60663ab4b1f6fd68850138f3f62de56382b1..68bb4ab102eea28a27813b5fa7b788ff80a58cae 100644 (file)
@@ -267,11 +267,14 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote,
     OS << ' ';
     printArg(OS, CrashInfo->VFSPath.str(), Quote);
 
-    // Insert -fmodules-cache-path and use the relative module directory
-    // <name>.cache/vfs/modules where we already dumped the modules.
+    // The leftover modules from the crash are stored in
+    //  <name>.cache/vfs/modules
+    // Leave it untouched for pcm inspection and provide a clean/empty dir
+    // path to contain the future generated module cache:
+    //  <name>.cache/vfs/repro-modules
     SmallString<128> RelModCacheDir = llvm::sys::path::parent_path(
         llvm::sys::path::parent_path(CrashInfo->VFSPath));
-    llvm::sys::path::append(RelModCacheDir, "modules");
+    llvm::sys::path::append(RelModCacheDir, "repro-modules");
 
     std::string ModCachePath = "-fmodules-cache-path=";
     ModCachePath.append(RelModCacheDir.c_str());
index 01560984ff710577f33135192d40a79d8549014d..e44714bee7f69bf1e7018a5db233b973009cfda3 100644 (file)
@@ -37,7 +37,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'type': 'directory',
 // CHECKYAML: 'name': "",
index 6a41188b271a17a2ccd2a9775f71d001db7588af..5be492514a09b82ed74539330259d8e4a4f70413 100644 (file)
@@ -38,7 +38,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
index 72b666a8127cd0efbe865ad2c635f05a71a68415..51a14c69c077cf32f828b58462d062415bbcfdc8 100644 (file)
@@ -39,7 +39,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'type': 'directory',
 // CHECKYAML: 'name': "",
index 3377de47d0b2e1e201192f02dfcac96635af81da..cc56e53cf1bf41891bd0400ffd4ff525b1190492 100644 (file)
@@ -35,7 +35,7 @@
 // CHECKSH-NOT: "-fmodules-cache-path="
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
index 733b79516f28e962ed5b653ac63bd7942659b971..63cd9827c0130cec5ec08576b2cae0c423b53e5c 100644 (file)
@@ -31,7 +31,7 @@
 // CHECKSH: "-I" "/[[INCPATH:.*]]/include"
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
@@ -53,6 +53,5 @@
 // inside .cache/vfs, mapped by .cache/vfs/vfs.yaml.
 
 // RUN: cd %t
-// RUN: rm -rf crash-vfs-relative-incdir-*.cache/modules
 // RUN: chmod 755 crash-vfs-*.sh
 // RUN: ./crash-vfs-*.sh
index 870987c58abdb22ff87d7dbdd1bddc403e597d09..54ba13bbca3927e98a9ad0e4577c1996bf07f571 100644 (file)
@@ -34,7 +34,7 @@
 // CHECKSH: "-isysroot" "{{[^"]*}}/i/"
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
index e9ecb479a8908bc474d89badfa6a3110d0de23a5..72771a2f9479ffdf5d9e655d851f79cd6ffe2729 100644 (file)
@@ -31,7 +31,7 @@
 // CHECKSH: "-isysroot" "{{[^"]*}}/i/"
 // CHECKSH: "crash-vfs-{{[^ ]*}}.m"
 // CHECKSH: "-ivfsoverlay" "crash-vfs-{{[^ ]*}}.cache/vfs/vfs.yaml"
-// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/modules"
+// CHECKSH: "-fmodules-cache-path=crash-vfs-{{[^ ]*}}.cache/repro-modules"
 
 // CHECKYAML: 'case-sensitive':
 // CHECKYAML-NEXT: 'use-external-names': 'false',
@@ -53,6 +53,5 @@
 // inside .cache/vfs, mapped by .cache/vfs/vfs.yaml.
 
 // RUN: cd %t
-// RUN: rm -rf crash-vfs-run-reproducer-*.cache/modules/*
 // RUN: chmod 755 crash-vfs-*.sh
 // RUN: ./crash-vfs-*.sh