mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2024-12-27 23:22:09 +00:00
38ceb554fd
The code that is there to run some unit tests on some internal features was moved to tests/unit. Ideally it should be buildable from the main makefile though this is not yet the case. The code that is kept for experimentation purposes (hashes, syscall optimization etc) as well as some captures of the results was moved to tests/exp. A few totally obsolete files which couldn't build anymore and were not relevant to current versions were removed.
29 lines
577 B
Python
29 lines
577 B
Python
#!/usr/bin/python
|
|
"""
|
|
Python wrapper example to test socketpair protocol
|
|
./test-socketpair.py test.cfg
|
|
|
|
use sockpair@${FD1} and sockpair@${FD2} in your configuration file
|
|
|
|
"""
|
|
|
|
import socket, os, sys
|
|
|
|
s = socket.socketpair(socket.AF_UNIX, socket.SOCK_STREAM)
|
|
os.set_inheritable(s[0].fileno(), 1)
|
|
os.set_inheritable(s[1].fileno(), 1)
|
|
|
|
FD1 = s[0].fileno()
|
|
FD2 = s[1].fileno()
|
|
|
|
print("FD1={} FD2={}".format(FD1, FD2))
|
|
|
|
os.environ["FD1"] = str(FD1)
|
|
os.environ["FD2"] = str(FD2)
|
|
|
|
cmd = ["./haproxy",
|
|
"-f",
|
|
"{}".format(sys.argv[1])
|
|
]
|
|
os.execve(cmd[0], cmd, os.environ)
|