[lldb/Reproducers] Don't recursively record everything in the CWD
authorJonas Devlieghere <jonas@devlieghere.com>
Tue, 21 Jul 2020 15:59:44 +0000 (08:59 -0700)
committerJonas Devlieghere <jonas@devlieghere.com>
Tue, 21 Jul 2020 16:02:38 +0000 (09:02 -0700)
RecordInterestingDirectory was added to collect dSYM bundles and their
content. For the current working directory we only want the directory to
be part of the VFS, not necessarily its contents. This patch renames the
current method to RecordInterestingDirectoryRecursively and adds a new
one that's not recursive.

lldb/include/lldb/Utility/Reproducer.h
lldb/source/Plugins/SymbolVendor/MacOSX/SymbolVendorMacOSX.cpp
lldb/source/Utility/Reproducer.cpp
lldb/test/Shell/Reproducer/TestWorkingDir.test

index 6fcb839..b3d4707 100644 (file)
@@ -101,6 +101,7 @@ public:
   }
 
   void RecordInterestingDirectory(const llvm::Twine &dir);
+  void RecordInterestingDirectoryRecursive(const llvm::Twine &dir);
 
   void Keep() override {
     auto mapping = GetRoot().CopyByAppendingPathComponent(Info::file);
index e510ee2..3365382 100644 (file)
@@ -299,7 +299,7 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp,
           if (repro::Generator *g =
                   repro::Reproducer::Instance().GetGenerator()) {
             repro::FileProvider &fp = g->GetOrCreate<repro::FileProvider>();
-            fp.RecordInterestingDirectory(dsym_root);
+            fp.RecordInterestingDirectoryRecursive(dsym_root);
           }
         }
         return symbol_vendor;
index 46e909e..3ad1064 100644 (file)
@@ -301,6 +301,11 @@ void WorkingDirectoryProvider::Keep() {
 
 void FileProvider::RecordInterestingDirectory(const llvm::Twine &dir) {
   if (m_collector)
+    m_collector->addFile(dir);
+}
+
+void FileProvider::RecordInterestingDirectoryRecursive(const llvm::Twine &dir) {
+  if (m_collector)
     m_collector->addDirectory(dir);
 }
 
index 76df41f..92a9ccd 100644 (file)
 # referenced.
 
 # RUN: rm -rf %t.repro
+# RUN: rm -rf %t
 # RUN: mkdir -p %t/probably_unique
+# RUN: touch %t/probably_unique/dont_include_me
 # RUN: cd %t/probably_unique
 # RUN: %lldb -x -b -o 'reproducer generate' --capture --capture-path %t.repro
 # RUN: cat %t.repro/cwd.txt | FileCheck %s
 # CHECK: probably_unique
+# RUN: cat %t.repro/files.yaml | FileCHeck %s --check-prefix VFS
+# VFS: probably_unique
+# VFS-NOT: dont_include_me