[SWDEV-552552] Provide CLI testing within amd-smi-lib-tests install (#2485)

* Add common module
* Added information to help with unknowns
* Allow paring of cmds
* change cmd print default
* Reduce cmds to be tested

---------

Signed-off-by: amd-josnarlo <joseph.narlo@amd.com>
Co-authored-by: amd-josnarlo <joseph.narlo@amd.com>
Este commit está contenido en:
Joseph Narlo
2026-01-28 22:16:01 -06:00
cometido por GitHub
padre cf3e283d85
commit 48a4cda75c
Se han modificado 5 ficheros con 1989 adiciones y 10 borrados
+11 -5
Ver fichero
@@ -12,22 +12,26 @@ Follow our install/build guides to ensure the Python API is installed correctly
## How to Run
### Basic How To
The 2 tests are in this PATH:
The 3 tests are in this PATH:
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py```
```/opt/rocm/share/amd_smi/tests/python_unittest/cli_unit_test.py```
The recommended method to run the tests:
<u>Unittest only (not verbose)</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/cli_unit_test.py -b -v```
<u>Unittest verbose</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/cli_unit_test.py -v```
<u>Unittest filter and verbose</u>
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -k "testname" -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "testname" -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/cli_unit_test.py -k "testname" -v```
## Unittest Run Options
The Unittest Run calls the tests directly. The cache provider will always be used.
@@ -43,15 +47,16 @@ options:
Runs all tests. Silence print statements to stdout. Lists tests results.
This is also the best way to list all tests available.
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -b -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -b```
```/opt/rocm/share/amd_smi/tests/python_unittest/cli_unit_test.py -b```
ex.
<details open>
<summary>Click for example: <i><b>Unittest: not verbose</i></b></summary>
~~~shell
/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b -v
/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -b
test_check_res (__main__.TestAmdSmiPythonBDF) ... ok
test_format_bdf (__main__.TestAmdSmiPythonBDF) ... ok
test_parse_bdf (__main__.TestAmdSmiPythonBDF) ... ok
@@ -69,6 +74,7 @@ Helpful to see print outs of Python.
```/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -v```
```/opt/rocm/share/amd_smi/tests/python_unittest/cli_unit_test.py -v```
ex.
@@ -757,4 +763,4 @@ test_vbios_info (__main__.TestAmdSmiPythonInterface) ... ok
Ran 13 tests in 0.506s
OK
```
```