From 77e7df19d420d4c83ce3fae7a46c553006ee2767 Mon Sep 17 00:00:00 2001 From: Chuck SmileyRekiere Date: Sat, 15 May 2021 12:53:04 -0600 Subject: [PATCH] lf_check.py : added timeout to running test lf_check_config.ini : updates Signed-off-by: Chuck SmileyRekiere --- py-scripts/sandbox/lf_check.py | 26 +++++++++++++++++++++++--- py-scripts/sandbox/lf_check_config.ini | 20 ++++++++++---------- 2 files changed, 33 insertions(+), 13 deletions(-) diff --git a/py-scripts/sandbox/lf_check.py b/py-scripts/sandbox/lf_check.py index 7f6c9049..bbad060d 100755 --- a/py-scripts/sandbox/lf_check.py +++ b/py-scripts/sandbox/lf_check.py @@ -234,6 +234,8 @@ class lf_check(): print("command: {}".format(command)) print("cmd_args {}".format(cmd_args)) + + if self.outfile is not None: stdout_log_txt = self.outfile stdout_log_txt = stdout_log_txt + "-{}-stdout.txt".format(test) @@ -244,18 +246,36 @@ class lf_check(): #print("stderr_log_txt: {}".format(stderr_log_txt)) stderr_log = open(stderr_log_txt, 'a') process = subprocess.Popen((command).split(' '), shell=False, stdout=stdout_log, stderr=stderr_log, universal_newlines=True) + try: + out, err = process.communicate(timeout=20) + except: + #if err: + print("command Test timed out: {}".format(command)) + # close the file + stdout_log.flush() stdout_log.close() - stderr_log.close() - sleep(2) + stderr_log.flush() + stderr_log.close() #print(stdout_log_txt) stdout_log_size = os.path.getsize(stdout_log_txt) - stdout_log_size = os.stat(stdout_log_txt).st_size + stdout_log_st_size = os.stat(stdout_log_txt).st_size print("stdout_log_size {}".format(stdout_log_size)) + print("stdout_log_st_size {}".format(stdout_log_st_size)) print("stdout {}".format(os.stat(stdout_log_txt))) + + + + stderr_log_size = os.path.getsize(stderr_log_txt) + stderr_log_st_size = os.stat(stderr_log_txt).st_size + #print("stderr_log_size {}".format(stderr_log_size)) + #print("stderr_log_st_size {}".format(stderr_log_st_size)) + #print("stderr {}".format(os.stat(stderr_log_txt))) + + #print(stderr_log_txt) stderr_log_size = os.path.getsize(stderr_log_txt) if stderr_log_size > 0 : diff --git a/py-scripts/sandbox/lf_check_config.ini b/py-scripts/sandbox/lf_check_config.ini index 9cfe2e49..6d7d1573 100755 --- a/py-scripts/sandbox/lf_check_config.ini +++ b/py-scripts/sandbox/lf_check_config.ini @@ -40,16 +40,16 @@ REPORT_DATA="/home/lanforge/report-data" # NOTE: the [TEST_DICTIONARY] TEST_DICT: { - "example_security_connection0":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_0_CFG --debug"}, - "example_security_connection1":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_2_CFG --debug"}, - "example_security_connection2":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_3_CFG --debug"}, - "example_security_connection3":{"enabled":"TRUE","command":"example_security_connection.py","args":"RADIO_4_CFG --debug"}, - "sta_connect2":{"enabled":"TRUE","command":"sta_connect2.py","args":"--dut_ssid jedway-wpa2-x2048-5-3 --dut_passwd jedway-wpa2-x2048-5-3 --dut_security wpa2"}, - "test_generic0":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_0_CFG --type lfping --dest TEST_IP --debug"}, - "test_generic1":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_0_CFG --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --debug"}, - "test_generic2":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_0_CFG --type lfping --dest TEST_IP --debug"}, - "test_generic3":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_0_CFG --type lfping --dest TEST_IP --debug"}, - "test_ipv4_connection":{"enabled":"FALSE","command":"test_ipv4_connection.py","args":"RADIO_0_CFG --debug"}, + "example_security_connection0":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_0_CFG --debug"}, + "example_security_connection1":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_2_CFG --debug"}, + "example_security_connection2":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_3_CFG --debug"}, + "example_security_connection3":{"enabled":"FALSE","command":"example_security_connection.py","args":"RADIO_4_CFG --debug"}, + "sta_connect2":{"enabled":"TRUE","FALSE":"sta_connect2.py","args":"--dut_ssid jedway-wpa2-x2048-5-3 --dut_passwd jedway-wpa2-x2048-5-3 --dut_security wpa2"}, + "test_generic0":{"enabled":"FALSE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"}, + "test_generic1":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --debug"}, + "test_generic2":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"}, + "test_generic3":{"enabled":"TRUE","command":"test_generic.py","args":"RADIO_1_CFG --type lfping --dest TEST_IP --debug"}, + "test_ipv4_connection":{"enabled":"TRUE","command":"test_ipv4_connection.py","args":"RADIO_0_CFG --debug"}, "test_ipv4_l4_urls_per_ten":{"enabled":"FALSE","command":"test_ipv4_l4_urls_per_ten.py","args":""}, "test_ipv4_l4_wifi":{"enabled":"FALSE","command":"test_ipv4_l4_wifi.py","args":""}, "test_ipv4_l4":{"enabled":"FALSE","command":"test_ipv4_l4.py","args":""},