1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760
|
# How to Python Unit Tests
## Overview
We use Python's default Python unittest testing framework. You can read more about it here [Python unittest v3.8](https://docs.python.org/3.8/library/unittest.html).
## Warning to Users
AMD SMI Python API tests are subject to change. These tests are currently a work in progress and may not work on your system.
## Pre-Requisites Before Running Tests
Follow our install/build guides to ensure the Python API is installed correctly according to [AMD SMI installation](https://rocm.docs.amd.com/projects/amdsmi/en/latest/).
***Versions***: Python 3.8+
## How to Run
### Basic How To
The 2 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```
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```
<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```
<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```
## Unittest Run Options
The Unittest Run calls the tests directly. The cache provider will always be used.
options:
- -h, --help show this help message and exit
- -v, --verbose Verbose output
- -q, --quiet Quiet output
- -b, --buffer Buffer stdout and stderr during tests
- -k "testname" Only run tests which match the given substring
### Unittest: not verbose
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```
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
test_check_res (__main__.TestAmdSmiPythonBDF) ... ok
test_format_bdf (__main__.TestAmdSmiPythonBDF) ... ok
test_parse_bdf (__main__.TestAmdSmiPythonBDF) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.001s
OK
~~~
</details>
### Unittest: verbose (with print statements)
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```
ex.
<details open>
<summary>Click for example: <i><b>Unittest: verbose (with print statements)</i></b></summary>
~~~shell
/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -v
test_init (__main__.TestAmdSmiInit) ... ok
test_asic_kfd_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_asic_info
asic_info['market_name'] is: NAVI21
asic_info['vendor_id'] is: 0x1002
asic_info['vendor_name'] is: Advanced Micro Devices Inc. [AMD/ATI]
asic_info['device_id'] is: 0x73bf
asic_info['rev_id'] is: 0xc1
asic_info['asic_serial'] is: 0xF8FFEB47A027DE4D
asic_info['oam_id'] is: N/A
asic_info['target_graphics_version'] is: gfx1030
asic_info['num_compute_units'] is: 72
###Test amdsmi_get_gpu_kfd_info
kfd_info['kfd_id'] is: 16970
kfd_info['node_id'] is: 1
ok
test_bad_page_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_bad_page_info
**** [ERROR] | Test: test_bad_page_info | Caught AmdSmiLibraryException: Error code:
2 | AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported
ok
test_bdf_device_id (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_processor_handle_from_bdf
###Test amdsmi_get_gpu_vbios_info
vbios_info['part_number'] is: 113-V395TRIO-2OC
vbios_info['build_date'] is: 2021/03/28 21:35
vbios_info['version'] is: 020.001.000.060.000000
vbios_info['name'] is: 113-MSITV395MH.132
vbios_info['boot_firmware'] is: 01234567
###Test amdsmi_get_gpu_device_uuid
uuid is: f8ff73bf-0000-1000-80ff-eb47a027de4d
ok
test_board_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_board_info
board_info['model_number'] is: N/A
board_info['product_serial'] is: N/A
board_info['fru_id'] is: N/A
board_info['manufacturer_name'] is: Advanced Micro Devices, Inc. [AMD/ATI]
board_info['product_name'] is: Navi 21 [Radeon RX 6800/6800 XT / 6900 XT]
ok
test_clock_frequency (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_clk_freq
SYS clock_frequency['num_supported']: 2
SYS clock_frequency['current']: 0
SYS clock_frequency['frequency']: [500000000, 2575000000]
DF clock_frequency['num_supported']: 3
DF clock_frequency['current']: 1
DF clock_frequency['frequency']: [500000000, 666000000, 1941000000]
ok
test_clock_frequency_DCEF (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_clk_freq
DCEF clock_frequency['num_supported']: 2
DCEF clock_frequency['current']: 0
DCEF clock_frequency['frequency']: [417000000, 1200000000]
ok
test_clock_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_clock_info
Current clock for domain GFX is: 500
Max clock for domain GFX is: 2575
Min clock for domain GFX is: 500
Is GFX clock locked: 0
Is GFX clock in deep sleep: 255
Current clock for domain MEM is: 96
Max clock for domain MEM is: 1000
Min clock for domain MEM is: 96
Is MEM clock in deep sleep: 255
ok
test_clock_info_vclk0_dclk0 (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_clock_info
Current clock for domain VCLK0 is: 1400
Max clock for domain VCLK0 is: 1400
Min clock for domain VCLK0 is: 0
Is VCLK0 clock in deep sleep: 255
Current clock for domain DCLK0 is: 1225
Max clock for domain DCLK0 is: 1225
Min clock for domain DCLK0 is: 0
Is DCLK0 clock in deep sleep: 255
ok
test_clock_info_vclk1_dclk1 (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_clock_info
Current clock for domain VCLK1 is: 362
Max clock for domain VCLK1 is: 362
Min clock for domain VCLK1 is: 0
Is VCLK1 clock in deep sleep: 255
Current clock for domain DCLK1 is: 316
Max clock for domain DCLK1 is: 316
Min clock for domain DCLK1 is: 0
Is DCLK1 clock in deep sleep: 255
ok
test_driver_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_driver_info
Driver info: {'driver_name': 'amdgpu', 'driver_version': '6.9.2', 'driver_date': '2015/01/01 00:00'}
ok
test_ecc_count_block (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_ecc_count
**** [ERROR] | Test: test_ecc_count_block | Caught AmdSmiLibraryException: Error code:
2 | AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported
ok
test_ecc_count_total (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_total_ecc_count
Number of uncorrectable errors: 0
Number of correctable errors: 0
Number of deferred errors: 0
ok
test_fw_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_fw_info
FW name: AMDSMI_FW_ID_CP_CE
FW version: 37
FW name: AMDSMI_FW_ID_CP_PFP
FW version: 98
FW name: AMDSMI_FW_ID_CP_ME
FW version: 64
FW name: AMDSMI_FW_ID_CP_MEC1
FW version: 118
FW name: AMDSMI_FW_ID_CP_MEC2
FW version: 118
FW name: AMDSMI_FW_ID_RLC
FW version: 96
FW name: AMDSMI_FW_ID_SDMA0
FW version: 83
FW name: AMDSMI_FW_ID_SDMA1
FW version: 83
FW name: AMDSMI_FW_ID_VCN
FW version: 04.11.F0.00
FW name: AMDSMI_FW_ID_PSP_SOSDRV
FW version: 00.21.0E.64
FW name: AMDSMI_FW_ID_ASD
FW version: 553648350
FW name: AMDSMI_FW_ID_TA_RAS
FW version: 1B.00.01.3E
FW name: AMDSMI_FW_ID_TA_XGMI
FW version: 20.00.00.0F
FW name: AMDSMI_FW_ID_PM
FW version: 00.58.90.00
FW name: AMDSMI_FW_ID_PLDM_BUNDLE
FW version: 00.xx.yy.zz
ok
test_gpu_activity (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_activity
engine_usage['gfx_activity'] is: 9 %
engine_usage['umc_activity'] is: 0 %
engine_usage['mm_activity'] is: 22 %
ok
test_memory_usage (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_memory_usage
memory_usage for VRAM is: 17104896
memory_usage for VIS_VRAM is: 17104896
memory_usage for GTT is: 15065088
ok
test_pcie_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_pcie_info
pcie_info['pcie_metric']['pcie_width'] is: 16
pcie_info['pcie_static']['max_pcie_width'] is: 16
pcie_info['pcie_metric']['pcie_speed'] is: 16000 MT/s
pcie_info['pcie_static']['max_pcie_speed'] is: 16000
pcie_info['pcie_static']['pcie_interface_version'] is: 4
pcie_info['pcie_static']['slot_type'] is: CEM
pcie_info['pcie_metric']['pcie_replay_count'] is: N/A
pcie_info['pcie_metric']['pcie_bandwidth'] is: N/A
pcie_info['pcie_metric']['pcie_l0_to_recovery_count'] is: N/A
pcie_info['pcie_metric']['pcie_replay_roll_over_count'] is: N/A
pcie_info['pcie_metric']['pcie_nak_sent_count'] is: N/A
pcie_info['pcie_metric']['pcie_nak_received_count'] is: N/A
ok
test_power_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_power_info
power_info['current_socket_power'] is: N/A
power_info['average_socket_power'] is: 39
power_info['gfx_voltage'] is: 856
power_info['soc_voltage'] is: 937
power_info['mem_voltage'] is: 843
power_info['power_limit'] is: 272000000
###Test amdsmi_get_power_cap_info
power_info['dpm_cap'] is: 1
power_info['power_cap'] is: 272000000
###Test amdsmi_is_gpu_power_management_enabled
Power management enabled: True
ok
test_process_list (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_process_list
Process list: []
ok
test_processor_type (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_processor_type
Processor type is: AMDSMI_PROCESSOR_TYPE_AMD_GPU
ok
test_ras_block_features_enabled (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_ras_block_features_enabled
**** [ERROR] | Test: test_ras_block_features_enabled | Caught AmdSmiLibraryException: Error code:
7 | AMDSMI_STATUS_API_FAILED - API call failed
ok
test_ras_feature_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_ras_feature_info
**** [ERROR] | Test: test_ras_feature_info | Caught AmdSmiLibraryException: Error code:
2 | AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported
ok
test_socket_info (__main__.TestAmdSmiPythonInterface) ...
###Test amdsmi_get_socket_handles
###Test Socket 0
###Test amdsmi_get_socket_info
Socket: 0000:43:00
ok
test_temperature_metric (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
Current temperature for HOTSPOT is: 35
Current temperature for VRAM is: 32
###Test amdsmi_get_temp_metric
Limit (critical) temperature for HOTSPOT is: 110
Limit (critical) temperature for VRAM is: 100
###Test amdsmi_get_temp_metric
Shutdown (emergency) temperature for HOTSPOT is: 115
Shutdown (emergency) temperature for VRAM is: 105
ok
test_temperature_metric_edge (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
Current temperature for EDGE is: 31
Limit (critical) temperature for EDGE is: 100
Shutdown (emergency) temperature for EDGE is: 105
ok
test_temperature_metric_hbm (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
**** [ERROR] | Test: test_temperature_metric_hbm | Caught AmdSmiLibraryException: Error code:
2 | AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported
ok
test_temperature_metric_plx (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
Current temperature for PLX is: 30
Limit (critical) temperature for PLX is: 30
Shutdown (emergency) temperature for PLX is: 30
ok
test_utilization_count (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_utilization_count
Timestamp: 2570588934628027
Utilization count for AMDSMI_COARSE_GRAIN_GFX_ACTIVITY is: 4294967295
Utilization count for AMDSMI_COARSE_GRAIN_MEM_ACTIVITY is: 4294967295
Utilization count for AMDSMI_COARSE_DECODER_ACTIVITY is: 0
Timestamp: 2570588935626503
Utilization count for AMDSMI_FINE_GRAIN_GFX_ACTIVITY is: 4294967295
Utilization count for AMDSMI_FINE_GRAIN_MEM_ACTIVITY is: 4294967295
Utilization count for AMDSMI_FINE_DECODER_ACTIVITY is: 0
ok
test_vbios_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_vbios_info
vbios_info['part_number'] is: 113-V395TRIO-2OC
vbios_info['build_date'] is: 2021/03/28 21:35
vbios_info['name'] is: 113-MSITV395MH.132
vbios_info['version'] is: 020.001.000.060.000000
vbios_info['boot_firmware'] is: 01234567
ok
test_vendor_name (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_vendor_name
Vendor name is: Advanced Micro Devices, Inc. [AMD/ATI]
ok
test_walkthrough (__main__.TestAmdSmiPythonInterface) ...
#######################################################################
========> test_walkthrough start <========
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_asic_info
asic_info['market_name'] is: NAVI21
asic_info['vendor_id'] is: 0x1002
asic_info['vendor_name'] is: Advanced Micro Devices Inc. [AMD/ATI]
asic_info['device_id'] is: 0x73bf
asic_info['rev_id'] is: 0xc1
asic_info['subsystem_id'] is: 0xc34
asic_info['asic_serial'] is: 0xF8FFEB47A027DE4D
asic_info['oam_id'] is: N/A
asic_info['target_graphics_version'] is: gfx1030
asic_info['num_compute_units'] is: 72
###Test amdsmi_get_gpu_kfd_info
kfd_info['kfd_id'] is: 16970
kfd_info['node_id'] is: 1
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_power_info
power_info['current_socket_power'] is: N/A
power_info['average_socket_power'] is: 31
power_info['gfx_voltage'] is: 856
power_info['soc_voltage'] is: 937
power_info['mem_voltage'] is: 837
power_info['power_limit'] is: 272000000
###Test amdsmi_get_power_cap_info
power_info['dpm_cap'] is: 1
power_info['power_cap'] is: 272000000
###Test amdsmi_is_gpu_power_management_enabled
Power management enabled: True
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_vbios_info
vbios_info['part_number'] is: 113-V395TRIO-2OC
vbios_info['build_date'] is: 2021/03/28 21:35
vbios_info['name'] is: 113-MSITV395MH.132
vbios_info['version'] is: 020.001.000.060.000000
vbios_info['boot_firmware'] is: 01234567
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_board_info
board_info['model_number'] is: N/A
board_info['product_serial'] is: N/A
board_info['fru_id'] is: N/A
board_info['manufacturer_name'] is: Advanced Micro Devices, Inc. [AMD/ATI]
board_info['product_name'] is: Navi 21 [Radeon RX 6800/6800 XT / 6900 XT]
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_fw_info
FW name: AMDSMI_FW_ID_CP_CE
FW version: 37
FW name: AMDSMI_FW_ID_CP_PFP
FW version: 98
FW name: AMDSMI_FW_ID_CP_ME
FW version: 64
FW name: AMDSMI_FW_ID_CP_MEC1
FW version: 118
FW name: AMDSMI_FW_ID_CP_MEC2
FW version: 118
FW name: AMDSMI_FW_ID_RLC
FW version: 96
FW name: AMDSMI_FW_ID_SDMA0
FW version: 83
FW name: AMDSMI_FW_ID_SDMA1
FW version: 83
FW name: AMDSMI_FW_ID_VCN
FW version: 04.11.F0.00
FW name: AMDSMI_FW_ID_PSP_SOSDRV
FW version: 00.21.0E.64
FW name: AMDSMI_FW_ID_ASD
FW version: 553648350
FW name: AMDSMI_FW_ID_TA_RAS
FW version: 1B.00.01.3E
FW name: AMDSMI_FW_ID_TA_XGMI
FW version: 20.00.00.0F
FW name: AMDSMI_FW_ID_PM
FW version: 00.58.90.00
FW name: AMDSMI_FW_ID_PLDM_BUNDLE
FW version: 00.xx.yy.zz
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_driver_info
Driver info: {'driver_name': 'amdgpu', 'driver_version': '6.9.2', 'driver_date': '2015/01/01 00:00'}
========> test_walkthrough end <========
#######################################################################
ok
----------------------------------------------------------------------
Ran 31 tests in 0.592s
OK
~~~
</details>
### Unittest: filter and verbose
Allow filtering based on common or specific test names.
```/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "test_walkthrough" -v```
ex.
<details open>
<summary>Click for example: <i><b>Unittest: filter and verbose</b></i></summary>
~~~shell
/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "test_asic_kfd_info" -v
test_asic_kfd_info (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_gpu_asic_info
asic_info['market_name'] is: NAVI21
asic_info['vendor_id'] is: 0x1002
asic_info['vendor_name'] is: Advanced Micro Devices Inc. [AMD/ATI]
asic_info['device_id'] is: 0x73bf
asic_info['rev_id'] is: 0xc1
asic_info['asic_serial'] is: 0xF8FFEB47A027DE4D
asic_info['oam_id'] is: N/A
asic_info['target_graphics_version'] is: gfx1030
asic_info['num_compute_units'] is: 72
###Test amdsmi_get_gpu_kfd_info
kfd_info['kfd_id'] is: 16970
kfd_info['node_id'] is: 1
ok
----------------------------------------------------------------------
Ran 1 test in 0.453s
OK
~~~
</details>
## Run Tests
### Example Runs
Please refer to Python's UnitTest documentation for better overview of commands to run.
```shell
/opt/rocm/share/amd_smi/tests/python_unittest/unit_tests.py -v
test_check_res (__main__.TestAmdSmiPythonBDF) ... ok
test_format_bdf (__main__.TestAmdSmiPythonBDF) ... ok
test_parse_bdf (__main__.TestAmdSmiPythonBDF) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.001s
OK
```
```shell
/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "temperature" -v
test_temperature_metric (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
Current temperature for HOTSPOT is: 33
Current temperature for VRAM is: 32
###Test amdsmi_get_temp_metric
Limit (critical) temperature for HOTSPOT is: 110
Limit (critical) temperature for VRAM is: 100
###Test amdsmi_get_temp_metric
Shutdown (emergency) temperature for HOTSPOT is: 115
Shutdown (emergency) temperature for VRAM is: 105
ok
test_temperature_metric_edge (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
Current temperature for EDGE is: 31
Limit (critical) temperature for EDGE is: 100
Shutdown (emergency) temperature for EDGE is: 105
ok
test_temperature_metric_hbm (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
**** [ERROR] | Test: test_temperature_metric_hbm | Caught AmdSmiLibraryException: Error code:
2 | AMDSMI_STATUS_NOT_SUPPORTED - Feature not supported
ok
test_temperature_metric_plx (__main__.TestAmdSmiPythonInterface) ...
###Test Processor 0, bdf: 0000:43:00.0
###Test amdsmi_get_temp_metric
Current temperature for PLX is: 30
Limit (critical) temperature for PLX is: 30
Shutdown (emergency) temperature for PLX is: 30
ok
----------------------------------------------------------------------
Ran 4 tests in 0.466s
OK
```
```shell
/opt/rocm/share/amd_smi/tests/python_unittest/integration_test.py -k "info" -b -v
test_asic_kfd_info (__main__.TestAmdSmiPythonInterface) ... ok
test_bad_page_info (__main__.TestAmdSmiPythonInterface) ... ok
test_board_info (__main__.TestAmdSmiPythonInterface) ... ok
test_clock_info (__main__.TestAmdSmiPythonInterface) ... ok
test_clock_info_vclk0_dclk0 (__main__.TestAmdSmiPythonInterface) ... ok
test_clock_info_vclk1_dclk1 (__main__.TestAmdSmiPythonInterface) ... ok
test_driver_info (__main__.TestAmdSmiPythonInterface) ... ok
test_fw_info (__main__.TestAmdSmiPythonInterface) ... ok
test_pcie_info (__main__.TestAmdSmiPythonInterface) ... ok
test_power_info (__main__.TestAmdSmiPythonInterface) ... ok
test_ras_feature_info (__main__.TestAmdSmiPythonInterface) ... ok
test_socket_info (__main__.TestAmdSmiPythonInterface) ... ok
test_vbios_info (__main__.TestAmdSmiPythonInterface) ... ok
----------------------------------------------------------------------
Ran 13 tests in 0.506s
OK
```
|