diff --git a/level_zero/core/test/unit_tests/main.cpp b/level_zero/core/test/unit_tests/main.cpp index ea3607cbc7..1f1ec0b9b8 100644 --- a/level_zero/core/test/unit_tests/main.cpp +++ b/level_zero/core/test/unit_tests/main.cpp @@ -21,6 +21,7 @@ #include "shared/test/common/mocks/mock_gmm_client_context.h" #include "shared/test/common/mocks/mock_sip.h" #include "shared/test/unit_test/base_ult_config_listener.h" +#include "shared/test/unit_test/test_stats.h" #include "level_zero/core/source/cmdlist/cmdlist.h" #include "level_zero/core/source/compiler_interface/l0_reg_path.h" @@ -146,6 +147,7 @@ void applyWorkarounds() { int main(int argc, char **argv) { bool useDefaultListener = false; bool setupFeatureTableAndWorkaroundTable = testMode == TestMode::AubTests ? true : false; + bool showTestStats = false; applyWorkarounds(); testing::InitGoogleMock(&argc, argv); @@ -230,9 +232,16 @@ int main(int argc, char **argv) { } } else if (!strcmp("--enable_default_listener", argv[i])) { useDefaultListener = true; + } else if (!strcmp("--show_test_stats", argv[i])) { + showTestStats = true; } } + if (showTestStats) { + std::cout << getTestStats() << std::endl; + return 0; + } + productFamily = hwInfoForTests.platform.eProductFamily; renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily; uint32_t threadsPerEu = hwInfoConfigFactory[productFamily]->threadsPerEu; diff --git a/opencl/test/unit_test/main.cpp b/opencl/test/unit_test/main.cpp index 2985dd5015..07354905a7 100644 --- a/opencl/test/unit_test/main.cpp +++ b/opencl/test/unit_test/main.cpp @@ -22,6 +22,7 @@ #include "shared/test/common/mocks/mock_gmm_client_context.h" #include "shared/test/common/mocks/mock_sip.h" #include "shared/test/common/test_macros/test_checks_shared.h" +#include "shared/test/unit_test/test_stats.h" #include "shared/test/unit_test/tests_configuration.h" #include "opencl/source/os_interface/ocl_reg_path.h" @@ -195,7 +196,7 @@ int main(int argc, char **argv) { bool enable_alarm = true; bool enable_abrt = true; bool setupFeatureTableAndWorkaroundTable = testMode == TestMode::AubTests ? true : false; - + bool showTestStats = false; applyWorkarounds(); #if defined(__linux__) @@ -242,6 +243,8 @@ int main(int argc, char **argv) { useDefaultListener = true; } else if (!strcmp("--disable_alarm", argv[i])) { enable_alarm = false; + } else if (!strcmp("--show_test_stats", argv[i])) { + showTestStats = true; } else if (!strcmp("--disable_pagefaulting_tests", argv[i])) { //disable tests which raise page fault signal during execution NEO::PagaFaultManagerTestConfig::disabled = true; } else if (!strcmp("--tbx", argv[i])) { @@ -323,6 +326,11 @@ int main(int argc, char **argv) { } } + if (showTestStats) { + std::cout << getTestStats() << std::endl; + return 0; + } + productFamily = hwInfoForTests.platform.eProductFamily; renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily; uint32_t threadsPerEu = hwInfoConfigFactory[productFamily]->threadsPerEu; diff --git a/opencl/test/unit_test/offline_compiler/main.cpp b/opencl/test/unit_test/offline_compiler/main.cpp index 88cbc36e91..3ce63836f7 100644 --- a/opencl/test/unit_test/offline_compiler/main.cpp +++ b/opencl/test/unit_test/offline_compiler/main.cpp @@ -8,6 +8,7 @@ #include "shared/source/os_interface/os_library.h" #include "shared/test/common/helpers/custom_event_listener.h" #include "shared/test/common/helpers/test_files.h" +#include "shared/test/unit_test/test_stats.h" #include "environment.h" #include "limits.h" @@ -37,6 +38,8 @@ std::string getRunPath() { int main(int argc, char **argv) { int retVal = 0; bool useDefaultListener = false; + bool showTestStats = false; + std::string devicePrefix("skl"); std::string familyNameWithType("Gen9core"); std::string revId("0"); @@ -76,10 +79,17 @@ int main(int argc, char **argv) { } else if (strcmp("--rev_id", argv[i]) == 0) { ++i; revId = argv[i]; + } else if (!strcmp("--show_test_stats", argv[i])) { + showTestStats = true; } } } + if (showTestStats) { + std::cout << getTestStats() << std::endl; + return 0; + } + for (unsigned int productId = 0; productId < IGFX_MAX_PRODUCT; ++productId) { if (NEO::hardwarePrefix[productId] && (0 == strcmp(devicePrefix.c_str(), NEO::hardwarePrefix[productId]))) { if (NEO::hardwareInfoTable[productId]) { diff --git a/shared/test/unit_test/main.cpp b/shared/test/unit_test/main.cpp index c58ec57a54..f6e20eb992 100644 --- a/shared/test/unit_test/main.cpp +++ b/shared/test/unit_test/main.cpp @@ -24,6 +24,7 @@ #include "shared/test/common/mocks/mock_sip.h" #include "shared/test/common/test_macros/test_checks_shared.h" #include "shared/test/unit_test/base_ult_config_listener.h" +#include "shared/test/unit_test/test_stats.h" #include "shared/test/unit_test/tests_configuration.h" #include "gmock/gmock.h" @@ -180,7 +181,7 @@ int main(int argc, char **argv) { bool useDefaultListener = false; bool enable_alarm = true; bool setupFeatureTableAndWorkaroundTable = testMode == TestMode::AubTests ? true : false; - + bool showTestStats = false; applyWorkarounds(); #if defined(__linux__) @@ -220,6 +221,8 @@ int main(int argc, char **argv) { useDefaultListener = true; } else if (!strcmp("--disable_alarm", argv[i])) { enable_alarm = false; + } else if (!strcmp("--show_test_stats", argv[i])) { + showTestStats = true; } else if (!strcmp("--disable_pagefaulting_tests", argv[i])) { //disable tests which raise page fault signal during execution NEO::PagaFaultManagerTestConfig::disabled = true; } else if (!strcmp("--tbx", argv[i])) { @@ -301,6 +304,11 @@ int main(int argc, char **argv) { } } + if (showTestStats) { + std::cout << getTestStats() << std::endl; + return 0; + } + productFamily = hwInfoForTests.platform.eProductFamily; renderCoreFamily = hwInfoForTests.platform.eRenderCoreFamily; uint32_t threadsPerEu = hwInfoConfigFactory[productFamily]->threadsPerEu; diff --git a/shared/test/unit_test/test_stats.h b/shared/test/unit_test/test_stats.h new file mode 100644 index 0000000000..9cea2f2b84 --- /dev/null +++ b/shared/test/unit_test/test_stats.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2021 Intel Corporation + * + * SPDX-License-Identifier: MIT + * + */ + +#pragma once +#include "gmock/gmock.h" + +#include +#include + +std::string getTestStats() { + std::string output; + std::stringstream stream; + + stream << "Total test count: " << ::testing::UnitTest::GetInstance()->total_test_count() << std::endl; + stream << "Test to run count: " << ::testing::UnitTest::GetInstance()->test_to_run_count() << std::endl; + stream << "Reportable test count: " << ::testing::UnitTest::GetInstance()->reportable_test_count() << std::endl; + stream << "Disabled test count: " << ::testing::UnitTest::GetInstance()->disabled_test_count() << std::endl; + stream << "Reportable disabled test count: " << ::testing::UnitTest::GetInstance()->reportable_disabled_test_count() << std::endl; + + return stream.str(); +}