Index: shared/scripts/configuration/sim_setup.sh =================================================================== diff -u --- shared/scripts/configuration/sim_setup.sh (revision 0) +++ shared/scripts/configuration/sim_setup.sh (revision 325957ecac9491e749ae3330c8ede80adb70a1df) @@ -0,0 +1,7 @@ +#!/bin/bash + +cd "$HOME" +nohup ./setupVCAN.sh & +sleep 2 +nohup ./simulator.sh & + Index: shared/scripts/configuration/utility.py =================================================================== diff -u --- shared/scripts/configuration/utility.py (revision 0) +++ shared/scripts/configuration/utility.py (revision 325957ecac9491e749ae3330c8ede80adb70a1df) @@ -0,0 +1,89 @@ +########################################################################### +# +# Copyright (c) 2019-2021 Diality Inc. - All Rights Reserved. +# +# THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, IN PART OR IN +# WHOLE, WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. +# +# @file utils.py +# +# @author (last) Joseph varghese +# @date (last) 15-Jan-2022 +# +############################################################################ + + +import sys +import os +import test +import squish +from dialin.ui import utils + + +Application_name = "denaliSquish" + +COMMON_PATH = f"{os.environ['HOME']}/Projects" + + +def start_application(app_name): + """ + Function to start application and verify application status [running] + If application does not start or running status is false, test stops + Argument: + @param app_name : (str) - Name of the application + @param app_executable : (str) - Actual application + @return: handle for the application if the application is in running state, + or error (exist the application) + """ + counter = 0 + while True: + try: + counter += 1 + test.log("Starting {}".format(app_name)) + squish.startApplication(Application_name) + if counter == 1: + test.log(f"Application launched at the {counter}'st try.") + elif counter == 2: + test.log(f"Application launched at the {counter}'nd try.") + elif counter == 3: + test.log(f"Application launched at the {counter}'rd try.") + else: + test.log(f"Application launched at the {counter}'th try.") + squish.snooze(20) + break + except RuntimeError: + if counter == 1: + test.log(f"Application failed to launch after {counter} try - Please refer logs") + elif counter == 20: + test.log(f"Exiting after {counter} tries..") + sys.exit(1) + else: + test.log(f"Application failed to launch after {counter} tries - Please refer logs") + except: + logErrorDetails("Failed to start the application") + sys.exit(1) + + +def launch_application(test_name): + """ + Method to enables simulator and launch application + @param test_name: (str) name of the test case + @return: None, print out in the console + """ + + test.log("Launching a new instance of Firmware Simulator") + #cleanup() + try: + os.chdir(f"{COMMON_PATH}/testsuites/shared/scripts/configuration") + #out = os.system("sudo chmod 777 sim_setup.sh") + res = os.system("./sim_setup.sh") + utils.waitForGUI(delay_s = 5) + if (res != 0) and (res != 256): + raise Exception("Wrong path to the simulator executable was given. Script not executed") + except Exception as msg: + test.log(str(msg)) + test.log("Launched Simulator......") + + start_application("Denali Application") + +