@@ -16,6 +16,7 @@ def realize(pkgpath):
1616realize (ace )
1717
1818def test_ace_dynamic ():
19+ subprocess .run (["bash" , "-c" , "rm rtld_loader.log.*" ])
1920 code = "import ctypes; print(ctypes.cdll.LoadLibrary('libACE_ETCL.so'))"
2021
2122 env = rtld_env .copy ()
@@ -26,8 +27,31 @@ def test_ace_dynamic():
2627 ["%s/bin/python" % python_23_11 , '-c' , code ],
2728 env = env
2829 )
29-
30+
31+ print (str (output , 'UTF-8' ))
3032 assert str (output , 'UTF-8' ).startswith ("<CDLL 'libACE_ETCL.so'" )
3133 print ('OK test_ace_dynamic' )
3234
33- test_ace_dynamic ()
35+ def test_multiple_logs_for_subprocess ():
36+ subprocess .run (["bash" , "-c" , "rm rtld_loader.log.*" ])
37+ code = "import subprocess; subprocess.run(['echo', 'hello, world!'])"
38+ output = subprocess .check_output (
39+ ["%s/bin/python" % python_23_11 , '-c' , code ],
40+ env = {
41+ "LD_AUDIT" : "%s/rtld_loader.so" % pwd ,
42+ "REPLIT_RTLD_LOG_LEVEL" : "3"
43+ }
44+ )
45+ assert os .path .exists ("rtld_loader.log.1" )
46+ assert os .path .exists ("rtld_loader.log.2" )
47+ with open ("rtld_loader.log.1" , "r" ) as f :
48+ content = f .read ()
49+ assert "/bin/python" in content
50+ with open ("rtld_loader.log.2" , "r" ) as f :
51+ content = f .read ()
52+ assert "echo" in content
53+ assert "hello, world!" in content
54+ print ('OK test_multiple_logs_for_subprocess' )
55+
56+ test_ace_dynamic ()
57+ test_multiple_logs_for_subprocess ()
0 commit comments