Commit f347f3fc authored by Luke Macken's avatar Luke Macken

Add a functional test for the pyrasite script itself

parent 38b20592
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
import os import os
import sys import sys
import unittest import unittest
import subprocess
import pyrasite import pyrasite
...@@ -65,6 +66,21 @@ class TestCodeInjection(unittest.TestCase): ...@@ -65,6 +66,21 @@ class TestCodeInjection(unittest.TestCase):
finally: finally:
os.unlink(program) os.unlink(program)
def test_pyrasite_script(self):
program = generate_program()
try:
for exe in interpreters():
print("sys.executable = %s" % sys.executable)
print("injecting into %s" % exe)
p = run_program(program, exe=exe)
subprocess.call([sys.executable, 'pyrasite/main.py',
str(p.pid), 'pyrasite/payloads/helloworld.py'],
env={'PYTHONPATH': os.getcwd()})
stop_program(p)
stdout, stderr = p.communicate()
self.assert_output_contains(stdout, stderr, 'Hello World!')
finally:
os.unlink(program)
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment