Fix the broken Batch test by passing a custom module cache to the inferior lldb.
authorAdrian Prantl <aprantl@apple.com>
Tue, 12 Mar 2019 22:20:29 +0000 (22:20 +0000)
committerAdrian Prantl <aprantl@apple.com>
Tue, 12 Mar 2019 22:20:29 +0000 (22:20 +0000)
llvm-svn: 355991

lldb/packages/Python/lldbsuite/test/driver/batch_mode/TestBatchMode.py

index f02a8852be31baad0990ea8e2a6a301b757214f5..1188679316326c60eef5c0080c589d98ff97d345 100644 (file)
@@ -47,10 +47,11 @@ class DriverBatchModeTest (TestBase):
 
         import pexpect
         exe = self.getBuildArtifact("a.out")
+        module_cache = self.getBuildArtifact("module.cache")
         prompt = "(lldb) "
 
         # Pass CRASH so the process will crash and stop in batch mode.
-        run_commands = ' -b -o "break set -n main" -o "run" -o "continue" -k "frame var touch_me_not"'
+        run_commands = ' -b -o "settings set symbols.clang-modules-cache-path %s" -o "break set -n main" -o "run" -o "continue" -k "frame var touch_me_not"' % module_cache
         self.child = pexpect.spawn(
             '%s %s %s %s -- CRASH' %
             (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
@@ -87,10 +88,11 @@ class DriverBatchModeTest (TestBase):
 
         import pexpect
         exe = self.getBuildArtifact("a.out")
+        module_cache = self.getBuildArtifact("module.cache")
         prompt = "(lldb) "
 
         # Now do it again, and make sure if we don't crash, we quit:
-        run_commands = ' -b -o "break set -n main" -o "run" -o "continue" '
+        run_commands = ' -b -o "settings set symbols.clang-modules-cache-path %s" -o "break set -n main" -o "run" -o "continue" '%module_cache
         self.child = pexpect.spawn(
             '%s %s %s %s -- NOCRASH' %
             (lldbtest_config.lldbExec, self.lldbOption, run_commands, exe))
@@ -131,6 +133,7 @@ class DriverBatchModeTest (TestBase):
 
         import pexpect
         exe = self.getBuildArtifact("a.out")
+        module_cache = self.getBuildArtifact("module.cache")
         prompt = "(lldb) "
 
         # Finally, start up the process by hand, attach to it, and wait for its completion.
@@ -156,8 +159,8 @@ class DriverBatchModeTest (TestBase):
 
         self.victim.expect("Waiting")
 
-        run_commands = ' -b -o "process attach -p %d" -o "breakpoint set --file %s -p \'Stop here to unset keep_waiting\' -N keep_waiting" -o "continue" -o "break delete keep_waiting" -o "expr keep_waiting = 0" -o "continue" ' % (
-            victim_pid, self.source)
+        run_commands = ' -b  -o "settings set symbols.clang-modules-cache-path %s" -o "process attach -p %d" -o "breakpoint set --file %s -p \'Stop here to unset keep_waiting\' -N keep_waiting" -o "continue" -o "break delete keep_waiting" -o "expr keep_waiting = 0" -o "continue" ' % (
+            module_cache, victim_pid, self.source)
         self.child = pexpect.spawn(
             '%s %s %s %s' %
             (lldbtest_config.lldbExec,