| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_amdpmpowercap.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | #include <catch2/trompeloeil.hpp> |
| 6 | |
| 7 | #include "common/commandqueuestub.h"cxx . . $ `<file>/tests/src/common/commandqueuestub.h`/ |
| 8 | #include "core/components/controls/amd/pm/advanced/powercap/pmpowercap.h"cxx . . $ `<file>/src/core/components/controls/amd/pm/advanced/powercap/pmpowercap.h`/ |
| 9 | #include "core/idatasource.h"cxx . . $ `<file>/src/core/idatasource.h`/ |
| 10 | |
| 11 | extern template struct trompeloeil::reportercxx . . $ trompeloeil/reporter#<trompeloeilcxx . . $ trompeloeil/::specializedcxx . . $ trompeloeil/specialized#>; |
| 12 | |
| 13 | namespace Testscxx . . $ Tests/::AMDcxx . . $ Tests/AMD/::PMPowerCapcxx . . $ Tests/AMD/PMPowerCap/ { |
| 14 | |
| 15 | class ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub# : public IDataSourcecxx . . $ IDataSource#<unsigned long> |
| 16 | { |
| 17 | public: |
| 18 | ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#ULongDataSourceStub(a314d5c5530ff666).(stdcxx . . $ std/::string_viewcxx . . $ std/string_view# source = ""cxx . . $ std/basic_string_view#basic_string_view(837a1ee5a10cb792)., unsigned long data = 0, |
| 19 | bool success = true) noexcept |
| 20 | : source_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#source_.(source) |
| 21 | , data_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#data_.(data) |
| 22 | , success_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#success_.(success) |
| 23 | { |
| 24 | } |
| 25 | |
| 26 | stdcxx . . $ std/::stringcxx . . $ std/string# sourcecxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#source(219584694fe2b248).() const override |
| 27 | { |
| 28 | return source_cxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).; |
| 29 | } |
| 30 | |
| 31 | bool readcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#read(ac6aef67746a816c).(unsigned long &data) override |
| 32 | { |
| 33 | data = data_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#data_.; |
| 34 | return success_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#success_.; |
| 35 | } |
| 36 | |
| 37 | void datacxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#data(2c44cd906ae4e829).(unsigned long data) |
| 38 | { |
| 39 | data_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#data_. = data; |
| 40 | } |
| 41 | |
| 42 | stdcxx . . $ std/::stringcxx . . $ std/string# const source_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#source_.; |
| 43 | unsigned long data_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#data_.; |
| 44 | bool success_cxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#success_.; |
| 45 | }; |
| 46 | |
| 47 | class PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# : public ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap# |
| 48 | { |
| 49 | public: |
| 50 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::PMPowerCapcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#PMPowerCapTestAdapter(e7894092e1bbe86).; |
| 51 | |
| 52 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::cleanControlcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#cleanControl(151e9138769f295e).; |
| 53 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::exportControlcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#exportControl(40299682ab9c8676).; |
| 54 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::importControlcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#importControl(4f796e3ecd5dcd94).; |
| 55 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::maxcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#max(3b41e625babe1450).; |
| 56 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::mincxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#min(3b41e625babe1450).; |
| 57 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::syncControlcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#syncControl(151e9138769f295e).; |
| 58 | using ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::valuecxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter#value(ed3e1b591434c2d5).; |
| 59 | }; |
| 60 | |
| 61 | class PMPowerCapImporterStubcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub# : public ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::Importercxx . . $ AMD/PMPowerCap#Importer# |
| 62 | { |
| 63 | public: |
| 64 | PMPowerCapImporterStubcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#PMPowerCapImporterStub(c8930f5a26aea074).(unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# value) |
| 65 | : value_cxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#value_.(value) |
| 66 | { |
| 67 | } |
| 68 | |
| 69 | stdcxx . . $ std/::optionalcxx . . $ std/optional#<stdcxx . . $ std/::reference_wrappercxx . . $ std/reference_wrapper#<Importablecxx . . $ Importable#::Importercxx . . $ Importable#Importer#>> |
| 70 | provideImportercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#provideImporter(c13a3bcac0db4745).(Itemcxx . . $ Item# const &) override |
| 71 | { |
| 72 | return *cxx . . $ std/optional#optional(e3f0d6382bd52f24).this; |
| 73 | } |
| 74 | |
| 75 | bool provideActivecxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#provideActive(50ce9a9e25b4a850).() const override |
| 76 | { |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# providePMPowerCapValuecxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#providePMPowerCapValue(d51cd3ed4880bbb1).() const override |
| 81 | { |
| 82 | return value_cxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#value_.; |
| 83 | } |
| 84 | |
| 85 | private: |
| 86 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# value_cxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#value_.; |
| 87 | }; |
| 88 | |
| 89 | class PMPowerCapExporterMockcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapExporterMock# : public ::AMDcxx . . $ AMD/::PMPowerCapcxx . . $ AMD/PMPowerCap#::Exportercxx . . $ AMD/PMPowerCap#Exporter# |
| 90 | { |
| 91 | public: |
| 92 | MAKE_MOCK1cxx . . $ `<external>/1068432606165018960/mock.hpp:4223:9`!(takePMPowerCapValue, void(units::power::watt_t), override); |
| 93 | MAKE_MOCK2cxx . . $ `<external>/1068432606165018960/mock.hpp:4224:9`!(takePMPowerCapRange, |
| 94 | void(units::power::watt_t, units::power::watt_t), override); |
| 95 | MAKE_MOCK1cxx . . $ `<external>/1068432606165018960/mock.hpp:4223:9`!(takeActive, void(bool), override); |
| 96 | MAKE_MOCK1cxx . . $ `<external>/1068432606165018960/mock.hpp:4223:9`!( |
| 97 | provideExporter, |
| 98 | std::optional<std::reference_wrapper<Exportable::Exporter>>(Item const &), |
| 99 | override); |
| 100 | }; |
| 101 | |
| 102 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("AMD PMPowerCap tests", "[GPU][AMD][PM][PMPowerCap]") |
| 103 | { |
| 104 | CommandQueueStubcxx . . $ CommandQueueStub# ctlCmds; |
| 105 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# mincxx . . $ units/unit_t#unit_t(cae3843c5f368392).(50); |
| 106 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# maxcxx . . $ units/unit_t#unit_t(cae3843c5f368392).(100); |
| 107 | |
| 108 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Has PMPowerCap ID") |
| 109 | { |
| 110 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>(), min, max); |
| 111 | |
| 112 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.ID() == ::AMD::PMPowerCap::ItemID); |
| 113 | } |
| 114 | |
| 115 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Is active by default") |
| 116 | { |
| 117 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>(), min, max); |
| 118 | |
| 119 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.active()); |
| 120 | } |
| 121 | |
| 122 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Has 1 watt as minimum range value when 0 watt is supplied as the " |
| 123 | "minimum value at construction") |
| 124 | { // NOTE 0 watt is reserved for reseting the value |
| 125 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>(), |
| 126 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(0), max); |
| 127 | |
| 128 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.min() == units::power::watt_t(1)); |
| 129 | } |
| 130 | |
| 131 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Clamp its value in the [min, max] range") |
| 132 | { |
| 133 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 134 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 50000000), min, max); |
| 135 | |
| 136 | ts.valuecxx . . $ AMD/PMPowerCap#value(ed3e1b591434c2d5).(unitscxx . . $ units/unit_t#unit_t(99cb94cb9b038092).::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(0)); |
| 137 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.value() == min); |
| 138 | |
| 139 | ts.valuecxx . . $ AMD/PMPowerCap#value(ed3e1b591434c2d5).(unitscxx . . $ units/unit_t#unit_t(99cb94cb9b038092).::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(500)); |
| 140 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.value() == max); |
| 141 | } |
| 142 | |
| 143 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Generate pre-init control commands when default power cap is not " |
| 144 | "available") |
| 145 | { |
| 146 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 147 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 10000000), min, max); |
| 148 | ts.preInitcxx . . $ AMD/PMPowerCap#preInit(151e9138769f295e).(ctlCmds); |
| 149 | |
| 150 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 151 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.size() == 1); |
| 152 | |
| 153 | auto &[cmdPath, cmdValue] = commands.atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 154 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdPath == "power1_cap"); |
| 155 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdValue == "0"); |
| 156 | } |
| 157 | |
| 158 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate pre-init control commands when default power cap " |
| 159 | "is available") |
| 160 | { |
| 161 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 162 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 10000000), min, max, |
| 163 | unitscxx . . $ std/optional#optional(e3f0d6382bd52f24).::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(75)); |
| 164 | ts.preInitcxx . . $ AMD/PMPowerCap#preInit(151e9138769f295e).(ctlCmds); |
| 165 | |
| 166 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 167 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.empty()); |
| 168 | } |
| 169 | |
| 170 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Generate post-init control commands when default power cap is not " |
| 171 | "available") |
| 172 | { |
| 173 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 174 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 10000000), min, max); |
| 175 | ts.preInitcxx . . $ AMD/PMPowerCap#preInit(151e9138769f295e).(ctlCmds); |
| 176 | ctlCmds.clearcxx . . $ CommandQueueStub#clear(49f6e7a06ebc5aa8).(); |
| 177 | ts.postInitcxx . . $ AMD/PMPowerCap#postInit(151e9138769f295e).(ctlCmds); |
| 178 | |
| 179 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 180 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.size() == 1); |
| 181 | |
| 182 | auto &[cmdPath, cmdValue] = commands.atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 183 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdPath == "power1_cap"); |
| 184 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdValue == "10000000"); // restore pre-init value |
| 185 | } |
| 186 | |
| 187 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate post-init control commands when default power cap " |
| 188 | "is available") |
| 189 | { |
| 190 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 191 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 10000000), min, max, |
| 192 | unitscxx . . $ std/optional#optional(e3f0d6382bd52f24).::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(75)); |
| 193 | ts.postInitcxx . . $ AMD/PMPowerCap#postInit(151e9138769f295e).(ctlCmds); |
| 194 | |
| 195 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 196 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.empty()); |
| 197 | } |
| 198 | |
| 199 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Power cap has the value of the default power cap when the later is " |
| 200 | "available") |
| 201 | { |
| 202 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 203 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 50000000), min, max, |
| 204 | unitscxx . . $ std/optional#optional(e3f0d6382bd52f24).::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(75)); |
| 205 | |
| 206 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.value() == units::power::watt_t(75)); |
| 207 | } |
| 208 | |
| 209 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Initializes power cap value from power1_cap data source when " |
| 210 | "default power cap is not available") |
| 211 | { |
| 212 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 213 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 50000000), min, max); |
| 214 | ts.initcxx . . $ AMD/PMPowerCap#init(49f6e7a06ebc5aa8).(); |
| 215 | |
| 216 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.value() == units::power::watt_t(50)); |
| 217 | } |
| 218 | |
| 219 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Imports its state") |
| 220 | { |
| 221 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 222 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap"), min, max); |
| 223 | |
| 224 | PMPowerCapImporterStubcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub# icxx . . $ Tests/AMD/PMPowerCap/PMPowerCapImporterStub#PMPowerCapImporterStub(c8930f5a26aea074).(unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(80)); |
| 225 | ts.importWithcxx . . $ Control#importWith(94eddebf9440278).(i); |
| 226 | |
| 227 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.value() == units::power::watt_t(80)); |
| 228 | } |
| 229 | |
| 230 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Export its state") |
| 231 | { |
| 232 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 233 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap"), min, max); |
| 234 | |
| 235 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# valuecxx . . $ units/unit_t#unit_t(cae3843c5f368392).(80); |
| 236 | ts.valuecxx . . $ AMD/PMPowerCap#value(ed3e1b591434c2d5).(valuecxx . . $ units/unit_t#unit_t(99cb94cb9b038092).); |
| 237 | |
| 238 | trompeloeilcxx . . $ trompeloeil/::sequencecxx . . $ trompeloeil/sequence# seq; |
| 239 | PMPowerCapExporterMockcxx . . $ Tests/AMD/PMPowerCap/PMPowerCapExporterMock# e; |
| 240 | REQUIRE_CALLcxx . . $ `<external>/1068432606165018960/mock.hpp:4335:9`!(e, takePMPowerCapRange(trompeloeil::_, trompeloeil::_)) |
| 241 | .LR_WITHcxx . . $ `<external>/1068432606165018960/mock.hpp:4345:9`!(_1 == min) |
| 242 | .LR_WITHcxx . . $ `<external>/1068432606165018960/mock.hpp:4345:9`!(_2 == max) |
| 243 | .IN_SEQUENCEcxx . . $ `<external>/3750106516996543135/sequence.hpp:394:9`!(seq); |
| 244 | REQUIRE_CALLcxx . . $ `<external>/1068432606165018960/mock.hpp:4335:9`!(e, takePMPowerCapValue(trompeloeil::_)) |
| 245 | .LR_WITHcxx . . $ `<external>/1068432606165018960/mock.hpp:4345:9`!(_1 == value) |
| 246 | .IN_SEQUENCEcxx . . $ `<external>/3750106516996543135/sequence.hpp:394:9`!(seq); |
| 247 | |
| 248 | ts.exportControlcxx . . $ AMD/PMPowerCap#exportControl(40299682ab9c8676).(e); |
| 249 | } |
| 250 | |
| 251 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Generate clean control commands...") |
| 252 | { |
| 253 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!( |
| 254 | "To restore the default value when default power cap is not available") |
| 255 | { |
| 256 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 257 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap"), min, max); |
| 258 | |
| 259 | ts.cleanControlcxx . . $ AMD/PMPowerCap#cleanControl(151e9138769f295e).(ctlCmds); |
| 260 | |
| 261 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 262 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.size() == 1); |
| 263 | |
| 264 | auto &[cmdPath, cmdValue] = commands.atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 265 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdPath == "power1_cap"); |
| 266 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdValue == "0"); |
| 267 | } |
| 268 | |
| 269 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!( |
| 270 | "Assigning the default power value when default power cap is available") |
| 271 | { |
| 272 | unitscxx . . $ units/::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t# defaultValuecxx . . $ units/unit_t#unit_t(cae3843c5f368392).(75); |
| 273 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 274 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap"), min, max, |
| 275 | defaultValuecxx . . $ std/optional#optional(e3f0d6382bd52f24).); |
| 276 | |
| 277 | ts.cleanControlcxx . . $ AMD/PMPowerCap#cleanControl(151e9138769f295e).(ctlCmds); |
| 278 | |
| 279 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 280 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.size() == 1); |
| 281 | |
| 282 | auto &[cmdPath, cmdValue] = commands.atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 283 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdPath == "power1_cap"); |
| 284 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdValue == "75000000"); |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate sync control commands when is synced") |
| 289 | { |
| 290 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 291 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 50000000), min, max); |
| 292 | ts.initcxx . . $ AMD/PMPowerCap#init(49f6e7a06ebc5aa8).(); |
| 293 | |
| 294 | ts.syncControlcxx . . $ AMD/PMPowerCap#syncControl(151e9138769f295e).(ctlCmds); |
| 295 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 296 | } |
| 297 | |
| 298 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does generate sync control commands when is out of sync") |
| 299 | { |
| 300 | PMPowerCapTestAdaptercxx . . $ Tests/AMD/PMPowerCap/PMPowerCapTestAdapter# ts( |
| 301 | stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<ULongDataSourceStubcxx . . $ Tests/AMD/PMPowerCap/ULongDataSourceStub#>("power1_cap", 50000000), min, max); |
| 302 | ts.initcxx . . $ AMD/PMPowerCap#init(49f6e7a06ebc5aa8).(); |
| 303 | ts.valuecxx . . $ AMD/PMPowerCap#value(ed3e1b591434c2d5).(unitscxx . . $ units/unit_t#unit_t(99cb94cb9b038092).::powercxx . . $ units/power/::watt_tcxx . . $ units/power/watt_t#(80)); |
| 304 | |
| 305 | ts.synccxx . . $ Control#sync(151e9138769f295e).(ctlCmds); |
| 306 | |
| 307 | auto &commands = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).(); |
| 308 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(commands.size() == 1); |
| 309 | |
| 310 | auto &[cmdPath, cmdValue] = commands.atcxx . . $ std/vector#at(b61e45a10b63f40a).(0); |
| 311 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdPath == "power1_cap"); |
| 312 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(cmdValue == "80000000"); |
| 313 | } |
| 314 | } |
| 315 | |
| 316 | } // namespace Tests::AMD::PMPowerCap |