1*** Settings ***
2Documentation    Stress the system using HTX exerciser.
3
4Resource         ../syslib/utils_os.robot
5
6Suite Setup      Run Keyword  Start SOL Console Logging
7Test Setup       Pre Test Case Execution
8Test Teardown    Test Teardown Execution
9Suite Teardown   Suite Teardown Execution
10
11*** Variables ****
12
13${stack_mode}        skip
14
15*** Test Cases ***
16
17GPU Stress Test
18    [Documentation]  Stress the GPU using HTX exerciser.
19    [Tags]  GPU_Stress_Test
20
21    Rprintn
22    Rpvars  HTX_DURATION  HTX_INTERVAL
23
24    Repeat Keyword  ${HTX_LOOP} times  Execute GPU Test
25
26
27*** Keywords ***
28
29Execute GPU Test
30    [Documentation]  Start HTX exerciser.
31    # Test Flow:
32    #              - Power on
33    #              - Establish SSH connection session
34    #              - Collect GPU nvidia status output
35    #              - Create HTX mdt profile
36    #              - Run GPU specific HTX exerciser
37    #              - Check HTX status for errors
38
39    # Collect data before the test starts.
40    Collect NVIDIA Log File  start
41
42    Run Keyword If  '${HTX_MDT_PROFILE}' == 'mdt.bu'
43    ...  Create Default MDT Profile
44
45    Run MDT Profile
46
47    Loop HTX Health Check
48
49    # Post test loop look out for dmesg error logged.
50    Check For Errors On OS Dmesg Log
51
52    Shutdown HTX Exerciser
53
54    Rprint Timen  HTX Test ran for: ${HTX_DURATION}
55
56
57Loop HTX Health Check
58    [Documentation]  Run until HTX exerciser fails.
59
60    Repeat Keyword  ${HTX_DURATION}
61    ...  Run Keywords  Check HTX Run Status
62    ...  AND  Sleep  ${HTX_INTERVAL}
63
64
65Test Teardown Execution
66    [Documentation]  Do the post test teardown.
67    #  Shut down HTX exerciser if test Failed.
68    #  Collect NVIDIA log.
69
70    # Keep HTX running if user set HTX_KEEP_RUNNING to 1.
71    Run Keyword If  '${TEST_STATUS}' == 'FAIL' and ${HTX_KEEP_RUNNING} == ${0}
72    ...  Shutdown HTX Exerciser
73
74    # Collect nvidia-smi output data on exit.
75    Collect NVIDIA Log File  end
76
77
78Suite Teardown Execution
79    [Documentation]  Do the final teardown and cleanup.
80    #  Stop SOL Console Logging.
81    #  Collect FFDC if Test Case Fail.
82    #  Close Connections.
83
84    ${keyword_buf}=  Catenate  Stop SOL Console Logging
85    ...  \ targ_file_path=${EXECDIR}${/}logs${/}SOL.log
86    Run Key  ${keyword_buf}
87
88    FFDC On Test Case Fail
89    Close All Connections
90