From e1c27bce4b731ac85a7f7cc41cb0a71b5d2abbcb Mon Sep 17 00:00:00 2001 From: cherat01 Date: Thu, 21 Nov 2024 09:16:32 +0530 Subject: [PATCH 1/9] init and parser changes --- .../recipes-acs/install-files/files/init.sh | 36 +- common/config/acs_config.txt | 2 +- common/linux_scripts/init.sh | 50 +- common/linux_scripts/secure_init.sh | 22 +- common/log_parser/main_log_parser.sh | 66 +- common/log_parser/test_category.json | 170 +---- common/log_parser/test_categoryDT.json | 668 ++++++++++++++++++ 7 files changed, 786 insertions(+), 228 deletions(-) create mode 100644 common/log_parser/test_categoryDT.json diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh index 853932a6..ebe95bc0 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh @@ -62,6 +62,7 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then #LINUX DEBUG DUMP + echo "Collecting Linux debug logs" LINUX_DUMP_DIR="/mnt/acs_results/linux_dump" mkdir -p $LINUX_DUMP_DIR lspci -vvv &> $LINUX_DUMP_DIR/lspci.log @@ -81,7 +82,7 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then fwupdmgr get-history &> $LINUX_DUMP_DIR/fwupd_get_history.log sync /mnt sleep 5 - + echo "Linux debug logs run - Completed" # FWTS EBBR run mkdir -p /mnt/acs_results/fwts @@ -93,18 +94,23 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then echo -e -n "\n" sync /mnt sleep 5 + echo "FWTS test execution - Completed" #LINUX BSA RUN mkdir -p /mnt/acs_results/linux_acs/bsa_acs_app - echo "Loading BSA ACS Linux Driver" - insmod /lib/modules/*/kernel/bsa_acs/bsa_acs.ko - echo "Executing BSA ACS Application " - echo "SystemReady devicetree band ACS v3.0.0-BETA0" > /mnt/acs_results/linux_acs/bsa_acs_app/BSALinuxResults.log - bsa >> /mnt/acs_results/linux_acs/bsa_acs_app/BSALinuxResults.log - dmesg | sed -n 'H; /PE_INFO/h; ${g;p;}' > /mnt/acs_results/linux_acs/bsa_acs_app/BsaResultsKernel.log - sync /mnt - sleep 5 + if [ -f /lib/modules/*/kernel/bsa_acs/bsa_acs.ko ]; then + echo "Running Linux BSA tests" + insmod /lib/modules/*/kernel/bsa_acs/bsa_acs.ko + echo "SystemReady devicetree band ACS v3.0.0-BETA0" > /mnt/acs_results/linux_acs/bsa_acs_app/BSALinuxResults.log + bsa >> /mnt/acs_results/linux_acs/bsa_acs_app/BSALinuxResults.log + dmesg | sed -n 'H; /PE_INFO/h; ${g;p;}' > /mnt/acs_results/linux_acs/bsa_acs_app/BsaResultsKernel.log + sync /mnt + sleep 5 + echo "Linux BSA test execution - Completed" + else + echo "Error: BSA kernel Driver is not found. Linux BSA tests cannot be run" + fi # Device Driver Info script @@ -148,12 +154,14 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then # Capturing System PSCI command output + echo "Collecting psci command output" mkdir -p /mnt/acs_results/linux_tools/psci mount -t debugfs none /sys/kernel/debug cat /sys/kernel/debug/psci > /mnt/acs_results/linux_tools/psci/psci.log dmesg | grep psci > /mnt/acs_results/linux_tools/psci/psci_kernel.log sync /mnt sleep 5 + echo "PSCI command output - Completed" # DT Kernel Self test run @@ -165,10 +173,11 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then popd sync /mnt sleep 5 + echo "DT Kernel Self test run - Completed" # ETHTOOL test run - echo "Running Ethtool" + echo "Running Ethtool test" # update resolv.conf with 8.8.8.8 DNS server echo "nameserver 8.8.8.8" >> /etc/resolv.conf # run ethtool-test.py, dump ethernet information, run self-tests if supported, and ping @@ -177,6 +186,7 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then awk '{gsub(/\x1B\[[0-9;]*[JKmsu]/, "")}1' ethtool-test.log > /mnt/acs_results/linux_tools/ethtool-test.log sync /mnt sleep 5 + echo "Ethtool test run - Completed" # READ_WRITE_BLOCK_DEVICE run @@ -185,6 +195,7 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then python3 /bin/read_write_check_blk_devices.py | tee /mnt/acs_results/linux_tools/read_write_check_blk_devices.log sync /mnt sleep 5 + echo "BLK devices read and write check - Completed" umount /mnt sleep 5 @@ -256,12 +267,13 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then if [ -d "/mnt/acs_results/acs_summary" ]; then rm -r /mnt/acs_results/acs_summary fi - /usr/bin/log_parser/main_log_parser.sh /mnt/acs_results /mnt/acs_tests/config/acs_config_dt.txt /mnt/acs_tests/config/system_config.txt + /usr/bin/log_parser/main_log_parser.sh /mnt/acs_results /mnt/acs_tests/config/acs_config_dt.txt /mnt/acs_tests/config/system_config.txt /mnt/acs_tests/config/acs_waiver.json fi sync /mnt sleep 5 - echo "ACS run is completed" + echo "ACS automated test suites run is completed." + echo "Please reboot to run BBSR tests if not done" fi else echo "" diff --git a/common/config/acs_config.txt b/common/config/acs_config.txt index 752bb2e8..a2e3aec7 100644 --- a/common/config/acs_config.txt +++ b/common/config/acs_config.txt @@ -1,4 +1,4 @@ -ACS version: ACS v24.11_3.0.0 +ACS version: ACS v24.11_3.0.0-BET0 SRS version: SRS 3.0 BSA version: BSA v1.0C SBSA version: SBSA v7.1 diff --git a/common/linux_scripts/init.sh b/common/linux_scripts/init.sh index 1eb1835c..29976129 100644 --- a/common/linux_scripts/init.sh +++ b/common/linux_scripts/init.sh @@ -91,7 +91,10 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then exec sh +m fi - #linux debug dump + + #Linux debug dump + + echo "Collecting Linux Debug Dump" mkdir -p /mnt/acs_results/linux_dump dmesg > /mnt/acs_results/linux_dump/dmesg.log lspci > /mnt/acs_results/linux_dump/lspci.log @@ -134,75 +137,100 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then mount -t debugfs none /sys/kernel/debug cat /sys/kernel/debug/psci > /mnt/acs_results/linux_tools/psci/psci.log dmesg | grep psci > /mnt/acs_results/linux_tools/psci/psci_kernel.log + sync /mnt + sleep 5 + echo "Linux Debug Dump - Completed" + + # FWTS (SBBR) Execution mkdir -p /mnt/acs_results/fwts - #SBBR Execution echo "Executing FWTS for SBBR" echo "SystemReady band ACS v3.0.0-BETA0" > /mnt/acs_results/fwts/FWTSResults.log fwts -r stdout -q --uefi-set-var-multiple=1 --uefi-get-mn-count-multiple=1 --sbbr esrt uefibootpath aest cedt slit srat hmat pcct pdtt bgrt bert einj erst hest sdei nfit iort mpam ibft ras2 >> /mnt/acs_results/fwts/FWTSResults.log + sync /mnt + sleep 5 + echo "FWTS Execution - Completed" - sleep 2 + # Linux BSA Execution mkdir -p /mnt/acs_results/linux - echo "Running Linux BSA tests" if [ -f /lib/modules/bsa_acs.ko ]; then + echo "Running Linux BSA tests" insmod /lib/modules/bsa_acs.ko echo "SystemReady band ACS v3.0.0-BETA0" > /mnt/acs_results/linux/BsaResultsApp.log /bin/bsa >> /mnt/acs_results/linux/BsaResultsApp.log dmesg | sed -n 'H; /PE_INFO/h; ${g;p;}' > /mnt/acs_results/linux/BsaResultsKernel.log + sync /mnt + sleep 5 + echo "Linux BSA test Execution - Completed" else echo "Error: BSA kernel Driver is not found. Linux BSA tests cannot be run." fi + # Linux SBSA Execution + # Read the value of SbsaRunEnabled if [ -f /mnt/acs_tests/config/acs_run_config.ini ]; then SbsaRunEnabled=$(grep -E '^SbsaRunEnabled=' "/mnt/acs_tests/config/acs_run_config.ini" | cut -d'=' -f2 || echo "0") if [ "$SbsaRunEnabled" == "1" ]; then - echo "Running Linux SBSA tests" if [ -f /lib/modules/sbsa_acs.ko ]; then - insmod /lib/modules/sbsa_acs.ko + echo "Running Linux SBSA tests" + insmod /lib/modules/sbsa_acs.ko echo "SystemReady band ACS v3.0.0-BETA0" > /mnt/acs_results/linux/SbsaResultsApp.log /bin/sbsa >> /mnt/acs_results/linux/SbsaResultsApp.log dmesg | sed -n 'H; /PE_INFO/h; ${g;p;}' > /mnt/acs_results/linux/SbsaResultsKernel.log + sync /mnt + sleep 5 + echo "Linux SBSA test Execution - Completed" else echo "Error: SBSA kernel Driver is not found. Linux SBSA tests cannot be run." fi fi fi + # EDK2 test parser + if [ -d "/mnt/acs_results/sct_results" ]; then echo "Running edk2-test-parser tool " mkdir -p /mnt/acs_results/edk2-test-parser cd /usr/bin/edk2-test-parser ./parser.py --md /mnt/acs_results/edk2-test-parser/edk2-test-parser.log /mnt/acs_results/sct_results/Overall/Summary.ekl /mnt/acs_results/sct_results/Sequence/SBBR.seq > /dev/null 2>&1 cd - - sleep 3 echo "edk2-test-parser run completed" sync /mnt + sleep 5 else echo "SCT result does not exist, cannot run edk2-test-parser tool cannot run" fi + # Device Driver script run + if [ -f "/mnt/acs_results/uefi_dump/devices.log" ] && [ -f "/mnt/acs_results/uefi_dump/drivers.log" ] && [ -f "/mnt/acs_results/uefi_dump/dh.log" ]; then echo "Running Device Driver Matching Script" cd /usr/bin/ ./device_driver.sh --md /mnt/acs_results/linux_dump/device_driver.log /mnt/acs_results/uefi_dump/devices.log /mnt/acs_results/uefi_dump/drivers.log /mnt/acs_results/uefi_dump/dh.log > /dev/null 2>&1 cd - echo "Device Driver script run completed" + sync /mnt + sleep 5 else echo "Devices/Driver/dh log does not exist, cannot run the script" fi + # ACS log parser run + echo "Running acs log parser tool " if [ -d "/mnt/acs_results" ]; then if [ -d "/mnt/acs_results/acs_summary" ]; then rm -r /mnt/acs_results/acs_summary fi - /usr/bin/log_parser/main_log_parser.sh /mnt/acs_results /mnt/acs_tests/config/acs_config.txt /mnt/acs_tests/config/system_config.txt + /usr/bin/log_parser/main_log_parser.sh /mnt/acs_results /mnt/acs_tests/config/acs_config.txt /mnt/acs_tests/config/system_config.txt /mnt/acs_tests/config/acs_waiver.json + sync /mnt + sleep 5 fi - sleep 3 - echo "The ACS test suites are completed." + echo "ACS automated test suites run is completed." + echo "Please reboot to run BBSR tests if not done" else echo "" echo "Additional option set to not run ACS Tests. Skipping ACS tests on Linux" @@ -210,6 +238,6 @@ else fi sync /mnt -sleep 3 +sleep 5 exec sh +m diff --git a/common/linux_scripts/secure_init.sh b/common/linux_scripts/secure_init.sh index 01ac0863..6a1b69f7 100644 --- a/common/linux_scripts/secure_init.sh +++ b/common/linux_scripts/secure_init.sh @@ -49,6 +49,8 @@ mkdir -p /mnt/acs_results/BBSR/fwts # Add the YOCTO_FLAG variable YOCTO_FLAG="/mnt/yocto_image.flag" +# FWTS test execution + if [ -f /bin/bbsr_fwts_tests.ini ]; then test_list=`cat /bin/bbsr_fwts_tests.ini | grep -v "^#" | awk '{print $1}' | xargs` echo "Test Executed are $test_list" @@ -58,9 +60,12 @@ if [ -f /bin/bbsr_fwts_tests.ini ]; then echo "SystemReady band ACS v3.0.0-BETA0" > /mnt/acs_results/BBSR/fwts/FWTSResults.log fi fwts `echo $test_list` -f -r stdout >> /mnt/acs_results/BBSR/fwts/FWTSResults.log + sync /mnt + sleep 5 fi -# run tpm2 tests +# TPM2 tests execution + mkdir -p /mnt/acs_results/BBSR/tpm2 if [ -f /sys/kernel/security/tpm0/binary_bios_measurements ]; then echo "TPM2: dumping PCRs and event log" @@ -77,8 +82,23 @@ if [ -f /sys/kernel/security/tpm0/binary_bios_measurements ]; then else echo "PCR reg entry not found at the end of event log, eventlog vs pcr comparision not possible " fi + sync /mnt + sleep 5 else echo "TPM event log not found at /sys/kernel/security/tpm0/binary_bios_measurements" fi +# ACS log parser run + +echo "Running acs log parser tool " +if [ -d "/mnt/acs_results" ]; then + if [ -d "/mnt/acs_results/acs_summary" ]; then + rm -r /mnt/acs_results/acs_summary + fi + /usr/bin/log_parser/main_log_parser.sh /mnt/acs_results /mnt/acs_tests/config/acs_config.txt /mnt/acs_tests/config/system_config.txt /mnt/acs_results/config/acs_waiver.json + sync /mnt + sleep 5 +fi + +echo "ACS test run completed" exit 0 diff --git a/common/log_parser/main_log_parser.sh b/common/log_parser/main_log_parser.sh index c8c2f828..95f48f5d 100755 --- a/common/log_parser/main_log_parser.sh +++ b/common/log_parser/main_log_parser.sh @@ -22,21 +22,36 @@ SCRIPTS_PATH="$BASE_DIR" # Check for required arguments if [ $# -lt 1 ]; then - echo "Usage: $0 [acs_config.txt] [system_config.txt] [waiver.json] [test_category.json]" + echo "Usage: $0 [acs_config.txt] [system_config.txt] [waiver.json]" exit 1 fi +# Add the YOCTO_FLAG variable +YOCTO_FLAG="/mnt/yocto_image.flag" + +# Check if the YOCTO_FLAG exists +if [ -f "$YOCTO_FLAG" ]; then + YOCTO_FLAG_PRESENT=1 +else + YOCTO_FLAG_PRESENT=0 +fi + LOGS_PATH=$1 ACS_CONFIG_PATH=$2 SYSTEM_CONFIG_PATH=$3 WAIVER_JSON=$4 -test_category=$5 + +if [ $YOCTO_FLAG_PRESENT -eq 1 ]; then + test_category="/usr/bin/log_parser/test_categoryDT.json" +else + test_category="/usr/bin/log_parser/test_category.json" +fi # Check if ACS_CONFIG_PATH is provided if [ -z "$ACS_CONFIG_PATH" ]; then echo "WARNING: ACS information will be affected on summary page as acs_config.txt is not provided" echo "" - echo "If you want ACS information, please use this format: $0 [acs_config.txt] [system_config.txt] [waiver.json] [test_category.json]" + echo "If you want ACS information, please use this format: $0 [acs_config.txt] [system_config.txt] [waiver.json]" echo "" fi @@ -44,7 +59,7 @@ fi if [ -z "$SYSTEM_CONFIG_PATH" ]; then echo "WARNING: System information may be incomplete as system_config.txt is not provided" echo "" - echo "If you want complete system information, please use this format: $0 [acs_config.txt] [system_config.txt] [waiver.json] [test_category.json]" + echo "If you want complete system information, please use this format: $0 [acs_config.txt] [system_config.txt] [waiver.json]" echo "" fi @@ -52,42 +67,25 @@ fi WAIVERS_APPLIED=0 # Check if waiver.json and test_category.json are provided -if [ -n "$WAIVER_JSON" ] && [ -n "$test_category" ]; then - if [ -f "$WAIVER_JSON" ] && [ -f "$test_category" ]; then +if [ -n "$WAIVER_JSON" ] then + if [ -f "$WAIVER_JSON" ] then WAIVERS_APPLIED=1 echo "Waivers will be applied using:" echo " Waiver File : $WAIVER_JSON" - echo " Output JSON File : $test_category" +# echo " Output JSON File : $test_category" echo "" else - echo "WARNING: Both waiver.json ('$WAIVER_JSON') and test_category.json ('$test_category') must be provided and exist to apply waivers." + echo "WARNING: waiver.json ('$WAIVER_JSON') must be provided to apply waivers." echo "Waivers will not be applied." echo "" WAIVER_JSON="" - test_category="" fi else - if [ -n "$WAIVER_JSON" ] || [ -n "$test_category" ]; then - echo "WARNING: Both waiver.json and test_category.json must be provided to apply waivers." - echo "Waivers will not be applied." - echo "" - else - echo "WARNING: waiver.json and test_category.json not provided. Waivers will not be applied." - echo "" - fi + echo "WARNING: waiver.json and test_category.json not provided. Waivers will not be applied." + echo "" WAIVER_JSON="" - test_category="" fi -# Add the YOCTO_FLAG variable -YOCTO_FLAG="/mnt/yocto_image.flag" - -# Check if the YOCTO_FLAG exists -if [ -f "$YOCTO_FLAG" ]; then - YOCTO_FLAG_PRESENT=1 -else - YOCTO_FLAG_PRESENT=0 -fi # Function to check if a file exists check_file() { @@ -105,8 +103,8 @@ apply_waivers() { if [ "$WAIVERS_APPLIED" -eq 1 ]; then python3 "$SCRIPTS_PATH/apply_waivers.py" "$suite_name" "$json_file" "$WAIVER_JSON" "$test_category" - else - echo "Waivers not applied for suite '$suite_name' as waiver files are not provided." + # else + # echo "Waivers not applied for suite '$suite_name' as waiver files are not provided." fi } @@ -362,7 +360,7 @@ else echo "WARNING: os-logs directory not found at $OS_LOGS_PATH" fi -# Generate combined manual tests detailed and summary HTML reports +# Generate combined OS tests detailed and summary HTML reports if [ ${#MANUAL_JSONS[@]} -gt 0 ]; then MANUAL_DETAILED_HTML="$HTMLS_DIR/manual_tests_detailed.html" MANUAL_SUMMARY_HTML="$HTMLS_DIR/manual_tests_summary.html" @@ -370,7 +368,7 @@ if [ ${#MANUAL_JSONS[@]} -gt 0 ]; then python3 "$SCRIPTS_PATH/manual_tests/json_to_html.py" "${MANUAL_JSONS[@]}" "$MANUAL_DETAILED_HTML" "$MANUAL_SUMMARY_HTML" --include-drop-down --boot-sources-paths "${BOOT_SOURCES_PATHS[@]}" fi # --------------------------------------------------------- -# End of Manual Tests Processing +# End of OS Tests Processing # --------------------------------------------------------- # Generate ACS Summary @@ -402,7 +400,7 @@ else GENERATE_ACS_SUMMARY_CMD+=" \"\"" fi -# Include Manual Tests summary only if processed +# Include OS Tests summary only if processed if [ $MANUAL_TESTS_PROCESSED -eq 1 ]; then GENERATE_ACS_SUMMARY_CMD+=" \"$MANUAL_SUMMARY_HTML\"" else @@ -496,7 +494,7 @@ if [ $MVP_PROCESSED -eq 1 ]; then echo "" fi -# Print Manual Tests messages only if processed +# Print OS Tests messages only if processed if [ $MANUAL_TESTS_PROCESSED -eq 1 ]; then echo "Manual Tests Logs Processed" echo "Manual Tests Detailed Summary : $MANUAL_DETAILED_HTML" @@ -562,7 +560,7 @@ elif [ $MVP_PROCESSED -eq 1 ]; then echo "WARNING: No MVP JSON files found. Skipping MVP files." fi -# Include manual tests JSON files in merged JSON +# Include OS tests JSON files in merged JSON if [ $MANUAL_TESTS_PROCESSED -eq 1 ] && [ ${#MANUAL_JSONS[@]} -gt 0 ]; then JSON_FILES+=("${MANUAL_JSONS[@]}") elif [ $MANUAL_TESTS_PROCESSED -eq 1 ]; then diff --git a/common/log_parser/test_category.json b/common/log_parser/test_category.json index 5f3deb64..aa70cee6 100644 --- a/common/log_parser/test_category.json +++ b/common/log_parser/test_category.json @@ -455,175 +455,7 @@ ] } }, - "catID: 22": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 1, - "TSName": "Network", - "testcase": [], - "specID": 8, - "specName": "SRS", - "severityID": 2, - "Severity": "Major", - "waivableID": 1, - "Waivable": "yes", - "scopeID": 1, - "scope": "core", - "FunctionID": 4, - "Function": "runtime" - } - ] - } - }, - "catID: 23": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 2, - "TSName": "Peripherals", - "testcase": [], - "specID": 8, - "specName": "SRS", - "severityID": 2, - "Severity": "Major", - "waivableID": 1, - "Waivable": "yes", - "scopeID": 2, - "scope": "extension", - "FunctionID": 4, - "Function": "runtime" - } - ] - } - }, - "catID: 24": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 3, - "TSName": "security", - "testcase": [], - "specID": 3, - "specName": "BBSR", - "severityID": 3, - "Severity": "Minor", - "waivableID": 1, - "Waivable": "yes", - "scopeID": 2, - "scope": "extension", - "FunctionID": 3, - "Function": "security" - } - ] - } - }, - "catID: 25": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 4, - "TSName": "A/B support", - "testcase": [], - "specID": 8, - "specName": "SRS", - "severityID": 3, - "Severity": "Minor", - "waivableID": 1, - "Waivable": "yes", - "scopeID": 2, - "scope": "extension", - "FunctionID": 2, - "Function": "maintenance" - } - ] - } - }, - "catID: 26": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 5, - "TSName": "LinuxInstall", - "testcase": [], - "specID": 8, - "specName": "SRS", - "severityID": 1, - "Severity": "Critical", - "waivableID": 2, - "Waivable": "no", - "scopeID": 1, - "scope": "core", - "FunctionID": 6, - "Function": "other" - } - ] - } - }, - "catID: 27": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 6, - "TSName": "CapsuleAutherntication", - "testcase": [], - "specID": 8, - "specName": "SRS", - "severityID": 2, - "Severity": "Major", - "waivableID": 2, - "Waivable": "no", - "scopeID": 1, - "scope": "core", - "FunctionID": 2, - "Function": "maintenance" - } - ] - } - }, - "catID: 28": { - "SuiteID: 4": { - "SName: MVP": [ - { - "TestSuiteID": 7, - "TSName": "DTValidation", - "testcase": [], - "specID": 8, - "specName": "SRS", - "severityID": 1, - "Severity": "Critical", - "waivableID": 1, - "Waivable": "no", - "scopeID": 1, - "scope": "core", - "FunctionID": 1, - "Function": "boot" - } - ] - } - }, - "catID: 29": { - "SuiteID: 5": { - "SName: MVP": [ - { - "TestSuiteID": 8, - "TSName": "Boot sources", - "testcase": [], - "specID": 3, - "specName": "DT", - "severityID": 2, - "Severity": "Major", - "waivableID": 1, - "Waivable": "yes", - "scopeID": 1, - "scope": "core", - "FunctionID": 1, - "Function": "boot" - } - ] - } - }, - "catID: 30": { + "catID: 30": { "SuiteID: 5": { "SName: BBSR-SCT": [ { diff --git a/common/log_parser/test_categoryDT.json b/common/log_parser/test_categoryDT.json new file mode 100644 index 00000000..5f3deb64 --- /dev/null +++ b/common/log_parser/test_categoryDT.json @@ -0,0 +1,668 @@ +{ + "catID: 1": { + "SuiteID: 1": { + "SName: BSA": [ + { + "TestSuiteID": 1, + "TSName": "PE", + "testcase": [], + "specID": 1, + "specName": "BSA", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "no", + "scopeID": 2, + "scope": "extension", + "FunctionID": 9, + "Function": "Physical interoperability" + } + ] + } + }, + "catID: 2": { + "SuiteID: 2": { + "SName: SBSA": [ + { + "TestSuiteID": 2, + "TSName": "PE", + "testcase": [], + "specID": 1, + "specName": "SBSA", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 9, + "Function": "Physical interoperability" + } + ] + } + }, + "catID: 3": { + "SuiteID: 1": { + "SName: BSA": [ + { + "TestSuiteID": 3, + "TSName": "GIC", + "testcase": [], + "specID": 1, + "specName": "BSA", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 9, + "Function": "Physical interoperability" + } + ] + } + }, + "catID: 4": { + "SuiteID: 1": { + "SName: BSA": [ + { + "TestSuiteID": 4, + "TSName": "PCIe", + "testcase": [], + "specID": 1, + "specName": "BSA", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 9, + "Function": "Physical interoperability" + } + ] + } + }, + "catID: 5": { + "SuiteID: 1": { + "SName: BSA": [ + { + "TestSuiteID": 5, + "TSName": "Timer", + "testcase": [], + "specID": 1, + "specName": "BSA", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 9, + "Function": "Physical interoperability" + } + ] + } + }, + "catID: 6": { + "SuiteID: 2": { + "SName: FWTS": [ + { + "TestSuiteID": 1, + "TSName": "uefivar", + "testcase": [], + "specID": 4, + "specName": "EBBR", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 7": { + "SuiteID: 2": { + "SName: FWTS": [ + { + "TestSuiteID": 2, + "TSName": "uefirtmisc", + "testcase": [], + "specID": 4, + "specName": "EBBR", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 6, + "Function": "other" + } + ] + } + }, + "catID: 8": { + "SuiteID: 2": { + "SName: FWTS": [ + { + "TestSuiteID": 3, + "TSName": "dmicheck", + "testcase": [], + "specID": 4, + "specName": "EBBR", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 9": { + "SuiteID: 2": { + "SName: FWTS": [ + { + "TestSuiteID": 4, + "TSName": "esrt", + "testcase": [], + "specID": 4, + "specName": "EBBR", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 10": { + "SuiteID: 2": { + "SName: FWTS": [ + { + "TestSuiteID": 5, + "TSName": "rtservices", + "testcase": [], + "specID": 4, + "specName": "EBBR", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 4, + "Function": "runtime" + } + ] + } + }, + "catID: 11": { + "SuiteID: 2": { + "SName: FWTS": [ + { + "TestSuiteID": 6, + "TSName": "bootservices", + "testcase": [], + "specID": 4, + "specName": "EBBR", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 12": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 11, + "TSName": "PSCI", + "testcase": [], + "specID": 7, + "specName": "PSCI", + "severityID": 2, + "Severity": "Major", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + }, + { + "TestSuiteID": 1, + "TSName": "genericTest", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 6, + "Function": "other" + } + ] + } + }, + "catID: 13": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 2, + "TSName": "BootServicesTest", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 14": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 3, + "TSName": "RuntimeServicesTest", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 4, + "Function": "runtime" + } + ] + } + }, + "catID: 15": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 4, + "TSName": "LoadImage", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 16": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 5, + "TSName": "DevicePath", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 17": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 6, + "TSName": "HII", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 18": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 7, + "TSName": "Network", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 19": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 8, + "TSName": "Security", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 2, + "Severity": "Major", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 3, + "Function": "security" + } + ] + } + }, + "catID: 20": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 9, + "TSName": "Capsule", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 21": { + "SuiteID: 3": { + "SName: SCT": [ + { + "TestSuiteID": 10, + "TSName": "SMBIOS", + "testcase": [], + "specID": 5, + "specName": "UEFI", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 22": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 1, + "TSName": "Network", + "testcase": [], + "specID": 8, + "specName": "SRS", + "severityID": 2, + "Severity": "Major", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 4, + "Function": "runtime" + } + ] + } + }, + "catID: 23": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 2, + "TSName": "Peripherals", + "testcase": [], + "specID": 8, + "specName": "SRS", + "severityID": 2, + "Severity": "Major", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 4, + "Function": "runtime" + } + ] + } + }, + "catID: 24": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 3, + "TSName": "security", + "testcase": [], + "specID": 3, + "specName": "BBSR", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 3, + "Function": "security" + } + ] + } + }, + "catID: 25": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 4, + "TSName": "A/B support", + "testcase": [], + "specID": 8, + "specName": "SRS", + "severityID": 3, + "Severity": "Minor", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 2, + "scope": "extension", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 26": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 5, + "TSName": "LinuxInstall", + "testcase": [], + "specID": 8, + "specName": "SRS", + "severityID": 1, + "Severity": "Critical", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 6, + "Function": "other" + } + ] + } + }, + "catID: 27": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 6, + "TSName": "CapsuleAutherntication", + "testcase": [], + "specID": 8, + "specName": "SRS", + "severityID": 2, + "Severity": "Major", + "waivableID": 2, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 2, + "Function": "maintenance" + } + ] + } + }, + "catID: 28": { + "SuiteID: 4": { + "SName: MVP": [ + { + "TestSuiteID": 7, + "TSName": "DTValidation", + "testcase": [], + "specID": 8, + "specName": "SRS", + "severityID": 1, + "Severity": "Critical", + "waivableID": 1, + "Waivable": "no", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 29": { + "SuiteID: 5": { + "SName: MVP": [ + { + "TestSuiteID": 8, + "TSName": "Boot sources", + "testcase": [], + "specID": 3, + "specName": "DT", + "severityID": 2, + "Severity": "Major", + "waivableID": 1, + "Waivable": "yes", + "scopeID": 1, + "scope": "core", + "FunctionID": 1, + "Function": "boot" + } + ] + } + }, + "catID: 30": { + "SuiteID: 5": { + "SName: BBSR-SCT": [ + { + "TestSuiteID": 4, + "TSName": "RuntimeServicesTest", + "testcase": [], + "specID": 3, + "specName": "BBSR", + "severityID": 2, + "Severity": "Major", + "waivableID": 1, + "Waivable": "no", + "scopeID": 2, + "scope": "extension", + "FunctionID": 3, + "Function": "security" + } + ] + } + }, + "catID: 31": { + "SuiteID: 6": { + "SName: BBSR-FWTS": [ + { + "TestSuiteID": 4, + "TSName": "RuntimeServicesTest", + "testcase": [], + "specID": 3, + "specName": "BBSR", + "severityID": 2, + "Severity": "Major", + "waivableID": 1, + "Waivable": "YES", + "scopeID": 2, + "scope": "extension", + "FunctionID": 3, + "Function": "security" + } + ] + } + } +} From 7ff78955ea07013733200df7945565fc5ccbd35f Mon Sep 17 00:00:00 2001 From: chetan-rathore Date: Thu, 21 Nov 2024 09:22:20 +0530 Subject: [PATCH 2/9] capsule-update changes in parser --- .../log_parser/capsule_update/json_to_html.py | 341 ++++++++++++++++++ .../log_parser/capsule_update/logs_to_json.py | 78 ++++ common/log_parser/generate_acs_summary.py | 42 ++- common/log_parser/main_log_parser.sh | 55 ++- .../log_parser/manual_tests/json_to_html.py | 203 ++++++----- common/log_parser/merge_jsons.py | 2 + 6 files changed, 609 insertions(+), 112 deletions(-) create mode 100644 common/log_parser/capsule_update/json_to_html.py create mode 100644 common/log_parser/capsule_update/logs_to_json.py diff --git a/common/log_parser/capsule_update/json_to_html.py b/common/log_parser/capsule_update/json_to_html.py new file mode 100644 index 00000000..460e2121 --- /dev/null +++ b/common/log_parser/capsule_update/json_to_html.py @@ -0,0 +1,341 @@ +#!/usr/bin/env python3 +# Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved. +# SPDX-License-Identifier : Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import json +import matplotlib.pyplot as plt +import base64 +from io import BytesIO +from jinja2 import Template +import os + +# Helper function to retrieve dictionary values in a case-insensitive manner +def get_case_insensitive(d, key, default=0): + for k, v in d.items(): + if k.lower() == key.lower(): + return v + return default + +# Function to generate bar chart for test results +def generate_bar_chart(suite_summary): + labels = ['Passed', 'Failed', 'Failed with Waiver', 'Aborted', 'Skipped', 'Warnings'] + sizes = [ + suite_summary.get('total_PASSED', 0), + suite_summary.get('total_FAILED', 0), + suite_summary.get('total_failed_with_waiver', 0), + suite_summary.get('total_ABORTED', 0), + suite_summary.get('total_SKIPPED', 0), + suite_summary.get('total_WARNINGS', 0) + ] + colors = ['#66bb6a', '#ef5350', '#f39c12', '#9e9e9e', '#ffc107', '#ffeb3b'] # Colors for each category + + plt.figure(figsize=(12, 7)) + bars = plt.bar(labels, sizes, color=colors, edgecolor='black') + + # Add percentage labels on top of the bars + total_tests = sum(sizes) + for bar, size in zip(bars, sizes): + yval = bar.get_height() + percentage = (size / total_tests) * 100 if total_tests > 0 else 0 + plt.text( + bar.get_x() + bar.get_width()/2, + yval + max(sizes)*0.01, + f'{percentage:.2f}%', + ha='center', + va='bottom', + fontsize=12 + ) + + plt.title('Test Results Distribution', fontsize=18, fontweight='bold') + plt.ylabel('Total Count', fontsize=14) + plt.xticks(fontsize=12) + plt.yticks(fontsize=12) + plt.tight_layout() + + # Save the figure to a buffer + buffer = BytesIO() + plt.savefig(buffer, format='png') + plt.close() + buffer.seek(0) + return base64.b64encode(buffer.getvalue()).decode('utf-8') + +# Function to generate HTML content for both summary and detailed pages +def generate_html(suite_summary, test_results, chart_data, output_html_path, test_suite_name, is_summary_page=True): + # Template for both summary and detailed pages + template = Template(""" + + + + {{ test_suite_name }} Test Summary + + + +

