[Lldb-commits] [lldb] r312431 - Add test case for attach-by-pid from different cwd
Ed Maste via lldb-commits
lldb-commits at lists.llvm.org
Sat Sep 2 18:44:35 PDT 2017
Author: emaste
Date: Sat Sep 2 18:44:35 2017
New Revision: 312431
URL: http://llvm.org/viewvc/llvm-project?rev=312431&view=rev
Log:
Add test case for attach-by-pid from different cwd
This was failing on FreeBSD prior to r312430.
Patch by Vignesh Balu.
Differential Revision: https://reviews.llvm.org/D32522
Modified:
lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
Modified: lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py?rev=312431&r1=312430&r2=312431&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py Sat Sep 2 18:44:35 2017
@@ -8,6 +8,7 @@ from __future__ import print_function
import os
import time
import lldb
+import shutil
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
@@ -34,6 +35,29 @@ class ProcessAttachTestCase(TestBase):
self.runCmd("process attach -p " + str(popen.pid))
target = self.dbg.GetSelectedTarget()
+
+ process = target.GetProcess()
+ self.assertTrue(process, PROCESS_IS_VALID)
+
+ def test_attach_to_process_from_different_dir_by_id(self):
+ """Test attach by process id"""
+ try:
+ os.mkdir(os.path.join(os.getcwd(),'newdir'))
+ except OSError, e:
+ if e.errno != os.errno.EEXIST:
+ raise
+ self.buildProgram('main.cpp',os.path.join(os.getcwd(),'newdir','proc_attach'))
+ exe = os.path.join('.','newdir','proc_attach')
+ self.addTearDownHook(lambda: shutil.rmtree(os.path.join(os.getcwd())))
+
+ # Spawn a new process
+ popen = self.spawnSubprocess(exe)
+ self.addTearDownHook(self.cleanupSubprocesses)
+
+ os.chdir('newdir')
+ self.runCmd("process attach -p " + str(popen.pid))
+
+ target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
self.assertTrue(process, PROCESS_IS_VALID)
More information about the lldb-commits
mailing list