lf_check.py : added timeout to running test lf_check_config.ini : updates

Signed-off-by: Chuck SmileyRekiere <chuck.smileyrekiere@candelatech.com>
This commit is contained in:
Chuck SmileyRekiere
2021-05-15 12:53:04 -06:00
parent dec87339a7
commit 77e7df19d4
2 changed files with 33 additions and 13 deletions

View File

@@ -234,6 +234,8 @@ class lf_check():
print("command: {}".format(command)) print("command: {}".format(command))
print("cmd_args {}".format(cmd_args)) print("cmd_args {}".format(cmd_args))
if self.outfile is not None: if self.outfile is not None:
stdout_log_txt = self.outfile stdout_log_txt = self.outfile
stdout_log_txt = stdout_log_txt + "-{}-stdout.txt".format(test) 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)) #print("stderr_log_txt: {}".format(stderr_log_txt))
stderr_log = open(stderr_log_txt, 'a') stderr_log = open(stderr_log_txt, 'a')
process = subprocess.Popen((command).split(' '), shell=False, stdout=stdout_log, stderr=stderr_log, universal_newlines=True) 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 # close the file
stdout_log.flush()
stdout_log.close() stdout_log.close()
stderr_log.close()
sleep(2) stderr_log.flush()
stderr_log.close()
#print(stdout_log_txt) #print(stdout_log_txt)
stdout_log_size = os.path.getsize(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_size {}".format(stdout_log_size))
print("stdout_log_st_size {}".format(stdout_log_st_size))
print("stdout {}".format(os.stat(stdout_log_txt))) 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) #print(stderr_log_txt)
stderr_log_size = os.path.getsize(stderr_log_txt) stderr_log_size = os.path.getsize(stderr_log_txt)
if stderr_log_size > 0 : if stderr_log_size > 0 :

View File

@@ -40,16 +40,16 @@ REPORT_DATA="/home/lanforge/report-data"
# NOTE: the # NOTE: the
[TEST_DICTIONARY] [TEST_DICTIONARY]
TEST_DICT: { TEST_DICT: {
"example_security_connection0":{"enabled":"TRUE","command":"example_security_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":"TRUE","command":"example_security_connection.py","args":"RADIO_2_CFG --debug"}, "example_security_connection1":{"enabled":"FALSE","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_connection2":{"enabled":"FALSE","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"}, "example_security_connection3":{"enabled":"FALSE","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"}, "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":"TRUE","command":"test_generic.py","args":"RADIO_0_CFG --type lfping --dest TEST_IP --debug"}, "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_0_CFG --type speedtest --speedtest_min_up 20 --speedtest_min_dl 20 --speedtest_max_ping 150 --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_0_CFG --type lfping --dest TEST_IP --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_0_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":"FALSE","command":"test_ipv4_connection.py","args":"RADIO_0_CFG --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_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_wifi":{"enabled":"FALSE","command":"test_ipv4_l4_wifi.py","args":""},
"test_ipv4_l4":{"enabled":"FALSE","command":"test_ipv4_l4.py","args":""}, "test_ipv4_l4":{"enabled":"FALSE","command":"test_ipv4_l4.py","args":""},