| 1 | // SPDX-License-Identifier: GPL-3.0-or-latercxx . . $ `<file>/tests/src/test_cpuinfoproccpuinfo.cpp`/ |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #include <catch2/catch_all.hpp> |
| 5 | |
| 6 | #include "common/hwidtranslatorstub.h"cxx . . $ `<file>/tests/src/common/hwidtranslatorstub.h`/ |
| 7 | #include "common/vectorstringdatasourcestub.h"cxx . . $ `<file>/tests/src/common/vectorstringdatasourcestub.h`/ |
| 8 | #include "core/info/common/cpuinfoproccpuinfo.h"cxx . . $ `<file>/src/core/info/common/cpuinfoproccpuinfo.h`/ |
| 9 | |
| 10 | namespace Testscxx . . $ Tests/::CPUInfoProcCpuInfocxx . . $ Tests/CPUInfoProcCpuInfo/ { |
| 11 | |
| 12 | TEST_CASEcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:144:11`!("CPUInfoProcCpuInfo tests", "[Info][CPUInfo][CPUInfoProcCpuInfo]") |
| 13 | { |
| 14 | stdcxx . . $ std/::vectorcxx . . $ std/vector#<stdcxx . . $ std/::stringcxx . . $ std/string#> infoDatacxx . . $ std/vector#vector(9619226211e5a241).{"processor : 0"}; |
| 15 | |
| 16 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Returns empty info when there is no data") |
| 17 | { |
| 18 | infoData.clearcxx . . $ std/vector#clear(ced63f7c635d850d).(); |
| 19 | |
| 20 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 21 | "/proc/cpuinfo", infoData, false)); |
| 22 | |
| 23 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 24 | REQUIREcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:127:11`!(output.empty()); |
| 25 | } |
| 26 | |
| 27 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides execution units count") |
| 28 | { |
| 29 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 30 | "/proc/cpuinfo", infoData)); |
| 31 | |
| 32 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 33 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::executionUnitscxx . . $ ICPUInfo#Keys#executionUnits.), |
| 34 | stdcxx . . $ std/::stringcxx . . $ std/string#("1")); |
| 35 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 36 | } |
| 37 | |
| 38 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides vendor id") |
| 39 | { |
| 40 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("vendor_id : TheVendor"); |
| 41 | |
| 42 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 43 | "/proc/cpuinfo", infoData)); |
| 44 | |
| 45 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 46 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::vendorIdcxx . . $ ICPUInfo#Keys#vendorId.), |
| 47 | stdcxx . . $ std/::stringcxx . . $ std/string#("TheVendor")); |
| 48 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 49 | } |
| 50 | |
| 51 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides cpu family") |
| 52 | { |
| 53 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("cpu family : 128"); |
| 54 | |
| 55 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 56 | "/proc/cpuinfo", infoData)); |
| 57 | |
| 58 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 59 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::cpuFamilycxx . . $ ICPUInfo#Keys#cpuFamily.), |
| 60 | stdcxx . . $ std/::stringcxx . . $ std/string#("128")); |
| 61 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 62 | } |
| 63 | |
| 64 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides model") |
| 65 | { |
| 66 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("model : 8"); |
| 67 | |
| 68 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 69 | "/proc/cpuinfo", infoData)); |
| 70 | |
| 71 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 72 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::modelcxx . . $ ICPUInfo#Keys#model.), |
| 73 | stdcxx . . $ std/::stringcxx . . $ std/string#("8")); |
| 74 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 75 | } |
| 76 | |
| 77 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides model name") |
| 78 | { |
| 79 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("model name : Potato"); |
| 80 | |
| 81 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 82 | "/proc/cpuinfo", infoData)); |
| 83 | |
| 84 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 85 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::modelNamecxx . . $ ICPUInfo#Keys#modelName.), |
| 86 | stdcxx . . $ std/::stringcxx . . $ std/string#("Potato")); |
| 87 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 88 | } |
| 89 | |
| 90 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides stepping") |
| 91 | { |
| 92 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("stepping : 2"); |
| 93 | |
| 94 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 95 | "/proc/cpuinfo", infoData)); |
| 96 | |
| 97 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 98 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::steppingcxx . . $ ICPUInfo#Keys#stepping.), |
| 99 | stdcxx . . $ std/::stringcxx . . $ std/string#("2")); |
| 100 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 101 | } |
| 102 | |
| 103 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides microcode") |
| 104 | { |
| 105 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("microcode : 0x01"); |
| 106 | |
| 107 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 108 | "/proc/cpuinfo", infoData)); |
| 109 | |
| 110 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 111 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::ucodecxx . . $ ICPUInfo#Keys#ucode.), |
| 112 | stdcxx . . $ std/::stringcxx . . $ std/string#("0x01")); |
| 113 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 114 | } |
| 115 | |
| 116 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides L3 cache size") |
| 117 | { |
| 118 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("cache size : 8192 KB"); |
| 119 | |
| 120 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 121 | "/proc/cpuinfo", infoData)); |
| 122 | |
| 123 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 124 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::l3Cachecxx . . $ ICPUInfo#Keys#l3Cache.), |
| 125 | stdcxx . . $ std/::stringcxx . . $ std/string#("8192 KB")); |
| 126 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 127 | } |
| 128 | |
| 129 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides cores count") |
| 130 | { |
| 131 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("cpu cores : 64"); |
| 132 | |
| 133 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 134 | "/proc/cpuinfo", infoData)); |
| 135 | |
| 136 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 137 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::corescxx . . $ ICPUInfo#Keys#cores.), |
| 138 | stdcxx . . $ std/::stringcxx . . $ std/string#("64")); |
| 139 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 140 | } |
| 141 | |
| 142 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides flags") |
| 143 | { |
| 144 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("flags : a lot"); |
| 145 | |
| 146 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 147 | "/proc/cpuinfo", infoData)); |
| 148 | |
| 149 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 150 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::flagscxx . . $ ICPUInfo#Keys#flags.), |
| 151 | stdcxx . . $ std/::stringcxx . . $ std/string#("a lot")); |
| 152 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 153 | } |
| 154 | |
| 155 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides bugs") |
| 156 | { |
| 157 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("bugs : yes"); |
| 158 | |
| 159 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 160 | "/proc/cpuinfo", infoData)); |
| 161 | |
| 162 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 163 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::bugscxx . . $ ICPUInfo#Keys#bugs.), |
| 164 | stdcxx . . $ std/::stringcxx . . $ std/string#("yes")); |
| 165 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 166 | } |
| 167 | |
| 168 | SECTIONcxx . . $ `<external>/1821973855936310166/catch_test_macros.hpp:149:11`!("Provides bogomips") |
| 169 | { |
| 170 | infoData.emplace_backcxx . . $ std/vector#emplace_back(a1bcdfdabc3a37df).("bogomips : 20.45"); |
| 171 | |
| 172 | ::CPUInfoProcCpuInfocxx . . $ CPUInfoProcCpuInfo# tscxx . . $ CPUInfoProcCpuInfo#CPUInfoProcCpuInfo(2fc9eef85304919b).(stdcxx . . $ std/unique_ptr#unique_ptr(8bcafd3b0b660df8).::make_uniquecxx . . $ std/make_unique(5cd499e8540a10bb).<VectorStringDataSourceStubcxx . . $ VectorStringDataSourceStub#>( |
| 173 | "/proc/cpuinfo", infoData)); |
| 174 | |
| 175 | auto output = ts.provideInfocxx . . $ CPUInfoProcCpuInfo#provideInfo(ba0be1eb8c175b81).(0, {cxx . . $ std/vector#vector(9619226211e5a241).{0, 0, "/cpu0"}}); |
| 176 | auto data = stdcxx . . $ std/::make_paircxx . . $ std/make_pair(1d30b6e115203116).(stdcxx . . $ std/::stringcxx . . $ std/string#(::ICPUInfocxx . . $ ICPUInfo#::Keyscxx . . $ ICPUInfo#Keys#::bogomipscxx . . $ ICPUInfo#Keys#bogomips.), |
| 177 | stdcxx . . $ std/::stringcxx . . $ std/string#("20.45")); |
| 178 | REQUIRE_THATcxx . . $ `<external>/3333208929440565380/catch_matchers.hpp:222:11`!(output, Catch::Matchers::VectorContains(data)); |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | } // namespace Tests::CPUInfoProcCpuInfo |