| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_amdfanauto.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/uintdatasourcestub.h"cxx . . $ `<file>/tests/src/common/uintdatasourcestub.h`/ |
| 8 | #include "core/components/controls/amd/fan/auto/fanauto.h"cxx . . $ `<file>/src/core/components/controls/amd/fan/auto/fanauto.h`/ |
| 9 | |
| 10 | namespace Testscxx . . $ Tests/::AMDcxx . . $ Tests/AMD/::FanAutocxx . . $ Tests/AMD/FanAuto/ { |
| 11 | |
| 12 | class FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# : public ::AMDcxx . . $ AMD/::FanAutocxx . . $ AMD/FanAuto# |
| 13 | { |
| 14 | public: |
| 15 | using ::AMDcxx . . $ AMD/::FanAutocxx . . $ AMD/FanAuto#::FanAutocxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter#FanAutoTestAdapter(622b081ced0c7085).; |
| 16 | |
| 17 | using ::AMDcxx . . $ AMD/::FanAutocxx . . $ AMD/FanAuto#::cleanControlcxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter#cleanControl(151e9138769f295e).; |
| 18 | using ::AMDcxx . . $ AMD/::FanAutocxx . . $ AMD/FanAuto#::syncControlcxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter#syncControl(151e9138769f295e).; |
| 19 | }; |
| 20 | |
| 21 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("AMD FanAuto tests", "[GPU][AMD][Fan][FanAuto]") |
| 22 | { |
| 23 | CommandQueueStubcxx . . $ CommandQueueStub# ctlCmds; |
| 24 | |
| 25 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Has FanAuto ID") |
| 26 | { |
| 27 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>()); |
| 28 | |
| 29 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.ID() == ::AMD::FanAuto::ItemID); |
| 30 | } |
| 31 | |
| 32 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Is active by default") |
| 33 | { |
| 34 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>()); |
| 35 | |
| 36 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ts.active()); |
| 37 | } |
| 38 | |
| 39 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate pre-init control commands") |
| 40 | { |
| 41 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>()); |
| 42 | ts.preInitcxx . . $ AMD/FanAuto#preInit(151e9138769f295e).(ctlCmds); |
| 43 | |
| 44 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 45 | } |
| 46 | |
| 47 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate post-init control commands") |
| 48 | { |
| 49 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>()); |
| 50 | ts.postInitcxx . . $ AMD/FanAuto#postInit(151e9138769f295e).(ctlCmds); |
| 51 | |
| 52 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 53 | } |
| 54 | |
| 55 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate clean control commands") |
| 56 | { |
| 57 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>()); |
| 58 | ts.cleanControlcxx . . $ AMD/FanAuto#cleanControl(151e9138769f295e).(ctlCmds); |
| 59 | |
| 60 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 61 | } |
| 62 | |
| 63 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does not generate sync control commands when is synced") |
| 64 | { |
| 65 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>("path", 2)); |
| 66 | ts.syncControlcxx . . $ AMD/FanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 67 | |
| 68 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().empty()); |
| 69 | } |
| 70 | |
| 71 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Does generate sync control commands when is out of sync") |
| 72 | { |
| 73 | FanAutoTestAdaptercxx . . $ Tests/AMD/FanAuto/FanAutoTestAdapter# ts(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<UIntDataSourceStubcxx . . $ UIntDataSourceStub#>("path", 123)); |
| 74 | ts.syncControlcxx . . $ AMD/FanAuto#syncControl(151e9138769f295e).(ctlCmds); |
| 75 | |
| 76 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(ctlCmds.commands().size() == 1); |
| 77 | auto &[path, value] = ctlCmds.commandscxx . . $ CommandQueueStub#commands(f070559094366392).().frontcxx . . $ std/vector#front(af0004c3ce7cab93).(); |
| 78 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(path == "path"); |
| 79 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(value == "2"); // 2 == automatic |
| 80 | } |
| 81 | } |
| 82 | |
| 83 | } // namespace Tests::AMD::FanAuto |