Use one shared target process between all tests of each TestCase

This commit is contained in:
Ole André Vadla Ravnås
2014-01-05 00:58:47 +01:00
parent 4b26ffd690
commit 808019ea9e
3 changed files with 27 additions and 21 deletions
+9 -7
View File
@@ -10,17 +10,19 @@ except:
class TestCore(unittest.TestCase):
def setUp(self):
@classmethod
def setUpClass(cls):
system = platform.system()
if system == 'Windows':
self.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
else:
self.target = subprocess.Popen(["/bin/cat"])
self.process = frida.attach(self.target.pid)
cls.target = subprocess.Popen(["/bin/cat"])
cls.process = frida.attach(cls.target.pid)
def tearDown(self):
self.process.detach()
self.target.terminate()
@classmethod
def tearDownClass(cls):
cls.process.detach()
cls.target.terminate()
def test_enumerate_devices(self):
devices = frida.get_device_manager().enumerate_devices()
+9 -7
View File
@@ -11,17 +11,19 @@ except:
class TestDiscoverer(unittest.TestCase):
def setUp(self):
@classmethod
def setUpClass(cls):
system = platform.system()
if system == 'Windows':
self.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
else:
self.target = subprocess.Popen(["/bin/cat"])
self.process = frida.attach(self.target.pid)
cls.target = subprocess.Popen(["/bin/cat"])
cls.process = frida.attach(cls.target.pid)
def tearDown(self):
self.process.detach()
self.target.terminate()
@classmethod
def tearDownClass(cls):
cls.process.detach()
cls.target.terminate()
def test_basics(self):
test_ui = TestUI()
+9 -7
View File
@@ -9,17 +9,19 @@ except:
class TestTracer(unittest.TestCase):
def setUp(self):
@classmethod
def setUpClass(cls):
system = platform.system()
if system == 'Windows':
self.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
cls.target = subprocess.Popen([r"C:\Windows\notepad.exe"])
else:
self.target = subprocess.Popen(["/bin/cat"])
self.process = frida.attach(self.target.pid)
cls.target = subprocess.Popen(["/bin/cat"])
cls.process = frida.attach(cls.target.pid)
def tearDown(self):
self.process.detach()
self.target.terminate()
@classmethod
def tearDownClass(cls):
cls.process.detach()
cls.target.terminate()
def test_basics(self):
tp = TracerProfileBuilder().include("open*")