-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdual_trace.py
More file actions
24 lines (18 loc) · 811 Bytes
/
Copy pathdual_trace.py
File metadata and controls
24 lines (18 loc) · 811 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python3
import os
import subprocess
import sys
assert len(sys.argv) == 2
subprocess.check_call('which python3', shell=True)
with open('/tmp/echo.txt', 'w') as f:
cmd = f"python3 ./bin/echo_vm py_samples/{sys.argv[1]}.py"
env = dict(os.environ)
env.update(E_PREFIX='', ECHO_DUMP_INSTS='1', PYTHONPATH=os.getcwd()+'/src:'+os.environ.get('PYTHONPATH', ''))
print(cmd)
print(env)
subprocess.call(cmd, shell=True, stdout=f, stderr=subprocess.STDOUT, env=env, cwd=os.getcwd())
with open('/tmp/cpython.txt', 'w') as f:
cmd = f'python3 ./bin/minimal_tracer.py py_samples/{sys.argv[1]}.py'
print(cmd)
subprocess.check_call(cmd, stdout=f, stderr=subprocess.STDOUT, shell=True, cwd=os.getcwd())
subprocess.call('vimdiff /tmp/echo.txt /tmp/cpython.txt', shell=True)