16 BASE_LOG_DIR = (os.path.expanduser(
'~/.ros/log/'))
17 LOG_FOLDER = os.listdir(BASE_LOG_DIR)
18 LOG_FOLDER.sort(key=
lambda fn: os.path.getmtime(BASE_LOG_DIR+fn)
19 if os.path.isdir(BASE_LOG_DIR+fn)
else 0)
20 LOGFILE = BASE_LOG_DIR+LOG_FOLDER[-1] +
'/rosout.log' 24 """parse args to get camera type 26 @param args: all the arguments 33 for i
in range(0, argc):
34 if args[i] ==
'camera_type' and i+1 < argc:
39 """parse args to get all the camera parameters and paired values 40 the args transferred from .test file, should remove 4 elements 41 in args: start 1 - script name; 42 last 3 - '--gtest_output', '--name', '_log'; 44 @param args: all the arguments 45 @return param_dict: dictionary of camera params 53 for i
in range(0, argc, 2):
55 param_dict.setdefault(params[i], params[i+1])
61 """check if the keyword contains in log""" 62 if (
not os.path.exists(os.path.expanduser(log_file))
or 66 file = open(os.path.expanduser(log_file))
68 if line.find(keyword) != -1:
76 """Execute shell command till timeout""" 77 cmd_proc = subprocess.Popen(cmd, stderr=subprocess.STDOUT,
78 stdout=subprocess.PIPE, shell=
True,
81 pgid = os.getpgid(pid)
84 t_timeout, tick = timeout, 2
93 os.killpg(pgid, signal.SIGTERM)
def shell_cmd_timeout(cmd, timeout=0)
def parse_camera_type(args)
def is_log_contains_keyword(log_file, keyword)
def get_camera_params_and_values(args)