diff options
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/topotests/bgp_rpki_topo1/r1/rtrd.py | 8 | ||||
-rw-r--r-- | tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py | 12 |
2 files changed, 16 insertions, 4 deletions
diff --git a/tests/topotests/bgp_rpki_topo1/r1/rtrd.py b/tests/topotests/bgp_rpki_topo1/r1/rtrd.py index f8277b475..d34539a8f 100755 --- a/tests/topotests/bgp_rpki_topo1/r1/rtrd.py +++ b/tests/topotests/bgp_rpki_topo1/r1/rtrd.py @@ -19,6 +19,7 @@ VRPS_FILE = os.path.join(sys.path[0], "vrps.csv") def dbg(m: str): print(m) + sys.stdout.flush() class RTRDatabase(object): @@ -316,4 +317,11 @@ def main(): if __name__ == "__main__": + if len(sys.argv) > 1: + f = open(sys.argv[1], "w") + sys.__stdout__ = f + sys.stdout = f + sys.__stderr__ = f + sys.stderr = f + main() diff --git a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py index 5221b6963..e6b2c4c4f 100644 --- a/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py +++ b/tests/topotests/bgp_rpki_topo1/test_bgp_rpki_topo1.py @@ -51,12 +51,16 @@ def setup_module(mod): tgen.start_router() - r1_path = os.path.join(CWD, "r1") - global rtrd_process - tgen.gears["r1"].cmd("chmod u+x {}/rtrd.py".format(r1_path)) - rtrd_process = tgen.gears["r1"].popen("python3 {}/rtrd.py".format(r1_path)) + rname = "r1" + + rtr_path = os.path.join(CWD, rname) + log_dir = os.path.join(tgen.logdir, rname) + log_file = os.path.join(log_dir, "rtrd.log") + + tgen.gears[rname].cmd("chmod u+x {}/rtrd.py".format(rtr_path)) + rtrd_process = tgen.gears[rname].popen("{}/rtrd.py {}".format(rtr_path, log_file)) def teardown_module(mod): |