proj: Restructure
This commit is contained in:
28
proj/server/src/test-memory
Executable file
28
proj/server/src/test-memory
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import argparse
|
||||
import threading
|
||||
import subprocess
|
||||
|
||||
import intercept
|
||||
import intercept.standard
|
||||
|
||||
|
||||
def socket_thread(socket: str) -> None:
|
||||
intercept.intercept(socket, intercept.standard.MemoryAllocationTester)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser()
|
||||
args, extra = parser.parse_known_args()
|
||||
socket_name = f'/tmp/intercept.memory.{os.getpid()}.sock'
|
||||
t1 = threading.Thread(target=socket_thread, args=(socket_name,))
|
||||
t1.daemon = True
|
||||
t1.start()
|
||||
subprocess.run(extra, env={'LD_PRELOAD': os.getcwd() + '/../../intercept/intercept.so', 'INTERCEPT': 'unix:' + socket_name})
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user