From b12eb5abfa367a4d6734b3ee2d05bc95e6c70632 Mon Sep 17 00:00:00 2001 From: Satish Kumar Date: Wed, 9 Dec 2020 19:50:19 +0000 Subject: corstone: use FVP's PID to detect the listening process Instead of the FVP name, the PID of the FVP process is used inside the search string which finds the listening process. This change allows the process to be found irrespective of the FVP binary path name. Change-Id: Ia5de1f505e7aa4204b934145482e8f3d08d99aef Signed-off-by: Satish Kumar --- iot/scripts/test/fvp_wrapper.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/iot/scripts/test/fvp_wrapper.py b/iot/scripts/test/fvp_wrapper.py index 3d0e509..03d063e 100644 --- a/iot/scripts/test/fvp_wrapper.py +++ b/iot/scripts/test/fvp_wrapper.py @@ -61,6 +61,9 @@ def show_exception_details(e,e_fvp_path,e_fvp_params): print(json.dumps(e_fvp_params, indent=4)) +def get_pid(name): + return int(check_output(["pidof","-s",name])) + # # wait_iris_server: # @@ -80,7 +83,8 @@ def wait_iris_server(fvp_process, iris_port, max_wait_time,wait_reason=0): if int(ret) == 0: raise Exception("netstat command not installed, please install it") - netstat_cmd = ["sh", "-c", 'netstat -tpnl 2>/dev/null | egrep -i ":{0}.+{1}" | wc -l'.format(iris_port, fvp_process)] + pid = get_pid(fvp_process) + netstat_cmd = ["sh", "-c", 'netstat -tpnl 2>/dev/null | egrep -i ":{0}.+{1}" | wc -l'.format(iris_port, pid)] i = 0 @@ -335,7 +339,7 @@ class FVPWrapper(object): else: raise Exception("Failure to detect Iris server port") - fvp_ready = wait_iris_server(fvp_process=self.fvp_name.lower().replace("-",""), + fvp_ready = wait_iris_server(fvp_process=self.fvp_path, iris_port=g_model_port,max_wait_time=g_wait_fvp_ready,wait_reason=0) if fvp_ready == False: @@ -537,7 +541,7 @@ class FVPWrapper(object): #terminates the model and allows the FVP to release the TXT log files self.fvp.release(True) - fvp_terminated = wait_iris_server(fvp_process=self.fvp_name.lower().replace("-", ""), + fvp_terminated = wait_iris_server(fvp_process=self.fvp_path, iris_port=g_model_port, max_wait_time=g_wait_fvp_finish, wait_reason=1) if fvp_terminated == False: -- cgit v1.2.3