[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

llvm-svn: 289176

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

index 94ea606..68bb4ab 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 0156098..e44714b 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 6a41188..5be4925 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 72b666a..51a14c6 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 3377de4..cc56e53 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 733b795..63cd982 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 870987c..54ba13b 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 e9ecb47..72771a2 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