diff options
author | Ed Maste <emaste@freebsd.org> | 2017-09-03 01:44:35 +0000 |
---|---|---|
committer | Ed Maste <emaste@freebsd.org> | 2017-09-03 01:44:35 +0000 |
commit | a64594da5082a1ad26c54d690d2c2d72b9713b7c (patch) | |
tree | 0d6d7db02bf6f8c9d392618d9f4c485b7eee5ac0 /lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py | |
parent | 207184f3457a937b1f24b475cef4c10a2c4ab35c (diff) | |
download | bcm5719-llvm-a64594da5082a1ad26c54d690d2c2d72b9713b7c.tar.gz bcm5719-llvm-a64594da5082a1ad26c54d690d2c2d72b9713b7c.zip |
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
llvm-svn: 312431
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py index 716d0d4f5bc..db01c00bbcd 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/process_attach/TestProcessAttach.py @@ -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 @@ -38,6 +39,29 @@ class ProcessAttachTestCase(TestBase): 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) + def test_attach_to_process_by_name(self): """Test attach by process name""" self.build() |