Add alarmTime to ULTs
Signed-off-by: Baj, Tomasz <tomasz.baj@intel.com> Related-To: NEO-6413
This commit is contained in:
parent
498cf5e871
commit
7daee00df4
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2020-2021 Intel Corporation
|
||||
* Copyright (C) 2020-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include "shared/test/common/helpers/test_files.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.inl"
|
||||
#include "shared/test/common/libult/global_environment.h"
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
#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"
|
||||
|
@ -64,7 +65,6 @@ extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
|||
extern bool useMockGmm;
|
||||
extern TestMode testMode;
|
||||
extern const char *executionDirectorySuffix;
|
||||
extern const unsigned int ultIterationMaxTime;
|
||||
|
||||
namespace MockSipData {
|
||||
extern std::unique_ptr<MockSipKernel> mockSipKernel;
|
||||
|
@ -141,13 +141,6 @@ void applyWorkarounds() {
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
void handle_SIGALRM(int signal) {
|
||||
std::cout << "Tests timeout on: " << lastTest << std::endl;
|
||||
abort();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool checkAubTestsExecutionPathValidity() {
|
||||
bool valid = true;
|
||||
if ((testMode == TestMode::AubTests || testMode == TestMode::AubTestsWithTbx)) {
|
||||
|
@ -390,31 +383,9 @@ int main(int argc, char **argv) {
|
|||
|
||||
environment->setDefaultDebugVars(fclDebugVars, igcDebugVars, hwInfoForTests);
|
||||
|
||||
#if defined(__linux__)
|
||||
std::cout << "enable SIGALRM handler: " << enableAlarm << std::endl;
|
||||
|
||||
//ULTs timeout
|
||||
if (enableAlarm) {
|
||||
auto currentUltIterationMaxTime = NEO::ultIterationMaxTime;
|
||||
auto ultIterationMaxTimeEnv = getenv("NEO_ULT_ITERATION_MAX_TIME");
|
||||
if (ultIterationMaxTimeEnv != nullptr) {
|
||||
currentUltIterationMaxTime = atoi(ultIterationMaxTimeEnv);
|
||||
}
|
||||
unsigned int alarmTime = currentUltIterationMaxTime * ::testing::GTEST_FLAG(repeat);
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = &handle_SIGALRM;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigfillset(&sa.sa_mask);
|
||||
if (sigaction(SIGALRM, &sa, NULL) == -1) {
|
||||
printf("FATAL ERROR: cannot intercept SIGALRM\n");
|
||||
return -2;
|
||||
}
|
||||
alarm(alarmTime);
|
||||
std::cout << "set timeout to: " << alarmTime << std::endl;
|
||||
}
|
||||
|
||||
#endif
|
||||
int sigOut = setAlarm(enableAlarm);
|
||||
if (sigOut != 0)
|
||||
return sigOut;
|
||||
|
||||
auto retVal = RUN_ALL_TESTS();
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "shared/test/common/helpers/default_hw_info.inl"
|
||||
#include "shared/test/common/helpers/ult_hw_config.inl"
|
||||
#include "shared/test/common/helpers/variable_backup.h"
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
#include "shared/test/common/mocks/mock_execution_environment.h"
|
||||
#include "shared/test/common/os_interface/linux/device_command_stream_fixture.h"
|
||||
#include "shared/test/common/test_macros/test.h"
|
||||
|
@ -781,6 +782,7 @@ TEST(SysCalls, WhenSysCallsFstatCalledThenCallIsRedirectedToOs) {
|
|||
|
||||
int main(int argc, char **argv) {
|
||||
bool useDefaultListener = false;
|
||||
bool enableAlarm = true;
|
||||
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
|
||||
|
@ -790,6 +792,8 @@ int main(int argc, char **argv) {
|
|||
useDefaultListener = false;
|
||||
} else if (!strcmp("--enable_default_listener", argv[i])) {
|
||||
useDefaultListener = true;
|
||||
} else if (!strcmp("--disable_alarm", argv[i])) {
|
||||
enableAlarm = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -808,6 +812,11 @@ int main(int argc, char **argv) {
|
|||
initializeTestedDevice();
|
||||
|
||||
Os::dxcoreDllName = "";
|
||||
|
||||
int sigOut = setAlarm(enableAlarm);
|
||||
if (sigOut != 0)
|
||||
return sigOut;
|
||||
|
||||
auto retVal = RUN_ALL_TESTS();
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include "shared/test/common/helpers/test_files.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.inl"
|
||||
#include "shared/test/common/libult/global_environment.h"
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
||||
#include "shared/test/common/mocks/mock_sip.h"
|
||||
|
@ -50,7 +51,6 @@ extern const char *hardwarePrefix[];
|
|||
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
||||
extern const char *executionName;
|
||||
|
||||
extern const unsigned int ultIterationMaxTime;
|
||||
extern bool useMockGmm;
|
||||
extern TestMode testMode;
|
||||
extern const char *executionDirectorySuffix;
|
||||
|
@ -118,10 +118,6 @@ void applyWorkarounds() {
|
|||
}
|
||||
}
|
||||
#ifdef __linux__
|
||||
void handle_SIGALRM(int signal) {
|
||||
std::cout << "Tests timeout on: " << lastTest << std::endl;
|
||||
abort();
|
||||
}
|
||||
void handle_SIGSEGV(int signal) {
|
||||
std::cout << "SIGSEGV on: " << lastTest << std::endl;
|
||||
abort();
|
||||
|
@ -193,7 +189,7 @@ std::string getRunPath(char *argv0) {
|
|||
int main(int argc, char **argv) {
|
||||
int retVal = 0;
|
||||
bool useDefaultListener = false;
|
||||
bool enable_alarm = true;
|
||||
bool enableAlarm = true;
|
||||
bool enable_abrt = true;
|
||||
bool setupFeatureTableAndWorkaroundTable = testMode == TestMode::AubTests ? true : false;
|
||||
bool showTestStats = false;
|
||||
|
@ -223,7 +219,7 @@ int main(int argc, char **argv) {
|
|||
std::string envVar = std::string("NEO_") + executionName + "_DISABLE_TEST_ALARM";
|
||||
char *envValue = getenv(envVar.c_str());
|
||||
if (envValue != nullptr) {
|
||||
enable_alarm = false;
|
||||
enableAlarm = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -242,7 +238,7 @@ int main(int argc, char **argv) {
|
|||
} else if (!strcmp("--enable_default_listener", argv[i])) {
|
||||
useDefaultListener = true;
|
||||
} else if (!strcmp("--disable_alarm", argv[i])) {
|
||||
enable_alarm = false;
|
||||
enableAlarm = 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
|
||||
|
@ -433,32 +429,14 @@ int main(int argc, char **argv) {
|
|||
gEnvironment->setMockFileNames(fclDebugVars.fileName, igcDebugVars.fileName);
|
||||
gEnvironment->setDefaultDebugVars(fclDebugVars, igcDebugVars, hwInfoForTests);
|
||||
|
||||
int sigOut = setAlarm(enableAlarm);
|
||||
if (sigOut != 0)
|
||||
return sigOut;
|
||||
|
||||
#if defined(__linux__)
|
||||
std::cout << "enable SIGALRM handler: " << enable_alarm << std::endl;
|
||||
std::cout << "enable SIGSEGV handler: " << enable_segv << std::endl;
|
||||
std::cout << "enable SIGABRT handler: " << enable_abrt << std::endl;
|
||||
|
||||
//ULTs timeout
|
||||
if (enable_alarm) {
|
||||
auto currentUltIterationMaxTime = NEO::ultIterationMaxTime;
|
||||
auto ultIterationMaxTimeEnv = getenv("NEO_ULT_ITERATION_MAX_TIME");
|
||||
if (ultIterationMaxTimeEnv != nullptr) {
|
||||
currentUltIterationMaxTime = atoi(ultIterationMaxTimeEnv);
|
||||
}
|
||||
unsigned int alarmTime = currentUltIterationMaxTime * ::testing::GTEST_FLAG(repeat);
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = &handle_SIGALRM;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigfillset(&sa.sa_mask);
|
||||
if (sigaction(SIGALRM, &sa, NULL) == -1) {
|
||||
printf("FATAL ERROR: cannot intercept SIGALRM\n");
|
||||
return -2;
|
||||
}
|
||||
alarm(alarmTime);
|
||||
std::cout << "set timeout to: " << alarmTime << std::endl;
|
||||
}
|
||||
|
||||
if (enable_segv) {
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = &handle_SIGSEGV;
|
||||
|
|
|
@ -70,6 +70,7 @@ set(IGDRCL_SRCS_offline_compiler_tests
|
|||
${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_compilers.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/unit_test/device_binary_format/zebin_tests.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/helpers/test_files.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/signal_utils.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/test_macros/test_excludes.cpp
|
||||
${IGDRCL_SRCS_cloc}
|
||||
${IGDRCL_SRCS_offline_compiler_mock}
|
||||
|
@ -81,11 +82,13 @@ set(IGDRCL_SRCS_offline_compiler_tests
|
|||
if(WIN32)
|
||||
list(APPEND IGDRCL_SRCS_offline_compiler_tests
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/os_thread_win.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/signal_utils.cpp
|
||||
)
|
||||
else()
|
||||
list(APPEND IGDRCL_SRCS_offline_compiler_tests
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/os_thread_linux.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/sys_calls_linux.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/signal_utils.cpp
|
||||
${OCLOC_DIRECTORY}/source/linux/os_library_ocloc_helper.cpp
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -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/common/libult/signal_utils.h"
|
||||
#include "shared/test/unit_test/test_stats.h"
|
||||
|
||||
#include "environment.h"
|
||||
|
@ -39,6 +40,7 @@ std::string getRunPath() {
|
|||
int main(int argc, char **argv) {
|
||||
int retVal = 0;
|
||||
bool useDefaultListener = false;
|
||||
bool enableAlarm = true;
|
||||
bool showTestStats = false;
|
||||
|
||||
std::string devicePrefix("skl");
|
||||
|
@ -71,6 +73,8 @@ int main(int argc, char **argv) {
|
|||
for (int i = 0; i < argc; i++) {
|
||||
if (strcmp("--use_default_listener", argv[i]) == 0) {
|
||||
useDefaultListener = true;
|
||||
} else if (!strcmp("--disable_alarm", argv[i])) {
|
||||
enableAlarm = false;
|
||||
} else if (strcmp("--device", argv[i]) == 0) {
|
||||
++i;
|
||||
devicePrefix = argv[i];
|
||||
|
@ -138,6 +142,10 @@ int main(int argc, char **argv) {
|
|||
|
||||
gEnvironment = reinterpret_cast<Environment *>(::testing::AddGlobalTestEnvironment(new Environment(devicePrefix, familyNameWithType)));
|
||||
|
||||
int sigOut = setAlarm(enableAlarm);
|
||||
if (sigOut != 0)
|
||||
return sigOut;
|
||||
|
||||
retVal = RUN_ALL_TESTS();
|
||||
|
||||
return retVal;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Intel Corporation
|
||||
* Copyright (C) 2021-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
namespace NEO {
|
||||
unsigned int ultIterationMaxTime = 45;
|
||||
const char *executionName = "OCLOC";
|
||||
} // namespace NEO
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (C) 2018-2021 Intel Corporation
|
||||
# Copyright (C) 2018-2022 Intel Corporation
|
||||
#
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
@ -10,7 +10,9 @@ set(CLOC_SEGFAULT_TEST_SOURCES
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
|
||||
${NEO_SHARED_DIRECTORY}/helpers/abort.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/os_library.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/signal_utils.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/unit_test/helpers/debug_helpers.cpp
|
||||
${NEO_SOURCE_DIR}/opencl/test/unit_test/offline_compiler/ocloc_tests_configuration.cpp
|
||||
)
|
||||
|
||||
if(WIN32)
|
||||
|
@ -18,6 +20,7 @@ if(WIN32)
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/windows/safety_guard_caller_windows.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/os_library_win.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/windows/os_library_win.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/signal_utils.cpp
|
||||
${OCLOC_DIRECTORY}/source/utilities/windows/safety_guard_windows.h
|
||||
${OCLOC_DIRECTORY}/source/utilities/windows/seh_exception.cpp
|
||||
${OCLOC_DIRECTORY}/source/utilities/windows/seh_exception.h
|
||||
|
@ -28,6 +31,7 @@ else()
|
|||
${NEO_SHARED_DIRECTORY}/os_interface/linux/os_library_linux.cpp
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/os_library_linux.h
|
||||
${NEO_SHARED_DIRECTORY}/os_interface/linux/sys_calls_linux.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/signal_utils.cpp
|
||||
${OCLOC_DIRECTORY}/source/linux/os_library_ocloc_helper.cpp
|
||||
)
|
||||
endif()
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2020 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
|
||||
#include "gmock/gmock.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include "segfault_helper.h"
|
||||
|
@ -15,7 +17,18 @@ extern void generateSegfaultWithSafetyGuard(SegfaultHelper *segfaultHelper);
|
|||
|
||||
int main(int argc, char **argv) {
|
||||
int retVal = 0;
|
||||
bool enableAlarm = true;
|
||||
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (!strcmp("--disable_alarm", argv[i])) {
|
||||
enableAlarm = false;
|
||||
}
|
||||
}
|
||||
|
||||
int sigOut = setAlarm(enableAlarm);
|
||||
if (sigOut != 0)
|
||||
return sigOut;
|
||||
|
||||
retVal = RUN_ALL_TESTS();
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -15,7 +15,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
std::string lastTest("");
|
||||
extern std::string lastTest;
|
||||
namespace NEO {
|
||||
extern const char *executionName;
|
||||
}
|
||||
|
|
|
@ -99,6 +99,7 @@ set(neo_libult_common_SRCS_LIB_ULT
|
|||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/source_level_debugger_library.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/source_level_debugger_library.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/source_level_debugger_ult.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/signal_utils.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/ult_aub_command_stream_receiver.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/libult/ult_command_stream_receiver.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/mocks/mock_memory_manager.cpp
|
||||
|
@ -139,6 +140,7 @@ set(neo_libult_common_SRCS_LIB_ULT_WIN
|
|||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxcore_factory.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxgi_factory.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/ult_dxgi_factory.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/windows/signal_utils.cpp
|
||||
)
|
||||
set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT_WIN ${neo_libult_common_SRCS_LIB_ULT_WIN})
|
||||
|
||||
|
@ -147,6 +149,7 @@ set(neo_libult_common_SRCS_LIB_ULT_LINUX
|
|||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/device_command_stream_fixture.cpp
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/device_command_stream_fixture.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/drm_buffer_object_fixture.h
|
||||
${NEO_SHARED_TEST_DIRECTORY}/common/os_interface/linux/signal_utils.cpp
|
||||
)
|
||||
set_property(GLOBAL PROPERTY neo_libult_common_SRCS_LIB_ULT_LINUX ${neo_libult_common_SRCS_LIB_ULT_LINUX})
|
||||
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
int setAlarm(bool enableAlarm);
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
std::string lastTest("");
|
||||
|
||||
namespace NEO {
|
||||
extern const unsigned int ultIterationMaxTime;
|
||||
}
|
||||
|
||||
void handleSIGALRM(int signal) {
|
||||
std::cout << "Tests timeout on: " << lastTest << std::endl;
|
||||
abort();
|
||||
}
|
||||
|
||||
int setAlarm(bool enableAlarm) {
|
||||
std::cout << "enable SIGALRM handler: " << enableAlarm << std::endl;
|
||||
if (enableAlarm) {
|
||||
auto currentUltIterationMaxTime = NEO::ultIterationMaxTime;
|
||||
auto ultIterationMaxTimeEnv = getenv("NEO_ULT_ITERATION_MAX_TIME");
|
||||
if (ultIterationMaxTimeEnv != nullptr) {
|
||||
currentUltIterationMaxTime = atoi(ultIterationMaxTimeEnv);
|
||||
}
|
||||
unsigned int alarmTime = currentUltIterationMaxTime * ::testing::GTEST_FLAG(repeat);
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = &handleSIGALRM;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigfillset(&sa.sa_mask);
|
||||
if (sigaction(SIGALRM, &sa, NULL) == -1) {
|
||||
std::cout << "FATAL ERROR: cannot intercept SIGALRM" << std::endl;
|
||||
return -2;
|
||||
}
|
||||
alarm(alarmTime);
|
||||
std::cout << "set timeout to: " << alarmTime << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
std::string lastTest("");
|
||||
|
||||
int setAlarm(bool enableAlarm) {
|
||||
return 0;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2018-2021 Intel Corporation
|
||||
* Copyright (C) 2018-2022 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
@ -19,6 +19,7 @@
|
|||
#include "shared/test/common/helpers/test_files.h"
|
||||
#include "shared/test/common/helpers/ult_hw_config.inl"
|
||||
#include "shared/test/common/libult/global_environment.h"
|
||||
#include "shared/test/common/libult/signal_utils.h"
|
||||
#include "shared/test/common/mocks/mock_gmm.h"
|
||||
#include "shared/test/common/mocks/mock_gmm_client_context.h"
|
||||
#include "shared/test/common/mocks/mock_sip.h"
|
||||
|
@ -48,7 +49,6 @@ namespace NEO {
|
|||
extern const char *hardwarePrefix[];
|
||||
extern const HardwareInfo *hardwareInfoTable[IGFX_MAX_PRODUCT];
|
||||
|
||||
extern const unsigned int ultIterationMaxTime;
|
||||
extern bool useMockGmm;
|
||||
extern TestMode testMode;
|
||||
extern const char *executionDirectorySuffix;
|
||||
|
@ -68,8 +68,6 @@ using namespace NEO;
|
|||
|
||||
extern PRODUCT_FAMILY productFamily;
|
||||
extern GFXCORE_FAMILY renderCoreFamily;
|
||||
|
||||
extern std::string lastTest;
|
||||
bool generateRandomInput = false;
|
||||
|
||||
void applyWorkarounds() {
|
||||
|
@ -118,10 +116,6 @@ void applyWorkarounds() {
|
|||
}
|
||||
}
|
||||
#ifdef __linux__
|
||||
void handle_SIGALRM(int signal) {
|
||||
std::cout << "Tests timeout on: " << lastTest << std::endl;
|
||||
abort();
|
||||
}
|
||||
void handle_SIGSEGV(int signal) {
|
||||
std::cout << "SIGSEGV on: " << lastTest << std::endl;
|
||||
abort();
|
||||
|
@ -179,7 +173,7 @@ std::string getRunPath(char *argv0) {
|
|||
int main(int argc, char **argv) {
|
||||
int retVal = 0;
|
||||
bool useDefaultListener = false;
|
||||
bool enable_alarm = true;
|
||||
bool enableAlarm = true;
|
||||
bool setupFeatureTableAndWorkaroundTable = testMode == TestMode::AubTests ? true : false;
|
||||
bool showTestStats = false;
|
||||
applyWorkarounds();
|
||||
|
@ -220,7 +214,7 @@ int main(int argc, char **argv) {
|
|||
} else if (!strcmp("--enable_default_listener", argv[i])) {
|
||||
useDefaultListener = true;
|
||||
} else if (!strcmp("--disable_alarm", argv[i])) {
|
||||
enable_alarm = false;
|
||||
enableAlarm = 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
|
||||
|
@ -403,28 +397,11 @@ int main(int argc, char **argv) {
|
|||
gEnvironment->setMockFileNames(fclDebugVars.fileName, igcDebugVars.fileName);
|
||||
gEnvironment->setDefaultDebugVars(fclDebugVars, igcDebugVars, hwInfoForTests);
|
||||
|
||||
int sigOut = setAlarm(enableAlarm);
|
||||
if (sigOut != 0)
|
||||
return sigOut;
|
||||
|
||||
#if defined(__linux__)
|
||||
//ULTs timeout
|
||||
if (enable_alarm) {
|
||||
auto currentUltIterationMaxTime = NEO::ultIterationMaxTime;
|
||||
auto ultIterationMaxTimeEnv = getenv("NEO_ULT_ITERATION_MAX_TIME");
|
||||
if (ultIterationMaxTimeEnv != nullptr) {
|
||||
currentUltIterationMaxTime = atoi(ultIterationMaxTimeEnv);
|
||||
}
|
||||
unsigned int alarmTime = currentUltIterationMaxTime * ::testing::GTEST_FLAG(repeat);
|
||||
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = &handle_SIGALRM;
|
||||
sa.sa_flags = SA_RESTART;
|
||||
sigfillset(&sa.sa_mask);
|
||||
if (sigaction(SIGALRM, &sa, NULL) == -1) {
|
||||
printf("FATAL ERROR: cannot intercept SIGALRM\n");
|
||||
return -2;
|
||||
}
|
||||
alarm(alarmTime);
|
||||
std::cout << "set timeout to: " << alarmTime << std::endl;
|
||||
}
|
||||
|
||||
if (enable_segv) {
|
||||
struct sigaction sa;
|
||||
sa.sa_handler = &handle_SIGSEGV;
|
||||
|
|
Loading…
Reference in New Issue