| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_amdpmfixedlegacy.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/commandqueuestub.h"cxx . . $ `<file>/tests/src/common/commandqueuestub.h`/ |
| 7 | #include "common/stringdatasourcestub.h"cxx . . $ `<file>/tests/src/common/stringdatasourcestub.h`/ |
| 8 | #include "core/components/controls/amd/pm/fixed/pmfixedlegacy.h"cxx . . $ `<file>/src/core/components/controls/amd/pm/fixed/pmfixedlegacy.h`/ |
| 9 | |
| 10 | namespace Testscxx . . $ Tests/::AMDcxx . . $ Tests/AMD/::PMFixedLegacycxx . . $ Tests/AMD/PMFixedLegacy/ { |
| 11 | |
| 12 | class PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# : public ::AMDcxx . . $ AMD/::PMFixedLegacycxx . . $ AMD/PMFixedLegacy# |
| 13 | { |
| 14 | public: |
| 15 | using ::AMDcxx . . $ AMD/::PMFixedLegacycxx . . $ AMD/PMFixedLegacy#::PMFixedLegacycxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter#PMFixedLegacyTestAdapter(d3d2922ee40ba14a).; |
| 16 | |
| 17 | using ::AMDcxx . . $ AMD/::PMFixedLegacycxx . . $ AMD/PMFixedLegacy#::cleanControlcxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter#cleanControl(151e9138769f295e).; |
| 18 | using ::AMDcxx . . $ AMD/::PMFixedLegacycxx . . $ AMD/PMFixedLegacy#::modecxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter#mode(9c546c94e5fcce4e).; |
| 19 | using ::AMDcxx . . $ AMD/::PMFixedLegacycxx . . $ AMD/PMFixedLegacy#::modescxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter#modes(f5f2959be38ccc08).; |
| 20 | using ::AMDcxx . . $ AMD/::PMFixedLegacycxx . . $ AMD/PMFixedLegacy#::syncControlcxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter#syncControl(151e9138769f295e).; |
| 21 | }; |
| 22 | |
| 23 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("AMD PMFixedLegacy tests", "[GPU][AMD][PM][PMFixed][Legacy]") |
| 24 | { |
| 25 | stdcxx . . $ std/::stringcxx . . $ std/string# const powerMethodPathcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).{"power_method"}; |
| 26 | stdcxx . . $ std/::stringcxx . . $ std/string# const powerProfilePathcxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).{"power_profile"}; |
| 27 | CommandQueueStubcxx . . $ CommandQueueStub# ctlCmds; |
| 28 | |
| 29 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Has 'low' mode selected by default") |
| 30 | { |
| 31 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(), |
| 32 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>()); |
| 33 | |
| 34 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.mode() == "low"); |
| 35 | } |
| 36 | |
| 37 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Has [low, mid, high] modes") |
| 38 | { |
| 39 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> const powerProfilescxx . . $ std/vector#vector(9619226211e5a241).{"low", "mid", "high"}; |
| 40 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(), |
| 41 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>()); |
| 42 | |
| 43 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.modes() == powerProfiles); |
| 44 | } |
| 45 | |
| 46 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does generate clean control commands") |
| 47 | { |
| 48 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts( |
| 49 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerMethodPath, "profile"), |
| 50 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerProfilePath, "low")); |
| 51 | ts.cleanControlcxx . . $ AMD/PMFixedLegacy#cleanControl(151e9138769f295e).(ctlCmds); |
| 52 | |
| 53 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 2); |
| 54 | |
| 55 | auto &[cmd0Path, cmd0Value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().frontcxx . . $ std/vector#front(af0004c3ce7cab93).(); |
| 56 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd0Path == powerMethodPath); |
| 57 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd0Value == "profile"); |
| 58 | |
| 59 | auto &[cmd1Path, cmd1Value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().backcxx . . $ std/vector#back(af0004c3ce7cab93).(); |
| 60 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd1Path == powerProfilePath); |
| 61 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd1Value == "auto"); |
| 62 | } |
| 63 | |
| 64 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate sync control commands when is synced") |
| 65 | { |
| 66 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts( |
| 67 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerMethodPath, "profile"), |
| 68 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerProfilePath, "low")); |
| 69 | ts.syncControlcxx . . $ AMD/PMFixedLegacy#syncControl(151e9138769f295e).(ctlCmds); |
| 70 | |
| 71 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 72 | } |
| 73 | |
| 74 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does generate sync control commands when...") |
| 75 | { |
| 76 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("power_method is out of sync") |
| 77 | { |
| 78 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts( |
| 79 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerMethodPath, "_other_"), |
| 80 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerProfilePath, "low")); |
| 81 | ts.syncControlcxx . . $ AMD/PMFixedLegacy#syncControl(151e9138769f295e).(ctlCmds); |
| 82 | |
| 83 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 2); |
| 84 | |
| 85 | auto &[cmd0Path, cmd0Value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().frontcxx . . $ std/vector#front(af0004c3ce7cab93).(); |
| 86 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd0Path == powerMethodPath); |
| 87 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd0Value == "profile"); |
| 88 | |
| 89 | auto &[cmd1Path, cmd1Value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().backcxx . . $ std/vector#back(af0004c3ce7cab93).(); |
| 90 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd1Path == powerProfilePath); |
| 91 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd1Value == "low"); |
| 92 | } |
| 93 | |
| 94 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("power_profile is out of sync") |
| 95 | { |
| 96 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts( |
| 97 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerMethodPath, "profile"), |
| 98 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerProfilePath, "_other_")); |
| 99 | ts.syncControlcxx . . $ AMD/PMFixedLegacy#syncControl(151e9138769f295e).(ctlCmds); |
| 100 | |
| 101 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 1); |
| 102 | |
| 103 | auto &[cmdPath, cmdValue] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().frontcxx . . $ std/vector#front(af0004c3ce7cab93).(); |
| 104 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdPath == powerProfilePath); |
| 105 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdValue == "low"); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("power_method and power_profile are out of sync") |
| 110 | { |
| 111 | PMFixedLegacyTestAdaptercxx . . $ Tests/AMD/PMFixedLegacy/PMFixedLegacyTestAdapter# ts( |
| 112 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerMethodPath, "_other_"), |
| 113 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<StringDataSourceStubcxx . . $ StringDataSourceStub#>(powerProfilePath, "_other_")); |
| 114 | ts.syncControlcxx . . $ AMD/PMFixedLegacy#syncControl(151e9138769f295e).(ctlCmds); |
| 115 | |
| 116 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 2); |
| 117 | |
| 118 | auto &[cmd0Path, cmd0Value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().frontcxx . . $ std/vector#front(af0004c3ce7cab93).(); |
| 119 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd0Path == powerMethodPath); |
| 120 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd0Value == "profile"); |
| 121 | |
| 122 | auto &[cmd1Path, cmd1Value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().backcxx . . $ std/vector#back(af0004c3ce7cab93).(); |
| 123 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd1Path == powerProfilePath); |
| 124 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmd1Value == "low"); |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | } // namespace Tests::AMD::PMFixedLegacy |