1
0

proj: Restructure

This commit is contained in:
2025-03-04 14:49:15 +01:00
parent d85f506a8d
commit de790eabf9
10 changed files with 291 additions and 207 deletions

28
proj/server/src/test-memory Executable file
View 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()