Untitled

Anonymous
Plain Text
09/05/2025 8:47 PM
3.5 KB
12
Indexable
Never
*** Settings ***
Resource         ../Suite.resource
Library          DateTime
Library          Collections
Test Tags        General    BMS    BMS    BMSPOW    FLM    TFM    CCM    CON    PCM    HU    LHCM    RHCM
Suite Setup      Flashing Setup
Test Template    Flash Firmware and Check


*** Variables ***
# Variables can be set from the command line, uses syntax `--variable EXAMPLE_NAME:example_value`
${BUILD_DATE: str}    Today
${RETRYS: int}        10
${BUILD_DIR}          ${None}


*** Keywords ***
Toggle BMSPOW
    [Documentation]    Toggle BMSPOW power off/on from bms
    Keyword Should Exist    BMS SetUSB12V    Attempting to toggle BMSPOW but no BMS connected!
    BMS SetUSB12V    0
    Sleep            1
    BMS SetUSB12V    1
    Sleep            1


Flashing Setup
    [Documentation]    Pre-flashing steps. Downloads all necessary builds
    # Early return if the user set the build dir
    Return From Keyword If    "${BUILD_DIR}" != "${None}"    ${BUILD_DIR} 
    Parse Modules 
    
    # Populate build date if not set
    IF     not $BUILD_DATE or $BUILD_DATE.lower() == "today"
        ${BUILD_DATE} =    Get Current Date    result_format=%Y-%m-%d
    END

    Log    Downloading builds for @{MODULES} with build date ${BUILD_DATE}
    # If there's a CON attached, download a CON build
    ${build_dir} =    Run Keyword If    "CON" in ${MODULES}    Download Nightly Build Con
    # Determine what other modules are attached
    @{OTHER_MODULES} =    Copy List    @{VALID_MODULES}
    ${index} =    Get Index From List    ${OTHER_MODULES}    CON
    Remove From List    ${OTHER_MODULES}    ${index}
    ${has_overlap}=    Evaluate    any(x in ${OTHER_MODULES} for x in ${MODULES})
    IF    ${has_overlap}
        # Only download once if we have any other modules (besides CON) in our available modules
        ${build_dir} =    Download Nightly Build AWS    build_date=${BUILD_DATE}
    END
    Set Suite Variable    $BUILD_DIR    ${build_dir}


Flash Firmware and Check
    [Documentation]    Flash firmware to MCU and verify successful operation by checking upgraded version
    [Arguments]    ${module}    ${uds}=${False}    ${suit}=${False}
    [Tags]    qase.params:[$module]
    Wake Module    module=${module}

    IF    $module.lower() == "bmspow"
        Toggle BMSPOW
    END

    Skip If    "${module}" == "HU" and ${uds}    HU Currently not passing fwUpdate on UDS: EF-1462
    Flash    module=${module}    build_dir=${build_dir}    uds=${uds}    suit=${suit}

    IF    $module.lower() == "bmspow"
        Toggle BMSPOW
    END

    FOR    ${i}    IN RANGE    ${RETRYS}
        TRY
            ${version} =    Fw Version    module=${module}
        EXCEPT    TimeoutError:*    type=glob
            IF    ${i} < ${${RETRYS}-1}
                Log    message=FW Version timed out, trying again    level=WARN
                Sleep    5
                Continue For Loop
            ELSE
                Fail    msg=Failed to get FW Version after ${${RETRYS}} attempts
            END
        END
        BREAK
    END        
    ${expected_version} =     Extract Version Info    build_dir=${build_dir}
    Should Contain    container=${version}[0]    item=${expected_version}    ignore_case=${True}


*** Test Cases ***    module    uds    suit
Flash Module on Default
    [Tags]    Q-102
    FOR    ${module}    IN    @{MODULES}
        ${module}    ${False}    ${False}
    END

Flash Module on Alternative
    [Tags]    Q-161
    FOR     ${module}    IN    @{MODULES}
        ${module}    ${True}    ${True}
    END
    
Editor is loading...
Leave a Comment