mirror of
https://github.com/frida/frida-python
synced 2026-06-08 14:16:17 +00:00
Use one shared target process between all tests of each TestCase
This commit is contained in:
+9
-7
@@ -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()
|
||||
|
||||
@@ -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,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*")
|
||||
|
||||
Reference in New Issue
Block a user