Index: suite_leahi/shared/scripts/configuration/application_init.py =================================================================== diff -u --- suite_leahi/shared/scripts/configuration/application_init.py (revision 0) +++ suite_leahi/shared/scripts/configuration/application_init.py (revision 742f5ee77d1f59bf553700dd433779b4d0a22be0) @@ -0,0 +1,142 @@ +import test +import sys +import os + +from leahi_dialin.ui import utils +from configuration import config +from configuration import utility + +# WARNING: these variables has to match with the ones in the run.sh and in UI code +POSTMSG_POSTFIX_PASSED = " passed" +POSTMSG_POSTFIX_FAILED = " failed" + +_postmsg_osversion = "DIALITY_VERSION_ID=" # DIALITY_VERSION_ID="0.0.40" +_postmsg_osbuild = "BUILD_ID=" # BUILD_ID="20230628230011" +_postmsg_canbus = "CANBus" # POSTMSG_CANBUS="CANBus" +_postmsg_sdcard = "SD-CARD" # POSTMSG_SDCARD="SD-CARD" +_postmsg_touch = "Touch" # POSTMSG_TOUCH="Touch" +_postmsg_rtc = "RTC" # POSTMSG_RTC="RTC" +_postmsg_wifi = "WiFi" # POSTMSG_WIFI="WiFi" +_postmsg_bluetooth = "Bluetooth" # POSTMSG_BLUETOOTH="Bluetooth" +_postmsg_shasum = "App shasum" # POSTMSG_SHASUM="App shasum" +_postmsg_cloudsync = "CloudSync" # POSTMSG_CLOUDSYNC="CloudSync" +_devEthernet = "eth0:" +_devWireless = "wlan0:" +_devBluetooth = "hci0:" + +_yearMinimum = 2022 # The year to check for minimum + +def remove_mock_app_post_log_file(): + if os.path.exists(config.APP_POST_LOG_LOCATION): + os.remove(config.APP_POST_LOG_LOCATION) + else: + test.log("mock post.log file does not exist") + +def get_pass_fail_string(isPassed : bool): + if isPassed: + return POSTMSG_POSTFIX_PASSED + else : + return POSTMSG_POSTFIX_FAILED + +def setup_post_log_successful_start(): + return generate_mock_app_post_log_file(canBus_passed = True, + eth0_passed = True, + sdCard_passed = True, + rtc_passed = True, + wifi_passed = True, + bt_passed = True, + touch_passed = True, + shasum_passed = True, + cloudSync_passed= True, + build_version = "123.123.123", + build_id = "20230628230011") + +def generate_mock_app_post_log_file(canBus_passed : bool, + eth0_passed : bool, + sdCard_passed : bool, + rtc_passed : bool, + wifi_passed : bool, + bt_passed : bool, + touch_passed : bool, + shasum_passed : bool, + cloudSync_passed: bool, + build_version : str, + build_id : str): + """ + To create / write an empty file to the expected application POST log location + """ + test.log(f"write output file : {config.APP_POST_LOG_LOCATION}") + with open(config.APP_POST_LOG_LOCATION, "w") as outputFile: + canBus_string = _postmsg_canbus + get_pass_fail_string(isPassed = canBus_passed) + sdCard_string = _postmsg_sdcard + get_pass_fail_string(isPassed = sdCard_passed) + rtc_string = _postmsg_rtc + get_pass_fail_string(isPassed = rtc_passed) + wifi_string = _postmsg_wifi + get_pass_fail_string(isPassed = wifi_passed) + bt_string = _postmsg_bluetooth + get_pass_fail_string(isPassed = bt_passed) + touch_string = _postmsg_touch + get_pass_fail_string(isPassed = touch_passed) + shasum_string = _postmsg_shasum + get_pass_fail_string(isPassed = shasum_passed) + cloudsync_string = _postmsg_cloudsync + get_pass_fail_string(isPassed = cloudSync_passed) + if eth0_passed: + eth0_string = "2: eth0: mtu 1500 qdisc mq state UP group default qlen 1000\n" + eth0_string += " link/ether 00:19:b8:07:f4:5f brd ff:ff:ff:ff:ff:ff\n" + eth0_string += " inet 192.168.0.14/24 brd 192.168.0.255 scope global eth0\n" + eth0_string += " valid_lft forever preferred_lft forever\n" + else: + eth0_string = "eth0 failed" + try: + outputFile.write("-------------------------------------------------------------------------------- ***** \n" + "Start: 20230924-000346\n" + "-------------------------------------------------------------------------------- Ethernet \n" + + eth0_string + "\n" + "-------------------------------------------------------------------------------- CANBus \n" + + canBus_string +"\n" + "3: can0: mtu 16 qdisc pfifo_fast state DOWN mode DEFAULT group default qlen 4000\n" + " link/can \n" + "-------------------------------------------------------------------------------- SD-CARD \n" + + sdCard_string +"\n" + "/dev/mmcblk1p1 on /media/sd-card type ext4 (rw,relatime)\n" + "/dev/mmcblk1p1 15G 580M 14G 5% /media/sd-card\n" + "-------------------------------------------------------------------------------- RTC\n" + + rtc_string +"\n" + "-------------------------------------------------------------------------------- WiFi \n" + + wifi_string + " [driver]\n" + "[ 6.689981] wlan: loading driver v4.5.25.57 \n" + "[ 7.403618] wlan: driver loaded in 712000 \n" + "start wpa_supplicant service \n" + + wifi_string + " [service] \n" + "-------------------------------------------------------------------------------- WiFi Connection \n" + "connecting to WiFi \n" + "4: wlan0: mtu 1500 qdisc mq state UP mode DORMANT group default qlen 3000 \n" + " link/ether 3c:e1:a1:0c:96:66 brd ff:ff:ff:ff:ff:ff \n" + "-------------------------------------------------------------------------------- Bluetooth \n" + + bt_string +"\n" + "hci0: Type: Primary Bus: UART \n" + " BD Address: 3C:E1:A1:0C:96:67 ACL MTU: 1024:7 SCO MTU: 60:8 \n" + " UP RUNNING \n" + " RX bytes:707 acl:0 sco:0 events:41 errors:0 \n" + " TX bytes:1229 acl:0 sco:0 commands:41 errors:0 \n" + "-------------------------------------------------------------------------------- Touch \n" + + touch_string +"\n" + "[ 7.034495] input: Atmel maXTouch Touchscreen as /devices/platform/soc@0/soc@0:bus@30800000/30a50000.i2c/i2c-3/3-004a/input/input2 \n" + "-------------------------------------------------------------------------------- CloudSystem \n" + "4: wlan0: mtu 1500 qdisc mq state UP group default qlen 3000 \n" + " link/ether 3c:e1:a1:0c:96:66 brd ff:ff:ff:ff:ff:ff \n" + " inet 192.168.0.21/24 brd 192.168.0.255 scope global wlan0 \n" + " valid_lft forever preferred_lft forever \n" + "PING www.diality.staging.kebormed.com (20.102.77.181): 56 data bytes \n" + + "--- www.diality.staging.kebormed.com ping statistics --- \n" + "3 packets transmitted, 0 packets received, 100% packet loss \n" + "-------------------------------------------------------------------------------- Sha256Sum \n" + + shasum_string +"\n" + "-------------------------------------------------------------------------------- CloudSync \n" + + cloudsync_string +"\n" + "CloudSync app IS running \n" + "-------------------------------------------------------------------------------- Denali \n" + "DIALITY_VERSION_ID=\""+build_version+"\"\n" + "BUILD_ID=\""+build_id+"\"\n" + "End: 20230924-000431 \n" + "time spent: 45 seconds \n" + "-------------------------------------------------------------------------------- ***** \n") + return True + except: + return False Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u --- suite_leahi/shared/scripts/configuration/config.py (revision 0) +++ suite_leahi/shared/scripts/configuration/config.py (revision 742f5ee77d1f59bf553700dd433779b4d0a22be0) @@ -0,0 +1,14 @@ +from configuration.strings import * + +# -S, --disable-sd-card-fail-log-stop disable-sd-card-fail-log-stop +# -k, --enable-check-in-log Enables Check-In Log +# -K, --enable-acknow-log Enables Acknowledgment Log + +AUT_NAME = "leahi -k -K -S -q" +AUT_NAME_ONLY = "leahi" # Need only the AUT name for tst_ui_logs, do not add options +HOME_DIR_PATH = "/home/denali" +TMP_DIR = "/tmp/" + +ENABLED = True + +APP_POST_LOG_LOCATION = "".join([str(TMP_DIR),'/post.log'])