{{ test_suite_name }} Test Summary

+ + {% if not is_summary_page %} +
+ Test Results Distribution +
+ {% endif %} + +
+

Result Summary

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
StatusTotal
Total Tests{{ total_tests }}
Passed{{ total_PASSED }}
Failed{{ total_FAILED }}
Failed with Waiver{{ total_failed_with_waiver }}
Aborted{{ total_ABORTED }}
Skipped{{ total_SKIPPED }}
Warnings{{ total_WARNINGS }}
+
+ + {% if not is_summary_page %} +
+ + + + + + + + + + + {% for test in test_results %} + + + + + + + {% endfor %} + +
Test NumberTest DescriptionTest Info Test Result
{{ test.auto_Test_Number }}{{ test.Test_Description }}{{ test.Test_Info }} + {{ test.Test_Result }} +
+
+ {% endif %} + + + """) + + # Calculate total_failed_with_waiver + total_failed_with_waiver = sum(1 for test in test_results if test.get('Test_Result') == 'FAILED (WITH WAIVER)') + + # Compute overall suite_summary from test_results + suite_summary = { + 'total_PASSED': sum(1 for test in test_results if test.get('Test_Result') == 'PASSED'), + 'total_FAILED': sum(1 for test in test_results if test.get('Test_Result') == 'FAILED'), + 'total_failed_with_waiver': total_failed_with_waiver, + 'total_ABORTED': sum(1 for test in test_results if test.get('Test_Result') == 'ABORTED'), + 'total_SKIPPED': sum(1 for test in test_results if test.get('Test_Result') == 'SKIPPED'), + 'total_WARNINGS': sum(1 for test in test_results if test.get('Test_Result') == 'WARNING') + } + + # Calculate total tests + total_tests = len(test_results) + + # Render the HTML content + html_content = template.render( + chart_data=chart_data, + total_tests=total_tests, + total_PASSED=suite_summary.get("total_PASSED", 0), + total_FAILED=suite_summary.get("total_FAILED", 0), + total_failed_with_waiver=suite_summary.get("total_failed_with_waiver", 0), + total_ABORTED=suite_summary.get("total_ABORTED", 0), + total_SKIPPED=suite_summary.get("total_SKIPPED", 0), + total_WARNINGS=suite_summary.get("total_WARNINGS", 0), + test_results=test_results, + is_summary_page=is_summary_page, + test_suite_name=test_suite_name.upper() # Ensure uppercase for consistency + ) + + # Save to HTML file + with open(output_html_path, "w") as file: + file.write(html_content) + +# Main function to process the JSON file and generate the HTML report +def main(input_json_file, detailed_html_file, summary_html_file): + # Load JSON data + with open(input_json_file, 'r') as json_file: + data = json.load(json_file) + + # Extract the test results + test_results = data.get('Tests', []) + + # Automatically assign test numbers if not present + for idx, test in enumerate(test_results, start=1): + test['auto_Test_Number'] = idx # Assign test numbers starting from 1 + + # Get the test suite name from the input JSON file name + test_suite_name = os.path.splitext(os.path.basename(input_json_file))[0].upper() + + # Generate bar chart as base64 encoded image + # Compute suite_summary + suite_summary = { + 'total_PASSED': sum(1 for test in test_results if test.get('Test_Result') == 'PASSED'), + 'total_FAILED': sum(1 for test in test_results if test.get('Test_Result') == 'FAILED'), + 'total_failed_with_waiver': sum(1 for test in test_results if test.get('Test_Result') == 'FAILED (WITH WAIVER)'), + 'total_ABORTED': sum(1 for test in test_results if test.get('Test_Result') == 'ABORTED'), + 'total_SKIPPED': sum(1 for test in test_results if test.get('Test_Result') == 'SKIPPED'), + 'total_WARNINGS': sum(1 for test in test_results if test.get('Test_Result') == 'WARNING') + } + + # Generate bar chart + chart_data = generate_bar_chart(suite_summary) + + # Generate the detailed summary page + generate_html(suite_summary, test_results, chart_data, detailed_html_file, test_suite_name, is_summary_page=False) + + # Generate the summary page with the bar chart + generate_html(suite_summary, test_results, chart_data, summary_html_file, test_suite_name, is_summary_page=True) + +if __name__ == "__main__": + import sys + if len(sys.argv) != 4: + print("Usage: python json_to_html.py ") + sys.exit(1) + + input_json_file = sys.argv[1] + detailed_html_file = sys.argv[2] # This will be the detailed HTML report + summary_html_file = sys.argv[3] # This will be the summary HTML report + + main(input_json_file, detailed_html_file, summary_html_file) diff --git a/common/log_parser/capsule_update/logs_to_json.py b/common/log_parser/capsule_update/logs_to_json.py new file mode 100644 index 00000000..17fd504d --- /dev/null +++ b/common/log_parser/capsule_update/logs_to_json.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 +# Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved. +# SPDX-License-Identifier : Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse +import json +import re + +def main(input_file, output_file): + tests = [] + test = {} + with open(input_file, 'r') as file: + lines = file.readlines() + i = 0 + while i < len(lines): + line = lines[i].strip() + if line.startswith('TESTING:'): + # Start a new test + test_description = line[len('TESTING:'):].strip() + test_info = '' + test_result = '' + i += 1 + # Read next lines for INFO and RESULTS + while i < len(lines): + line = lines[i].strip() + if line.startswith('INFO :'): + test_info = line[len('INFO :'):].strip() + elif line.startswith('RESULTS :'): + test_result = line[len('RESULTS :'):].strip() + # Finished reading this test + break + i += 1 + # Add test to the list + test = { + 'Test_Description': test_description, + 'Test_Info': test_info, + 'Test_Result': test_result.upper() + } + tests.append(test) + i += 1 + + # Calculate summary + summary = { + 'total_PASSED': sum(1 for t in tests if t['Test_Result'] == 'PASSED'), + 'total_FAILED': sum(1 for t in tests if t['Test_Result'] == 'FAILED'), + 'total_SKIPPED': sum(1 for t in tests if t['Test_Result'] == 'SKIPPED'), + } + + # Prepare final JSON structure + output_data = { + 'Test_Suite': 'Capsule Update Tests', + 'Tests': tests, + 'Summary': summary + } + + # Write to JSON file + with open(output_file, 'w') as json_file: + json.dump(output_data, json_file, indent=2) + +if __name__ == "__main__": + parser = argparse.ArgumentParser(description="Parse capsule update logs and save results to a JSON file.") + parser.add_argument("input_file", help="Input capsule update log file") + parser.add_argument("output_file", help="Output JSON file") + + args = parser.parse_args() + main(args.input_file, args.output_file) diff --git a/common/log_parser/generate_acs_summary.py b/common/log_parser/generate_acs_summary.py index 9cd22786..ebc4d3c7 100755 --- a/common/log_parser/generate_acs_summary.py +++ b/common/log_parser/generate_acs_summary.py @@ -189,7 +189,7 @@ def get_failed_with_waiver_counts(content): def determine_overall_compliance(bsa_summary_content, sbsa_summary_content, fwts_summary_content, sct_summary_content, mvp_summary_content, bbsr_fwts_summary_content, bbsr_sct_summary_content, - manual_tests_summary_content): + manual_tests_summary_content, capsule_update_summary_content): # Initialize compliance status overall_compliance = 'Compliant' @@ -202,7 +202,8 @@ def determine_overall_compliance(bsa_summary_content, sbsa_summary_content, fwts 'MVP': mvp_summary_content, 'BBSR-FWTS': bbsr_fwts_summary_content, 'BBSR-SCT': bbsr_sct_summary_content, - 'Manual Tests': manual_tests_summary_content # Added Manual Tests + 'Manual Tests': manual_tests_summary_content, + 'Capsule Update': capsule_update_summary_content # Added Capsule Update } # Flags to track compliance with waivers and overall compliance @@ -244,7 +245,7 @@ def determine_overall_compliance(bsa_summary_content, sbsa_summary_content, fwts return overall_compliance def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summary_path, fwts_summary_path, sct_summary_path, - mvp_summary_path, bbsr_fwts_summary_path, bbsr_sct_summary_path, manual_tests_summary_path, output_html_path): + mvp_summary_path, bbsr_fwts_summary_path, bbsr_sct_summary_path, manual_tests_summary_path, capsule_update_summary_path, output_html_path): # Read summary contents bsa_summary_content = read_html_content(bsa_summary_path) sbsa_summary_content = read_html_content(sbsa_summary_path) @@ -253,12 +254,14 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa mvp_summary_content = read_html_content(mvp_summary_path) bbsr_fwts_summary_content = read_html_content(bbsr_fwts_summary_path) bbsr_sct_summary_content = read_html_content(bbsr_sct_summary_path) - manual_tests_summary_content = read_html_content(manual_tests_summary_path) # Added this line + manual_tests_summary_content = read_html_content(manual_tests_summary_path) + capsule_update_summary_content = read_html_content(capsule_update_summary_path) # Added this line - # Adjust headings for BBSR-FWTS, BBSR-SCT, and Manual Tests summaries + # Adjust headings for BBSR-FWTS, BBSR-SCT, Manual Tests, and Capsule Update summaries bbsr_fwts_summary_content = adjust_bbsr_headings(bbsr_fwts_summary_content, 'BBSR-FWTS') bbsr_sct_summary_content = adjust_bbsr_headings(bbsr_sct_summary_content, 'BBSR-SCT') manual_tests_summary_content = adjust_bbsr_headings(manual_tests_summary_content, 'OS Tests') # Changed to 'OS Tests' + capsule_update_summary_content = adjust_bbsr_headings(capsule_update_summary_content, 'Capsule Update') # Added this line html_template = ''' @@ -475,6 +478,9 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa {% if manual_tests_summary_content %} OS Tests Summary {% endif %} + {% if capsule_update_summary_content %} + Capsule Update Summary + {% endif %}
@@ -543,6 +549,14 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa
{% endif %} + {% if capsule_update_summary_content %} +
+ {{ capsule_update_summary_content | safe }} + +
+ {% endif %} @@ -560,17 +574,19 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa mvp_summary_content=mvp_summary_content, bbsr_fwts_summary_content=bbsr_fwts_summary_content, bbsr_sct_summary_content=bbsr_sct_summary_content, - manual_tests_summary_content=manual_tests_summary_content # Added this line + manual_tests_summary_content=manual_tests_summary_content, + capsule_update_summary_content=capsule_update_summary_content # Added this line ) with open(output_html_path, 'w') as html_file: html_file.write(html_output) - # Adjust headings in detailed summary pages for BBSR-FWTS, BBSR-SCT, and OS Tests + # Adjust headings in detailed summary pages for BBSR-FWTS, BBSR-SCT, OS Tests, and Capsule Update detailed_summaries = [ (os.path.join(os.path.dirname(output_html_path), 'bbsr-fwts_detailed.html'), 'BBSR-FWTS'), (os.path.join(os.path.dirname(output_html_path), 'bbsr-sct_detailed.html'), 'BBSR-SCT'), - (os.path.join(os.path.dirname(output_html_path), 'manual_tests_detailed.html'), 'OS Tests') # Changed to 'OS Tests' + (os.path.join(os.path.dirname(output_html_path), 'manual_tests_detailed.html'), 'OS Tests'), # Changed to 'OS Tests' + (os.path.join(os.path.dirname(output_html_path), 'capsule_update_detailed.html'), 'Capsule Update') # Added this line ] for file_path, suite_name in detailed_summaries: @@ -584,6 +600,7 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa parser.add_argument("sct_summary_path", help="Path to the SCT summary HTML file") parser.add_argument("mvp_summary_path", help="Path to the MVP summary HTML file") parser.add_argument("manual_tests_summary_path", help="Path to the OS Tests summary HTML file") # Changed this line + parser.add_argument("capsule_update_summary_path", help="Path to the Capsule Update summary HTML file") # Added this line parser.add_argument("output_html_path", help="Path to the output ACS summary HTML file") parser.add_argument("--acs_config_path", default="", help="Path to the acs_config.txt file") parser.add_argument("--system_config_path", default="", help="Path to the system_config.txt file") @@ -614,7 +631,8 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa fwts_summary_content = read_html_content(args.fwts_summary_path) sct_summary_content = read_html_content(args.sct_summary_path) mvp_summary_content = read_html_content(args.mvp_summary_path) - manual_tests_summary_content = read_html_content(args.manual_tests_summary_path) # Added this line + manual_tests_summary_content = read_html_content(args.manual_tests_summary_path) + capsule_update_summary_content = read_html_content(args.capsule_update_summary_path) # Added this line # Paths to bbsr-fwts and bbsr-sct summary files (assumed to be in the same directory as output_html_path) summary_dir = os.path.dirname(args.output_html_path) @@ -634,7 +652,8 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa mvp_summary_content, bbsr_fwts_summary_content, bbsr_sct_summary_content, - manual_tests_summary_content # Added this line + manual_tests_summary_content, + capsule_update_summary_content # Added this line ) # Prepare ACS Results Summary @@ -654,6 +673,7 @@ def generate_html(system_info, acs_results_summary, bsa_summary_path, sbsa_summa args.mvp_summary_path, bbsr_fwts_summary_path if os.path.exists(bbsr_fwts_summary_path) else "", bbsr_sct_summary_path if os.path.exists(bbsr_sct_summary_path) else "", - args.manual_tests_summary_path, # Added this line + args.manual_tests_summary_path, + args.capsule_update_summary_path, # Added this line args.output_html_path ) diff --git a/common/log_parser/main_log_parser.sh b/common/log_parser/main_log_parser.sh index 95f48f5d..0846acbb 100755 --- a/common/log_parser/main_log_parser.sh +++ b/common/log_parser/main_log_parser.sh @@ -121,9 +121,10 @@ SBSA_PROCESSED=0 FWTS_PROCESSED=0 SCT_PROCESSED=0 MVP_PROCESSED=0 -BBSR_FWTS_PROCESSED=0 -BBSR_SCT_PROCESSED=0 -MANUAL_TESTS_PROCESSED=0 # Added flag for manual tests +SIE_FWTS_PROCESSED=0 +SIE_SCT_PROCESSED=0 +MANUAL_TESTS_PROCESSED=0 +CAPSULE_PROCESSED=0 # Added flag for Capsule Update # BSA UEFI and Kernel Log Parsing (Processed regardless of the flag) BSA_LOG="$LOGS_PATH/uefi/BsaResults.log" @@ -315,7 +316,7 @@ if [ $YOCTO_FLAG_PRESENT -eq 1 ]; then fi # --------------------------------------------------------- -# Manual Tests Logs Parsing (New Code Added Below) +# Manual Tests Logs Parsing # --------------------------------------------------------- # Hardcoded path for os-logs @@ -371,6 +372,28 @@ fi # End of OS Tests Processing # --------------------------------------------------------- +# Capsule Update Logs Parsing +CAPSULE_LOG="/home/ashsha06/capsule_test_results.log" +CAPSULE_JSON="$JSONS_DIR/capsule_update.json" + +if [ -f "$CAPSULE_LOG" ]; then + echo "Processing Capsule Update Logs..." + CAPSULE_PROCESSED=1 + python3 "$SCRIPTS_PATH/capsule_update/logs_to_json.py" "$CAPSULE_LOG" "$CAPSULE_JSON" + # Apply waivers if necessary + apply_waivers "Capsule Update" "$CAPSULE_JSON" + # Generate HTML reports + python3 "$SCRIPTS_PATH/capsule_update/json_to_html.py" "$CAPSULE_JSON" "$HTMLS_DIR/capsule_update_detailed.html" "$HTMLS_DIR/capsule_update_summary.html" + echo "Capsule Update Log : $CAPSULE_LOG" + echo "Capsule Update JSON : $CAPSULE_JSON" + echo "Capsule Update Detailed Summary : $HTMLS_DIR/capsule_update_detailed.html" + echo "Capsule Update Summary : $HTMLS_DIR/capsule_update_summary.html" + echo "" +else + echo "WARNING: Skipping Capsule Update log parsing as the log file is missing." + echo "" +fi + # Generate ACS Summary ACS_SUMMARY_HTML="$HTMLS_DIR/acs_summary.html" @@ -407,6 +430,13 @@ else GENERATE_ACS_SUMMARY_CMD+=" \"\"" fi +# Include Capsule Update summary only if processed +if [ $CAPSULE_PROCESSED -eq 1 ]; then + GENERATE_ACS_SUMMARY_CMD+=" \"$HTMLS_DIR/capsule_update_summary.html\"" +else + GENERATE_ACS_SUMMARY_CMD+=" \"\"" +fi + # Add the output HTML path GENERATE_ACS_SUMMARY_CMD+=" \"$ACS_SUMMARY_HTML\"" @@ -502,6 +532,16 @@ if [ $MANUAL_TESTS_PROCESSED -eq 1 ]; then echo "" fi +# Print Capsule Update messages only if processed +if [ $CAPSULE_PROCESSED -eq 1 ]; then + echo "Capsule Update Logs Processed" + echo "Capsule Update Log : $CAPSULE_LOG" + echo "Capsule Update JSON : $CAPSULE_JSON" + echo "Capsule Update Detailed Summary : $HTMLS_DIR/capsule_update_detailed.html" + echo "Capsule Update Summary : $HTMLS_DIR/capsule_update_summary.html" + echo "" +fi + echo "ACS Summary : $ACS_SUMMARY_HTML" echo "" @@ -567,6 +607,13 @@ elif [ $MANUAL_TESTS_PROCESSED -eq 1 ]; then echo "WARNING: No Manual Tests JSON files found. Skipping Manual Tests files." fi +# Include Capsule Update JSON file +if [ $CAPSULE_PROCESSED -eq 1 ] && [ -f "$CAPSULE_JSON" ]; then + JSON_FILES+=("$CAPSULE_JSON") +else + echo "WARNING: $(basename "$CAPSULE_JSON") not found. Skipping this file." +fi + # Merge all existing JSON files into one if [ ${#JSON_FILES[@]} -gt 0 ]; then python3 "$SCRIPTS_PATH/merge_jsons.py" "$MERGED_JSON" "${JSON_FILES[@]}" diff --git a/common/log_parser/manual_tests/json_to_html.py b/common/log_parser/manual_tests/json_to_html.py index 9d63de62..5271aaf5 100644 --- a/common/log_parser/manual_tests/json_to_html.py +++ b/common/log_parser/manual_tests/json_to_html.py @@ -1,5 +1,18 @@ #!/usr/bin/env python3 -# JSON to HTML Converter Script +# Copyright (c) 2024, Arm Limited or its affiliates. All rights reserved. +# SPDX-License-Identifier : Apache-2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import json import matplotlib.pyplot as plt @@ -75,9 +88,9 @@ def get_subtest_status(subtest_result): return 'INFO' # For informational entries # Function to generate HTML content for both summary and detailed pages -def generate_html(suite_summary, test_cases_list, boot_sources_list, output_html_path, is_summary_page=True, include_drop_down=False): - # Set the test suite name to 'Manual Tests' - test_suite_name = 'Manual Tests' +def generate_html(suite_summary, test_results_list, output_html_path, is_summary_page=True, include_drop_down=False): + # Set the test suite name to 'OS Tests' + test_suite_name = 'OS Tests' # Template for both summary and detailed pages template = Template(""" @@ -244,36 +257,33 @@ def generate_html(suite_summary, test_cases_list, boot_sources_list, output_html {% if not is_summary_page %} {% if include_drop_down %} {% endif %}
- {% for idx, boot_source in enumerate(boot_sources_list) %} - -
Test Suite: {{ boot_source.Test_suite_name }}
-
Description: {{ boot_source.Test_suite_description }}
+ {% for idx, test_results in enumerate(test_results_list) %} + {% for test_idx, test in enumerate(test_results) %} + +
Test Suite: {{ test.Test_suite_name }}
+
Description: {{ test.Test_suite_description }}
-
Test Case: {{ boot_source.Test_case }}
-
Description: {{ boot_source.Test_case_description }}
- {% endfor %} - - {% for idx, test_case in enumerate(test_cases_list) %} - -
Test Suite: {{ test_case.Test_suite_name }}
-
Description: {{ test_case.Test_suite_description }}
- -
Test Case: {{ test_case.Test_case }}
-
Description: {{ test_case.Test_case_description }}
+ {% if test.Test_case %} +
Test Case: {{ test.Test_case }}
+ {% endif %} + {% if test.Test_case_description %} +
Description: {{ test.Test_case_description }}
+ {% endif %} - {% if test_case.subtests %} + {% if test.subtests %} @@ -286,7 +296,7 @@ def generate_html(suite_summary, test_cases_list, boot_sources_list, output_html - {% for subtest in test_case.subtests %} + {% for subtest in test.subtests %} {% set subtest_status = get_subtest_status(subtest.sub_test_result) %} @@ -303,6 +313,7 @@ def generate_html(suite_summary, test_cases_list, boot_sources_list, output_html
{{ subtest.sub_Test_Number }}
{% endif %} {% endfor %} + {% endfor %}
{% endif %} @@ -325,11 +336,11 @@ def generate_html(suite_summary, test_cases_list, boot_sources_list, output_html total_PASSED=suite_summary.get("total_PASSED", 0), total_FAILED=suite_summary.get("total_FAILED", 0), total_SKIPPED=suite_summary.get("total_SKIPPED", 0), - test_cases_list=test_cases_list, - boot_sources_list=boot_sources_list, + test_results_list=test_results_list, is_summary_page=is_summary_page, include_drop_down=include_drop_down, chart_data=chart_data, # Will be None if is_summary_page is True + enumerate=enumerate, get_subtest_status=get_subtest_status # Pass the function to the template ) @@ -347,8 +358,7 @@ def main(): args = parser.parse_args() # Load JSON data - test_cases_list = [] - boot_sources_list = [] + test_results_list = [] # Initialize counts total_tests = 0 @@ -368,71 +378,74 @@ def main(): continue test_results = data.get("test_results", []) - # Extract os_name from boot_sources_path - if idx < len(boot_sources_paths): - boot_sources_path = boot_sources_paths[idx] - os_name = os.path.basename(os.path.dirname(boot_sources_path)) - else: - boot_sources_path = "Unknown" - os_name = "Unknown" - - # Collect Boot Sources info - boot_sources_info = { - "Test_suite_name": "Boot Sources", - "Test_suite_description": "Check for boot sources", - "Test_case": f"Boot Sources for {os_name}", - "Test_case_description": f"Please review the boot source OS logs for {os_name} - path of {boot_sources_path}", - "subtests": [] - } - boot_sources_list.append(boot_sources_info) - - # Process test cases (exclude Boot Sources) - for test in test_results: - # Assuming Boot Sources are already appended separately and not part of test_results - test_case = { - "Test_suite_name": test.get("Test_suite_name", "Unknown Suite"), - "Test_suite_description": test.get("Test_suite_description", "No Description"), - "Test_case": test.get("Test_case", "Unknown Test Case"), - "Test_case_description": test.get("Test_case_description", "No Description"), - "subtests": test.get("subtests", []) + os_name = data.get("os_name", "Unknown") # Extract os_name from JSON + if test_results: + # Append the Boot Sources test to test_results + if idx < len(boot_sources_paths): + boot_sources_path = boot_sources_paths[idx] + else: + boot_sources_path = "Unknown" + + # Correct OS name if it's "Unknown" + if os_name == "Unknown" and boot_sources_path != "Unknown": + # Try to extract OS name from the boot_sources_path + os_name = boot_sources_path.split('/')[-2] # Get the directory name before 'boot_sources.log' + + boot_sources_test = { + "Test_suite_name": "Boot Sources", + "Test_suite_description": "Check for boot sources", + "Test_case": f"Boot Sources for {os_name}", + "Test_case_description": f"Please review the boot source OS logs for {os_name} - path of {boot_sources_path}", + "subtests": [], + "is_boot_source": True # Flag to identify boot source tests } - # Determine test case status based on subtests - test_status = 'PASSED' - has_skipped = False - - if test_case['subtests']: - for subtest in test_case['subtests']: - subtest_status = get_subtest_status(subtest.get('sub_test_result', {})) - if subtest_status == 'FAILED': - test_status = 'FAILED' - break - elif subtest_status == 'SKIPPED': - has_skipped = True - elif subtest_status != 'PASSED': - # Treat any other status as failure - test_status = 'FAILED' - break + test_results.append(boot_sources_test) + + # Now, process each test in test_results to determine its status + for test in test_results: + # Skip counting Boot Sources test + if test.get('is_boot_source'): + continue + + total_tests += 1 # Increment total tests + + # Determine test status based on subtests + test_status = 'PASSED' + has_skipped = False + + if test.get('subtests'): + for subtest in test['subtests']: + subtest_status = get_subtest_status(subtest['sub_test_result']) + if subtest_status == 'FAILED': + test_status = 'FAILED' + break + elif subtest_status == 'SKIPPED': + has_skipped = True + elif subtest_status != 'PASSED': + # Treat any other status as failure + test_status = 'FAILED' + break + else: + # No failures in subtests + if has_skipped and test_status != 'FAILED': + test_status = 'SKIPPED' else: - # No failures in subtests - if has_skipped and test_status != 'FAILED': - test_status = 'SKIPPED' - else: - # No subtests; treat as SKIPPED - test_status = 'SKIPPED' - - # Update counts based on test_status - if test_status == 'PASSED': - total_passed += 1 - elif test_status == 'FAILED': - total_failed += 1 - elif test_status == 'SKIPPED': - total_skipped += 1 - else: - # Treat any other status as skipped - total_skipped += 1 + # No subtests; treat as SKIPPED + test_status = 'SKIPPED' + + # Update counts based on test_status + if test_status == 'PASSED': + total_passed += 1 + elif test_status == 'FAILED': + total_failed += 1 + elif test_status == 'SKIPPED': + total_skipped += 1 + else: + # Treat any other status as skipped + total_skipped += 1 - test_cases_list.append(test_case) + test_results_list.append(test_results) # Now, create the suite_summary dictionary suite_summary = { @@ -441,8 +454,6 @@ def main(): 'total_SKIPPED': total_skipped, } - total_tests = suite_summary['total_PASSED'] + suite_summary['total_FAILED'] + suite_summary['total_SKIPPED'] - if total_tests == 0: print("No valid JSON data found in input files.") sys.exit(1) @@ -450,8 +461,7 @@ def main(): # Generate the detailed summary page generate_html( suite_summary, - test_cases_list, - boot_sources_list, + test_results_list, args.detailed_html_file, is_summary_page=False, include_drop_down=args.include_drop_down @@ -460,8 +470,7 @@ def main(): # Generate the summary page (with bar graph) generate_html( suite_summary, - test_cases_list, - boot_sources_list, + test_results_list, args.summary_html_file, is_summary_page=True ) diff --git a/common/log_parser/merge_jsons.py b/common/log_parser/merge_jsons.py index 85e97891..3f6877e6 100755 --- a/common/log_parser/merge_jsons.py +++ b/common/log_parser/merge_jsons.py @@ -64,6 +64,8 @@ def merge_json_files(json_files, output_file): section_name = "Suite_Name: BBSR-FWTS" elif "BBSR-SCT" in file_name: section_name = "Suite_Name: BBSR-SCT" + elif "CAPSULE_UPDATE" in file_name: + section_name = "Suite_Name: CAPSULE_UPDATE" elif "DT_KSELFTEST" in file_name: section_name = "Suite_Name: DT Kselftest" elif "DT_VALIDATE" in file_name: From 4bf88e19de58e31a8f1dcf634bffd17149b48547 Mon Sep 17 00:00:00 2001 From: chetan-rathore Date: Thu, 21 Nov 2024 09:25:41 +0530 Subject: [PATCH 3/9] updated acs config for release --- common/config/acs_config.txt | 4 ++-- common/config/acs_config_dt.txt | 8 ++++---- common/config/acs_run_config.ini | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/common/config/acs_config.txt b/common/config/acs_config.txt index a2e3aec7..a8b3485d 100644 --- a/common/config/acs_config.txt +++ b/common/config/acs_config.txt @@ -2,6 +2,6 @@ ACS version: ACS v24.11_3.0.0-BET0 SRS version: SRS 3.0 BSA version: BSA v1.0C SBSA version: SBSA v7.1 -SBBR version: BBR v2.0 -BBSR version: BBSR v1.2 +SBBR version: BBR v2.1 +BBSR version: BBSR v1.3 Band: SystemReady band 3.0 diff --git a/common/config/acs_config_dt.txt b/common/config/acs_config_dt.txt index 80f12e2b..7737e891 100644 --- a/common/config/acs_config_dt.txt +++ b/common/config/acs_config_dt.txt @@ -1,8 +1,8 @@ -ACS version: ACS v24.11_3.0.0 +ACS version: ACS v24.11_3.0.0-BET0 SRS version: SRS 3.0 BSA version: BSA v1.0C -BBR version: BBR v2.0 -EBBR version: EBBR v2.1.0 -BBSR version: BBSR v1.2 +BBR version: BBR v2.1 +EBBR version: EBBR v2.2.0 +BBSR version: BBSR v1.3 Band: SystemReady Devicetree band 3.0 Device Tree Version:v0.4 diff --git a/common/config/acs_run_config.ini b/common/config/acs_run_config.ini index ad518b30..52cded7a 100755 --- a/common/config/acs_run_config.ini +++ b/common/config/acs_run_config.ini @@ -1,2 +1,2 @@ [Settings] -SbsaRunEnabled=1 +SbsaRunEnabled=0 From 244c3c5eeafe8a54ce86fd920f24580a5822a3b7 Mon Sep 17 00:00:00 2001 From: chetan-rathore Date: Thu, 21 Nov 2024 09:29:16 +0530 Subject: [PATCH 4/9] Path corrected --- common/log_parser/main_log_parser.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common/log_parser/main_log_parser.sh b/common/log_parser/main_log_parser.sh index 0846acbb..db8e46e1 100755 --- a/common/log_parser/main_log_parser.sh +++ b/common/log_parser/main_log_parser.sh @@ -373,7 +373,7 @@ fi # --------------------------------------------------------- # Capsule Update Logs Parsing -CAPSULE_LOG="/home/ashsha06/capsule_test_results.log" +CAPSULE_LOG="/mnt/acs_results/app_output/capsule_test_results.log" CAPSULE_JSON="$JSONS_DIR/capsule_update.json" if [ -f "$CAPSULE_LOG" ]; then From f58930036fa9ae84a95be516512eb6f95ae9176b Mon Sep 17 00:00:00 2001 From: cherat01 Date: Thu, 21 Nov 2024 10:20:08 +0530 Subject: [PATCH 5/9] Capsule update logic changes --- .../recipes-acs/install-files/files/init.sh | 21 ++++++++++++------- common/uefi_scripts/startup.nsh | 7 +++++-- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh index ebe95bc0..731b8398 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh @@ -211,16 +211,23 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then cur_fw_ver=$(python3 /usr/bin/extract_capsule_fw_version.py $fw_pattern /mnt/acs_results_template/fw/CapsuleApp_ESRT_table_info_after_update.log) last_attempted_status=$(python3 /usr/bin/extract_capsule_fw_version.py $fw_status_pattern /mnt/acs_results_template/fw/CapsuleApp_ESRT_table_info_after_update.log) - #echo prev_fw_ver: $prev_fw_ver - #echo cur_fw_ver: $cur_fw_ver - #echo last_attempted_status: $last_attempted_status - fw_status="0x0" - if [ "$((cur_fw_ver))" -gt "$((prev_fw_ver))" ] && [ "$((last_attempted_status))" == "$((fw_status))" ]; then - echo "Capsule update has done successfully from version $prev_fw_ver to $cur_fw_ver" + echo "TESTING: Check for signed_capsule.bin sanity" >> /mnt/acs_results/app_output/capsule_test_results.log + /usr/bin/systemready-scripts/capsule-tool.py /mnt/acs_tests/app/signed_capsule.bin >> /mnt/acs_results/app_output/capsule_test_results.log 2>&1 + + fw_status="0x0" + echo "TESTING: Check for ESRT FW version update" >> /mnt/acs_results/app_output/capsule_test_results.log + echo "INFO: prev version: $prev_fw_ver, current version: $cur_fw_ver, last attempted status: $last_attempted_status" >> /mnt/acs_results/app_output/capsule_test_results.log + if [ "$((cur_fw_ver))" -gt "$((prev_fw_ver))" ] && [ "$((last_attempted_status))" == "$((fw_status))" ]; then + echo "RESULTS: PASSED" >> /mnt/acs_results/app_output/capsule_test_results.log + echo "Capsule update has passed" + else + echo "RESULTS: FAILED" >> /mnt/acs_results/app_output/capsule_test_results.log + echo "Capsule update has failed" fi rm /mnt/acs_tests/app/capsule_update_done.flag elif [ -f /mnt/acs_tests/app/capsule_update_unsupport.flag ]; then - echo "Capsule update has failed ..." + echo "Capsule update has failed" + echo "Capsule update has failed ..." >> /mnt/acs_results/app_output/capsule_test_results.log rm /mnt/acs_tests/app/capsule_update_unsupport.flag else echo "Capsule update has ignored..." diff --git a/common/uefi_scripts/startup.nsh b/common/uefi_scripts/startup.nsh index 4a7a174c..f52fda03 100644 --- a/common/uefi_scripts/startup.nsh +++ b/common/uefi_scripts/startup.nsh @@ -157,9 +157,12 @@ for %r in 0 1 2 3 4 5 6 7 8 9 A B C D E F then rm FS%r:\acs_tests\app\capsule_update_check.flag echo "" > FS%r:\acs_tests\app\capsule_update_done.flag echo "UEFI capsule update is in progress, system will reboot after update ..." - FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\unauth.bin > FS%r:\acs_results_template\fw\capsule-update.log + echo "Testing unauth.bin update" > FS%r:\acs_results_template\fw\capsule-update.log + FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\unauth.bin >> FS%r:\acs_results_template\fw\capsule-update.log + echo "Testing tampered.bin update" >> FS%r:\acs_results_template\fw\capsule-update.log FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\tampered.bin >> FS%r:\acs_results_template\fw\capsule-update.log - FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\signed_capsule.bin -OD > FS%r:\acs_results_template\fw\capsule-on-disk.log + echo "Testing signed_capsule.bin OD update" > FS%r:\acs_results_template\fw\capsule-on-disk.log + FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\signed_capsule.bin -OD >> FS%r:\acs_results_template\fw\capsule-on-disk.log echo "UEFI capsule update has failed..." >> FS%r:\acs_results_template\fw\capsule-on-disk.log rm FS%r:\acs_tests\app\capsule_update_check.flag rm FS%r:\acs_tests\app\capsule_update_done.flag From addeb5ef8c2851a97a06490656c4d696caecef08 Mon Sep 17 00:00:00 2001 From: cherat01 Date: Thu, 21 Nov 2024 15:09:41 +0530 Subject: [PATCH 6/9] fixes around parser and sh files --- .../Yocto/build-scripts/get_source.sh | 2 ++ .../recipes-acs/install-files/files/init.sh | 8 +++++--- .../install-files/systemd-init-install.bb | 2 ++ .../recipes-kernel/linux/files/systemready.cfg | 1 - common/log_parser/main_log_parser.sh | 8 ++++---- common/uefi_scripts/startup.nsh | 18 ++++++++++++++++-- 6 files changed, 29 insertions(+), 10 deletions(-) diff --git a/SystemReady-devicetree-band/Yocto/build-scripts/get_source.sh b/SystemReady-devicetree-band/Yocto/build-scripts/get_source.sh index 5afb3ea6..31893753 100755 --- a/SystemReady-devicetree-band/Yocto/build-scripts/get_source.sh +++ b/SystemReady-devicetree-band/Yocto/build-scripts/get_source.sh @@ -136,6 +136,8 @@ copy_recipes() sed -i 's/connect -r//g' startup.nsh cp $TOP_DIR/../../common/linux_scripts/secure_init.sh $TOP_DIR/meta-woden/recipes-acs/install-files/files cp $TOP_DIR/../../common/linux_scripts/verify_tpm_measurements.py $TOP_DIR/meta-woden/recipes-acs/install-files/files + cp $TOP_DIR/../../common/linux_scripts/extract_capsule_fw_version.py $TOP_DIR/meta-woden/recipes-acs/install-files/files + cp -r $TOP_DIR/../../common/log_parser $TOP_DIR/meta-woden/recipes-acs/install-files/files/ popd # copy any patches to linux src files directory diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh index 731b8398..eefb437e 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh @@ -211,11 +211,11 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then cur_fw_ver=$(python3 /usr/bin/extract_capsule_fw_version.py $fw_pattern /mnt/acs_results_template/fw/CapsuleApp_ESRT_table_info_after_update.log) last_attempted_status=$(python3 /usr/bin/extract_capsule_fw_version.py $fw_status_pattern /mnt/acs_results_template/fw/CapsuleApp_ESRT_table_info_after_update.log) - echo "TESTING: Check for signed_capsule.bin sanity" >> /mnt/acs_results/app_output/capsule_test_results.log + echo "Testing signed_capsule.bin sanity" > /mnt/acs_results/app_output/capsule_test_results.log /usr/bin/systemready-scripts/capsule-tool.py /mnt/acs_tests/app/signed_capsule.bin >> /mnt/acs_results/app_output/capsule_test_results.log 2>&1 fw_status="0x0" - echo "TESTING: Check for ESRT FW version update" >> /mnt/acs_results/app_output/capsule_test_results.log + echo "Testing ESRT FW version update" >> /mnt/acs_results/app_output/capsule_test_results.log echo "INFO: prev version: $prev_fw_ver, current version: $cur_fw_ver, last attempted status: $last_attempted_status" >> /mnt/acs_results/app_output/capsule_test_results.log if [ "$((cur_fw_ver))" -gt "$((prev_fw_ver))" ] && [ "$((last_attempted_status))" == "$((fw_status))" ]; then echo "RESULTS: PASSED" >> /mnt/acs_results/app_output/capsule_test_results.log @@ -262,7 +262,9 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then sync /mnt sleep 5 mkdir /usr/cache_dir - /usr/bin/systemready-scripts/check-sr-results.py --cache-dir=/usr/cache_dir/ + mkdir -p /mnt/acs_results/post-script + /usr/bin/systemready-scripts/check-sr-results.py --cache-dir=/usr/cache_dir/ > /mnt/acs_results/post-script/post-script.log 2&>1 + cd - fi sync /mnt sleep 5 diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/systemd-init-install.bb b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/systemd-init-install.bb index 41a9928d..27b34ac8 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/systemd-init-install.bb +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/systemd-init-install.bb @@ -8,6 +8,7 @@ SRC_URI:append = " file://acs_run-before-login-prompt.service \ file://init.sh \ file://secure_init.sh \ file://verify_tpm_measurements.py \ + file://extract_capsule_fw_version.py \ file://ethtool-test.py \ file://read_write_check_blk_devices.py \ file://device_driver_info.sh \ @@ -27,6 +28,7 @@ do_install:append() { install -m 0770 ${WORKDIR}/../../ebbr-sct/1.0/bbr-acs/bbsr/config/bbsr_fwts_tests.ini ${D}${bindir} install -m 0644 ${WORKDIR}/acs_run-before-login-prompt.service ${D}${systemd_unitdir}/system install -m 0770 ${WORKDIR}/verify_tpm_measurements.py ${D}${bindir} + install -m 0770 ${WORKDIR}/extract_capsule_fw_version.py ${D}${bindir} install -m 0770 ${WORKDIR}/ethtool-test.py ${D}${bindir} install -m 0770 ${WORKDIR}/read_write_check_blk_devices.py ${D}${bindir} install -m 0770 ${WORKDIR}/device_driver_info.sh ${D}${bindir} diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-kernel/linux/files/systemready.cfg b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-kernel/linux/files/systemready.cfg index 96230fef..1ba6db4f 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-kernel/linux/files/systemready.cfg +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-kernel/linux/files/systemready.cfg @@ -492,7 +492,6 @@ CONFIG_NUMA_BALANCING=y CONFIG_MEMCG=y CONFIG_BLK_CGROUP=y CONFIG_CGROUP_PIDS=y -CONFIG_CGROUP_FREEZER=y CONFIG_CGROUP_HUGETLB=y CONFIG_CPUSETS=y CONFIG_CGROUP_DEVICE=y diff --git a/common/log_parser/main_log_parser.sh b/common/log_parser/main_log_parser.sh index db8e46e1..2932dba5 100755 --- a/common/log_parser/main_log_parser.sh +++ b/common/log_parser/main_log_parser.sh @@ -67,8 +67,8 @@ fi WAIVERS_APPLIED=0 # Check if waiver.json and test_category.json are provided -if [ -n "$WAIVER_JSON" ] then - if [ -f "$WAIVER_JSON" ] then +if [ -n "$WAIVER_JSON" ]; then + if [ -f "$WAIVER_JSON" ]; then WAIVERS_APPLIED=1 echo "Waivers will be applied using:" echo " Waiver File : $WAIVER_JSON" @@ -121,8 +121,8 @@ SBSA_PROCESSED=0 FWTS_PROCESSED=0 SCT_PROCESSED=0 MVP_PROCESSED=0 -SIE_FWTS_PROCESSED=0 -SIE_SCT_PROCESSED=0 +BBSR_FWTS_PROCESSED=0 +BBSR_SCT_PROCESSED=0 MANUAL_TESTS_PROCESSED=0 CAPSULE_PROCESSED=0 # Added flag for Capsule Update diff --git a/common/uefi_scripts/startup.nsh b/common/uefi_scripts/startup.nsh index f52fda03..cd30f079 100644 --- a/common/uefi_scripts/startup.nsh +++ b/common/uefi_scripts/startup.nsh @@ -158,10 +158,21 @@ for %r in 0 1 2 3 4 5 6 7 8 9 A B C D E F then echo "" > FS%r:\acs_tests\app\capsule_update_done.flag echo "UEFI capsule update is in progress, system will reboot after update ..." echo "Testing unauth.bin update" > FS%r:\acs_results_template\fw\capsule-update.log - FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\unauth.bin >> FS%r:\acs_results_template\fw\capsule-update.log + echo "Test_Info" >> FS%r:\acs_results_template\fw\capsule-update.log + if exist FS%r:\acs_tests\app\unauth.bin then + FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\unauth.bin >> FS%r:\acs_results_template\fw\capsule-update.log + else + echo "unauth.bin not present" + endif echo "Testing tampered.bin update" >> FS%r:\acs_results_template\fw\capsule-update.log - FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\tampered.bin >> FS%r:\acs_results_template\fw\capsule-update.log + echo "Test_Info" >> FS%r:\acs_results_template\fw\capsule-update.log + if exist FS%r:\acs_tests\app\tampered.bin then + FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\tampered.bin >> FS%r:\acs_results_template\fw\capsule-update.log + else + echo "tampered.bin not present" + endif echo "Testing signed_capsule.bin OD update" > FS%r:\acs_results_template\fw\capsule-on-disk.log + echo "Test_Info" >> FS%r:\acs_results_template\fw\capsule-on-disk.log FS%r:\acs_tests\app\CapsuleApp.efi FS%r:\acs_tests\app\signed_capsule.bin -OD >> FS%r:\acs_results_template\fw\capsule-on-disk.log echo "UEFI capsule update has failed..." >> FS%r:\acs_results_template\fw\capsule-on-disk.log rm FS%r:\acs_tests\app\capsule_update_check.flag @@ -173,6 +184,9 @@ for %r in 0 1 2 3 4 5 6 7 8 9 A B C D E F then else rm FS%r:\acs_tests\app\capsule_update_check.flag echo "" > FS%r:\acs_tests\app\capsule_update_unsupport.flag + echo "Testing signed_capsule.bin OD update" > FS%r:\acs_results_template\fw\capsule-on-disk.log + echo "Test_Info" >> FS%r:\acs_results_template\fw\capsule-on-disk.log + echo "signed_capsule.bin not present" > FS%r:\acs_results_template\fw\capsule-on-disk.log echo "signed_capsule.bin file is not present, please copy the same file into acs_tests/app partition" endif goto BootLinux From e999b71792860130643bc3ab15223a2fdf15c478 Mon Sep 17 00:00:00 2001 From: cherat01 Date: Thu, 21 Nov 2024 15:31:53 +0530 Subject: [PATCH 7/9] init.sh change --- .../Yocto/meta-woden/recipes-acs/install-files/files/init.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh index eefb437e..27f7bc4f 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/install-files/files/init.sh @@ -211,8 +211,6 @@ if [ $ADDITIONAL_CMD_OPTION != "noacs" ]; then cur_fw_ver=$(python3 /usr/bin/extract_capsule_fw_version.py $fw_pattern /mnt/acs_results_template/fw/CapsuleApp_ESRT_table_info_after_update.log) last_attempted_status=$(python3 /usr/bin/extract_capsule_fw_version.py $fw_status_pattern /mnt/acs_results_template/fw/CapsuleApp_ESRT_table_info_after_update.log) - echo "Testing signed_capsule.bin sanity" > /mnt/acs_results/app_output/capsule_test_results.log - /usr/bin/systemready-scripts/capsule-tool.py /mnt/acs_tests/app/signed_capsule.bin >> /mnt/acs_results/app_output/capsule_test_results.log 2>&1 fw_status="0x0" echo "Testing ESRT FW version update" >> /mnt/acs_results/app_output/capsule_test_results.log From e04b5c8336d35461a5bc6af5c5071152783b3aab Mon Sep 17 00:00:00 2001 From: chetan singh rathore Date: Thu, 21 Nov 2024 17:07:12 +0530 Subject: [PATCH 8/9] Update ebbr-sct.bb : Use main branch of bbr-acs --- .../Yocto/meta-woden/recipes-acs/ebbr-sct/ebbr-sct.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/ebbr-sct/ebbr-sct.bb b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/ebbr-sct/ebbr-sct.bb index b70828bb..1266c159 100644 --- a/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/ebbr-sct/ebbr-sct.bb +++ b/SystemReady-devicetree-band/Yocto/meta-woden/recipes-acs/ebbr-sct/ebbr-sct.bb @@ -15,7 +15,7 @@ LICENSE = "Apache-2.0" LIC_FILES_CHKSUM = "file://bbr-acs/LICENSE.md;md5=2a944942e1496af1886903d274dedb13" # TODO -SRC_URI += "git://github.com/chetan-rathore/bbr-acs-1;destsuffix=bbr-acs;protocol=https;branch=main;name=bbr-acs \ +SRC_URI += "git://github.com/ARM-software/bbr-acs;destsuffix=bbr-acs;protocol=https;branch=main;name=bbr-acs \ git://github.com/tianocore/edk2-test;destsuffix=edk2-test;protocol=https;nobranch=1;name=edk2-test \ gitsm://github.com/tianocore/edk2.git;destsuffix=edk2-test/edk2;protocol=https;nobranch=1;name=edk2 \ file://sctversion.patch;patch=1;patchdir=edk2-test \ From d9a0d07538352b1178b0f85277e506ed67aebb66 Mon Sep 17 00:00:00 2001 From: chetan singh rathore Date: Thu, 21 Nov 2024 17:08:55 +0530 Subject: [PATCH 9/9] Update get_source.sh : Use main branch of bbr acs --- SystemReady-band/build-scripts/get_source.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/SystemReady-band/build-scripts/get_source.sh b/SystemReady-band/build-scripts/get_source.sh index e4ea96e5..e31a0837 100755 --- a/SystemReady-band/build-scripts/get_source.sh +++ b/SystemReady-band/build-scripts/get_source.sh @@ -157,8 +157,7 @@ get_linux-acs_src() get_bbr_acs_src() { echo "Downloading Arm BBR source code." - #TODO change branch to main - git clone https://github.com/chetan-rathore/bbr-acs-1.git bbr-acs + git clone https://github.com/ARM-software/bbr-acs.git bbr-acs if [ -n "$ARM_BBR_TAG" ]; then # TAG provided. echo "Checking out Arm BBR TAG: $ARM_BBR_TAG"