From: Bruno Cardoso Lopes Date: Fri, 9 Dec 2016 03:11:48 +0000 (+0000) Subject: [CrashReproducer] Provide a clean dir path for -fmodules-cache-path X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b900dbb1bfe204a552930b746dda0e7ba6cc0dd;p=clang [CrashReproducer] Provide a clean dir path for -fmodules-cache-path 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 --- diff --git a/lib/Driver/Job.cpp b/lib/Driver/Job.cpp index 94ea60663a..68bb4ab102 100644 --- a/lib/Driver/Job.cpp +++ b/lib/Driver/Job.cpp @@ -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 - // .cache/vfs/modules where we already dumped the modules. + // The leftover modules from the crash are stored in + // .cache/vfs/modules + // Leave it untouched for pcm inspection and provide a clean/empty dir + // path to contain the future generated module cache: + // .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()); diff --git a/test/Modules/crash-vfs-path-emptydir-entries.m b/test/Modules/crash-vfs-path-emptydir-entries.m index 01560984ff..e44714bee7 100644 --- a/test/Modules/crash-vfs-path-emptydir-entries.m +++ b/test/Modules/crash-vfs-path-emptydir-entries.m @@ -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': "", diff --git a/test/Modules/crash-vfs-path-symlink-component.m b/test/Modules/crash-vfs-path-symlink-component.m index 6a41188b27..5be492514a 100644 --- a/test/Modules/crash-vfs-path-symlink-component.m +++ b/test/Modules/crash-vfs-path-symlink-component.m @@ -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', diff --git a/test/Modules/crash-vfs-path-symlink-topheader.m b/test/Modules/crash-vfs-path-symlink-topheader.m index 72b666a812..51a14c69c0 100644 --- a/test/Modules/crash-vfs-path-symlink-topheader.m +++ b/test/Modules/crash-vfs-path-symlink-topheader.m @@ -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': "", diff --git a/test/Modules/crash-vfs-path-traversal.m b/test/Modules/crash-vfs-path-traversal.m index 3377de47d0..cc56e53cf1 100644 --- a/test/Modules/crash-vfs-path-traversal.m +++ b/test/Modules/crash-vfs-path-traversal.m @@ -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', diff --git a/test/Modules/crash-vfs-relative-incdir.m b/test/Modules/crash-vfs-relative-incdir.m index 733b79516f..63cd9827c0 100644 --- a/test/Modules/crash-vfs-relative-incdir.m +++ b/test/Modules/crash-vfs-relative-incdir.m @@ -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 diff --git a/test/Modules/crash-vfs-relative-overlay.m b/test/Modules/crash-vfs-relative-overlay.m index 870987c58a..54ba13bbca 100644 --- a/test/Modules/crash-vfs-relative-overlay.m +++ b/test/Modules/crash-vfs-relative-overlay.m @@ -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', diff --git a/test/Modules/crash-vfs-run-reproducer.m b/test/Modules/crash-vfs-run-reproducer.m index e9ecb479a8..72771a2f94 100644 --- a/test/Modules/crash-vfs-run-reproducer.m +++ b/test/Modules/crash-vfs-run-reproducer.m @@ -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