Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r353c3f31d770db01cd2a37421dffef5166d6c20a -r50a76caec4a97fcdeb026d0ea7ec9c2d3c38bfeb --- shared/scripts/configuration/utility.py (.../utility.py) (revision 353c3f31d770db01cd2a37421dffef5166d6c20a) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 50a76caec4a97fcdeb026d0ea7ec9c2d3c38bfeb) @@ -12,55 +12,16 @@ # ############################################################################ - +import math +import squish import sys import test -import squish -import math from dialin.common import MsgIds from dialin.utils import * from dialin.protocols import DenaliMessage, DenaliCanMessenger, DenaliChannels from builtins import int as pyInt - +from datetime import datetime -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(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - logErrorDetails("Failed to start the application") - sys.exit(1) - - def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container @@ -181,3 +142,10 @@ payload=payload) return message + +def get_current_date_and_time(date_format='%Y/%b/%d - %H:%M'): + + date = datetime.now() + return str(date.strftime(date_format)) + +