From 57b37b6b7910baf396cc378f37a84f05fc09a5ad Mon Sep 17 00:00:00 2001 From: Jamie Madill Date: Wed, 25 Sep 2019 18:29:28 -0400 Subject: [PATCH] Rename util/system_utils to util/test_utils. This removes a GN naming conflict between util/system_utils and common/system_utils. This conflict was preventing us from adding unit tests to utils' version of system_utils. Since these functions are only useful to tests and samples rename them test_utils for simplicity. Will enable further development of ANGLE's standalone testing harness. Bug: angleproject:3162 Change-Id: I9e34fb69f96c5de6dc2453fce4148a0f285e15ed Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1825268 Reviewed-by: Jonah Ryan-Davis Reviewed-by: Yuly Novikov Commit-Queue: Jamie Madill --- samples/WindowTest/WindowTest.cpp | 2 +- samples/gles1/DrawTexture.cpp | 2 +- samples/multi_texture/MultiTexture.cpp | 2 +- .../MultipleDrawBuffers.cpp | 2 +- samples/particle_system/ParticleSystem.cpp | 3 ++- samples/sample_util/SampleApplication.cpp | 2 +- samples/sample_util/SampleApplication.h | 1 + src/tests/deqp_support/angle_deqp_gtest.cpp | 3 ++- .../angle_deqp_libtester_main.cpp | 2 +- src/tests/deqp_support/tcuANGLEPlatform.cpp | 2 +- .../egl_tests/EGLDirectCompositionTest.cpp | 1 + src/tests/gl_tests/IndexBufferOffsetTest.cpp | 2 +- src/tests/gl_tests/OcclusionQueriesTest.cpp | 2 +- .../gl_tests/ParallelShaderCompileTest.cpp | 5 ++-- src/tests/gl_tests/TimerQueriesTest.cpp | 2 +- src/tests/perf_tests/ANGLEPerfTest.cpp | 3 ++- src/tests/perf_tests/EGLMakeCurrentPerf.cpp | 2 +- src/tests/perf_tests/glmark2Benchmark.cpp | 1 + src/tests/test_utils/ANGLETest.cpp | 1 + src/tests/test_utils/ANGLETest.h | 2 +- .../test_utils/angle_test_instantiate.cpp | 3 ++- util/EGLWindow.cpp | 2 +- ...sh_handler.cpp => crash_handler_posix.cpp} | 4 ++-- ..._system_utils.cpp => test_utils_posix.cpp} | 14 +++++++---- util/{system_utils.h => test_utils.h} | 11 +++++---- util/util.gni | 24 +++++++++---------- util/windows/WGLWindow.cpp | 2 +- ...ws_system_utils.cpp => test_utils_win.cpp} | 7 +++--- ..._system_utils.cpp => test_utils_win32.cpp} | 4 ++-- util/x11/X11Window.cpp | 2 +- 30 files changed, 63 insertions(+), 52 deletions(-) rename util/posix/{Posix_crash_handler.cpp => crash_handler_posix.cpp} (98%) rename util/posix/{Posix_system_utils.cpp => test_utils_posix.cpp} (90%) rename util/{system_utils.h => test_utils.h} (82%) rename util/windows/{Windows_system_utils.cpp => test_utils_win.cpp} (96%) rename util/windows/win32/{Win32_system_utils.cpp => test_utils_win32.cpp} (86%) diff --git a/samples/WindowTest/WindowTest.cpp b/samples/WindowTest/WindowTest.cpp index f7baedd8b..45d7735a8 100644 --- a/samples/WindowTest/WindowTest.cpp +++ b/samples/WindowTest/WindowTest.cpp @@ -10,7 +10,7 @@ #include #include "util/OSWindow.h" -#include "util/system_utils.h" +#include "util/test_utils.h" int main(int argc, char *argv[]) { diff --git a/samples/gles1/DrawTexture.cpp b/samples/gles1/DrawTexture.cpp index aa062b6a6..492fb6230 100644 --- a/samples/gles1/DrawTexture.cpp +++ b/samples/gles1/DrawTexture.cpp @@ -16,7 +16,7 @@ #include "SampleApplication.h" #include "texture_utils.h" #include "util/shader_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" #include #include diff --git a/samples/multi_texture/MultiTexture.cpp b/samples/multi_texture/MultiTexture.cpp index dc0e52772..49ac9f3dc 100644 --- a/samples/multi_texture/MultiTexture.cpp +++ b/samples/multi_texture/MultiTexture.cpp @@ -17,7 +17,7 @@ #include "tga_utils.h" #include "util/shader_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" class MultiTextureSample : public SampleApplication { diff --git a/samples/multiple_draw_buffers/MultipleDrawBuffers.cpp b/samples/multiple_draw_buffers/MultipleDrawBuffers.cpp index 9a95a7d2b..c1231c31b 100644 --- a/samples/multiple_draw_buffers/MultipleDrawBuffers.cpp +++ b/samples/multiple_draw_buffers/MultipleDrawBuffers.cpp @@ -17,7 +17,7 @@ #include "texture_utils.h" #include "util/shader_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" #include #include diff --git a/samples/particle_system/ParticleSystem.cpp b/samples/particle_system/ParticleSystem.cpp index a1a59d1c9..87c17d02e 100644 --- a/samples/particle_system/ParticleSystem.cpp +++ b/samples/particle_system/ParticleSystem.cpp @@ -19,11 +19,12 @@ #include "tga_utils.h" #include "util/random_utils.h" #include "util/shader_utils.h" -#include "util/system_utils.h" #define _USE_MATH_DEFINES #include +#include + using namespace angle; class ParticleSystemSample : public SampleApplication diff --git a/samples/sample_util/SampleApplication.cpp b/samples/sample_util/SampleApplication.cpp index 85062f688..1a5d29fc7 100644 --- a/samples/sample_util/SampleApplication.cpp +++ b/samples/sample_util/SampleApplication.cpp @@ -9,7 +9,7 @@ #include "util/EGLWindow.h" #include "util/gles_loader_autogen.h" #include "util/random_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" #include #include diff --git a/samples/sample_util/SampleApplication.h b/samples/sample_util/SampleApplication.h index 1b187a380..a8a8af328 100644 --- a/samples/sample_util/SampleApplication.h +++ b/samples/sample_util/SampleApplication.h @@ -12,6 +12,7 @@ #include #include +#include "common/system_utils.h" #include "util/EGLPlatformParameters.h" #include "util/OSWindow.h" #include "util/Timer.h" diff --git a/src/tests/deqp_support/angle_deqp_gtest.cpp b/src/tests/deqp_support/angle_deqp_gtest.cpp index 0333f65d9..e6e65efba 100644 --- a/src/tests/deqp_support/angle_deqp_gtest.cpp +++ b/src/tests/deqp_support/angle_deqp_gtest.cpp @@ -19,10 +19,11 @@ #include "common/debug.h" #include "common/platform.h" #include "common/string_utils.h" +#include "common/system_utils.h" #include "platform/Platform.h" #include "tests/test_expectations/GPUTestConfig.h" #include "tests/test_expectations/GPUTestExpectationsParser.h" -#include "util/system_utils.h" +#include "util/test_utils.h" namespace angle { diff --git a/src/tests/deqp_support/angle_deqp_libtester_main.cpp b/src/tests/deqp_support/angle_deqp_libtester_main.cpp index 6222eb00b..ea9f09bce 100644 --- a/src/tests/deqp_support/angle_deqp_libtester_main.cpp +++ b/src/tests/deqp_support/angle_deqp_libtester_main.cpp @@ -10,6 +10,7 @@ #include "angle_deqp_libtester.h" #include "common/angleutils.h" +#include "common/system_utils.h" #include "deMath.h" #include "deUniquePtr.hpp" #include "platform/Platform.h" @@ -20,7 +21,6 @@ #include "tcuRandomOrderExecutor.h" #include "tcuResource.hpp" #include "tcuTestLog.hpp" -#include "util/system_utils.h" tcu::Platform *CreateANGLEPlatform(angle::LogErrorFunc logErrorFunc); diff --git a/src/tests/deqp_support/tcuANGLEPlatform.cpp b/src/tests/deqp_support/tcuANGLEPlatform.cpp index 511c0473c..de381ee35 100644 --- a/src/tests/deqp_support/tcuANGLEPlatform.cpp +++ b/src/tests/deqp_support/tcuANGLEPlatform.cpp @@ -26,7 +26,7 @@ #include "egluGLContextFactory.hpp" #include "tcuANGLENativeDisplayFactory.h" #include "tcuNullContextFactory.hpp" -#include "util/system_utils.h" +#include "util/test_utils.h" static_assert(EGL_DONT_CARE == -1, "Unexpected value for EGL_DONT_CARE"); diff --git a/src/tests/egl_tests/EGLDirectCompositionTest.cpp b/src/tests/egl_tests/EGLDirectCompositionTest.cpp index 901643b4c..fc063028d 100644 --- a/src/tests/egl_tests/EGLDirectCompositionTest.cpp +++ b/src/tests/egl_tests/EGLDirectCompositionTest.cpp @@ -22,6 +22,7 @@ #include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h" #include "util/OSWindow.h" #include "util/com_utils.h" +#include "util/test_utils.h" using namespace angle; using namespace ABI::Windows::System; diff --git a/src/tests/gl_tests/IndexBufferOffsetTest.cpp b/src/tests/gl_tests/IndexBufferOffsetTest.cpp index bbe0eea93..f4fdece35 100644 --- a/src/tests/gl_tests/IndexBufferOffsetTest.cpp +++ b/src/tests/gl_tests/IndexBufferOffsetTest.cpp @@ -7,7 +7,7 @@ // IndexBufferOffsetTest.cpp: Test glDrawElements with an offset and an index buffer #include "test_utils/ANGLETest.h" -#include "util/system_utils.h" +#include "util/test_utils.h" using namespace angle; diff --git a/src/tests/gl_tests/OcclusionQueriesTest.cpp b/src/tests/gl_tests/OcclusionQueriesTest.cpp index 5b25fea15..3d2f9d5e3 100644 --- a/src/tests/gl_tests/OcclusionQueriesTest.cpp +++ b/src/tests/gl_tests/OcclusionQueriesTest.cpp @@ -7,7 +7,7 @@ #include "test_utils/ANGLETest.h" #include "util/EGLWindow.h" #include "util/random_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" using namespace angle; diff --git a/src/tests/gl_tests/ParallelShaderCompileTest.cpp b/src/tests/gl_tests/ParallelShaderCompileTest.cpp index 02936de21..8da54e7eb 100644 --- a/src/tests/gl_tests/ParallelShaderCompileTest.cpp +++ b/src/tests/gl_tests/ParallelShaderCompileTest.cpp @@ -10,6 +10,7 @@ #include "test_utils/gl_raii.h" #include "util/random_utils.h" +#include "util/test_utils.h" using namespace angle; @@ -157,7 +158,7 @@ class ParallelShaderCompileTest : public ANGLETest } ++i; } - Sleep(kPollInterval); + angle::Sleep(kPollInterval); } while (!linkTasks.empty()) @@ -174,7 +175,7 @@ class ParallelShaderCompileTest : public ANGLETest } ++i; } - Sleep(kPollInterval); + angle::Sleep(kPollInterval); } } }; diff --git a/src/tests/gl_tests/TimerQueriesTest.cpp b/src/tests/gl_tests/TimerQueriesTest.cpp index e9cb61366..8caeb647a 100644 --- a/src/tests/gl_tests/TimerQueriesTest.cpp +++ b/src/tests/gl_tests/TimerQueriesTest.cpp @@ -10,7 +10,7 @@ #include "test_utils/ANGLETest.h" #include "util/EGLWindow.h" #include "util/random_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" using namespace angle; diff --git a/src/tests/perf_tests/ANGLEPerfTest.cpp b/src/tests/perf_tests/ANGLEPerfTest.cpp index 3f9f850b1..a7e1ce8cd 100644 --- a/src/tests/perf_tests/ANGLEPerfTest.cpp +++ b/src/tests/perf_tests/ANGLEPerfTest.cpp @@ -11,10 +11,11 @@ #include "ANGLEPerfTestArgs.h" #include "common/platform.h" +#include "common/system_utils.h" #include "third_party/perf/perf_test.h" #include "third_party/trace_event/trace_event.h" #include "util/shader_utils.h" -#include "util/system_utils.h" +#include "util/test_utils.h" #include #include diff --git a/src/tests/perf_tests/EGLMakeCurrentPerf.cpp b/src/tests/perf_tests/EGLMakeCurrentPerf.cpp index 0e434f3de..f5115eebd 100644 --- a/src/tests/perf_tests/EGLMakeCurrentPerf.cpp +++ b/src/tests/perf_tests/EGLMakeCurrentPerf.cpp @@ -9,10 +9,10 @@ #include "ANGLEPerfTest.h" #include "common/platform.h" +#include "common/system_utils.h" #include "platform/Platform.h" #include "test_utils/angle_test_configs.h" #include "test_utils/angle_test_instantiate.h" -#include "util/system_utils.h" #define ITERATIONS 20 diff --git a/src/tests/perf_tests/glmark2Benchmark.cpp b/src/tests/perf_tests/glmark2Benchmark.cpp index 0aa8e10bd..2d5e46388 100644 --- a/src/tests/perf_tests/glmark2Benchmark.cpp +++ b/src/tests/perf_tests/glmark2Benchmark.cpp @@ -18,6 +18,7 @@ #include "common/system_utils.h" #include "test_utils/angle_test_configs.h" #include "test_utils/angle_test_instantiate.h" +#include "util/test_utils.h" using namespace angle; diff --git a/src/tests/test_utils/ANGLETest.cpp b/src/tests/test_utils/ANGLETest.cpp index eb0f9f1b8..993185b0f 100644 --- a/src/tests/test_utils/ANGLETest.cpp +++ b/src/tests/test_utils/ANGLETest.cpp @@ -13,6 +13,7 @@ #include "gpu_info_util/SystemInfo.h" #include "util/EGLWindow.h" #include "util/OSWindow.h" +#include "util/test_utils.h" #if defined(ANGLE_PLATFORM_WINDOWS) # include diff --git a/src/tests/test_utils/ANGLETest.h b/src/tests/test_utils/ANGLETest.h index 44cc2c161..6494bfea9 100644 --- a/src/tests/test_utils/ANGLETest.h +++ b/src/tests/test_utils/ANGLETest.h @@ -16,11 +16,11 @@ #include "angle_test_configs.h" #include "common/angleutils.h" +#include "common/system_utils.h" #include "common/vector_utils.h" #include "platform/Platform.h" #include "util/EGLWindow.h" #include "util/shader_utils.h" -#include "util/system_utils.h" #include "util/util_gl.h" namespace angle diff --git a/src/tests/test_utils/angle_test_instantiate.cpp b/src/tests/test_utils/angle_test_instantiate.cpp index 6add7b378..51950cf3b 100644 --- a/src/tests/test_utils/angle_test_instantiate.cpp +++ b/src/tests/test_utils/angle_test_instantiate.cpp @@ -14,11 +14,12 @@ #include "angle_gl.h" #include "common/platform.h" +#include "common/system_utils.h" #include "gpu_info_util/SystemInfo.h" #include "test_utils/angle_test_configs.h" #include "util/EGLWindow.h" #include "util/OSWindow.h" -#include "util/system_utils.h" +#include "util/test_utils.h" #if defined(ANGLE_PLATFORM_WINDOWS) # include diff --git a/util/EGLWindow.cpp b/util/EGLWindow.cpp index af1427f5f..3de779ff6 100644 --- a/util/EGLWindow.cpp +++ b/util/EGLWindow.cpp @@ -12,9 +12,9 @@ #include +#include "common/system_utils.h" #include "platform/Platform.h" #include "util/OSWindow.h" -#include "util/system_utils.h" // ConfigParameters implementation. ConfigParameters::ConfigParameters() diff --git a/util/posix/Posix_crash_handler.cpp b/util/posix/crash_handler_posix.cpp similarity index 98% rename from util/posix/Posix_crash_handler.cpp rename to util/posix/crash_handler_posix.cpp index 2a0b9f6b0..e40c4b551 100644 --- a/util/posix/Posix_crash_handler.cpp +++ b/util/posix/crash_handler_posix.cpp @@ -3,12 +3,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// system_utils_crash_handler: +// crash_handler_posix: // ANGLE's crash handling and stack walking code. Modified from Skia's: // https://github.com/google/skia/blob/master/tools/CrashHandler.cpp // -#include "util/system_utils.h" +#include "util/test_utils.h" #include "common/angleutils.h" diff --git a/util/posix/Posix_system_utils.cpp b/util/posix/test_utils_posix.cpp similarity index 90% rename from util/posix/Posix_system_utils.cpp rename to util/posix/test_utils_posix.cpp index 35708cfe8..9d6c82fd0 100644 --- a/util/posix/Posix_system_utils.cpp +++ b/util/posix/test_utils_posix.cpp @@ -4,24 +4,28 @@ // found in the LICENSE file. // -// Posix_system_utils.cpp: Implementation of OS-specific functions for Posix systems +// test_utils_posix.cpp: Implementation of OS-specific functions for Posix systems -#include "util/system_utils.h" +#include "util/test_utils.h" +#include #include #include #include +#include + +#include "common/platform.h" #if !defined(ANGLE_PLATFORM_FUCHSIA) # include # include +# include +# include +# include #endif -#include "common/platform.h" - namespace angle { - void Sleep(unsigned int milliseconds) { // On Windows Sleep(0) yields while it isn't guaranteed by Posix's sleep diff --git a/util/system_utils.h b/util/test_utils.h similarity index 82% rename from util/system_utils.h rename to util/test_utils.h index 3c40b57bf..6a4951d77 100644 --- a/util/system_utils.h +++ b/util/test_utils.h @@ -4,14 +4,14 @@ // found in the LICENSE file. // -// system_utils.h: declaration of OS-specific utility functions +// test_utils.h: declaration of OS-specific utility functions -#ifndef UTIL_SYSTEM_UTILS_H_ -#define UTIL_SYSTEM_UTILS_H_ +#ifndef UTIL_TEST_UTILS_H_ +#define UTIL_TEST_UTILS_H_ #include +#include -#include "common/system_utils.h" #include "util/util_export.h" namespace angle @@ -33,6 +33,7 @@ ANGLE_UTIL_EXPORT void TerminateCrashHandler(); // Print a stack back trace. ANGLE_UTIL_EXPORT void PrintStackBacktrace(); + } // namespace angle -#endif // UTIL_SYSTEM_UTILS_H_ +#endif // UTIL_TEST_UTILS_H_ diff --git a/util/util.gni b/util/util.gni index 240ff48a9..57ca57944 100644 --- a/util/util.gni +++ b/util/util.gni @@ -12,7 +12,7 @@ util_sources = [ "util/random_utils.h", "util/shader_utils.cpp", "util/shader_utils.h", - "util/system_utils.h", + "util/test_utils.h", "util/util_export.h", "util/util_gl.h", "util/Event.h", @@ -28,12 +28,12 @@ util_sources = [ ] util_win_sources = [ - "util/windows/win32/Win32_system_utils.cpp", + "util/windows/test_utils_win.cpp", + "util/windows/win32/test_utils_win32.cpp", "util/windows/win32/Win32Pixmap.cpp", "util/windows/win32/Win32Pixmap.h", "util/windows/win32/Win32Window.cpp", "util/windows/win32/Win32Window.h", - "util/windows/Windows_system_utils.cpp", "util/windows/WGLWindow.h", ] @@ -42,8 +42,8 @@ if (current_os != "winuwp") { } util_posix_sources = [ - "util/posix/Posix_crash_handler.cpp", - "util/posix/Posix_system_utils.cpp", + "util/posix/crash_handler_posix.cpp", + "util/posix/test_utils_posix.cpp", ] util_linux_sources = util_posix_sources @@ -66,14 +66,12 @@ util_ozone_sources = [ "util/ozone/OzoneWindow.h", ] -util_osx_sources = [ - "util/osx/OSXPixmap.mm", - "util/osx/OSXPixmap.h", - "util/osx/OSXWindow.mm", - "util/osx/OSXWindow.h", - "util/posix/Posix_crash_handler.cpp", - "util/posix/Posix_system_utils.cpp", -] +util_osx_sources = util_posix_sources + [ + "util/osx/OSXPixmap.mm", + "util/osx/OSXPixmap.h", + "util/osx/OSXWindow.mm", + "util/osx/OSXWindow.h", + ] util_android_sources = util_posix_sources + [ "util/android/AndroidPixmap.cpp", diff --git a/util/windows/WGLWindow.cpp b/util/windows/WGLWindow.cpp index bac587533..96c4d42df 100644 --- a/util/windows/WGLWindow.cpp +++ b/util/windows/WGLWindow.cpp @@ -10,8 +10,8 @@ #include "util/windows/WGLWindow.h" #include "common/string_utils.h" +#include "common/system_utils.h" #include "util/OSWindow.h" -#include "util/system_utils.h" #include diff --git a/util/windows/Windows_system_utils.cpp b/util/windows/test_utils_win.cpp similarity index 96% rename from util/windows/Windows_system_utils.cpp rename to util/windows/test_utils_win.cpp index ef882254f..05a44c842 100644 --- a/util/windows/Windows_system_utils.cpp +++ b/util/windows/test_utils_win.cpp @@ -4,15 +4,15 @@ // found in the LICENSE file. // -// Windows_system_utils.cpp: Implementation of OS-specific functions for Windows +// test_utils_win.cpp: Implementation of OS-specific functions for Windows -#include "util/system_utils.h" +#include "util/test_utils.h" #include #include #include -#include +#include "common/angleutils.h" #include "util/windows/third_party/StackWalker/src/StackWalker.h" namespace angle @@ -144,5 +144,4 @@ void PrintStackBacktrace() RtlCaptureContext(&context); PrintBacktrace(&context); } - } // namespace angle diff --git a/util/windows/win32/Win32_system_utils.cpp b/util/windows/win32/test_utils_win32.cpp similarity index 86% rename from util/windows/win32/Win32_system_utils.cpp rename to util/windows/win32/test_utils_win32.cpp index 6e4b52393..4f4aa8d97 100644 --- a/util/windows/win32/Win32_system_utils.cpp +++ b/util/windows/win32/test_utils_win32.cpp @@ -4,9 +4,9 @@ // found in the LICENSE file. // -// Win32_system_utils.cpp: Implementation of OS-specific functions for Win32 (Windows) +// test_utils_win32.cpp: Implementation of OS-specific functions for Win32 (Windows) -#include "util/system_utils.h" +#include "util/test_utils.h" #include #include diff --git a/util/x11/X11Window.cpp b/util/x11/X11Window.cpp index 66d555b2d..84cbadbf7 100644 --- a/util/x11/X11Window.cpp +++ b/util/x11/X11Window.cpp @@ -10,7 +10,7 @@ #include "common/debug.h" #include "util/Timer.h" -#include "util/system_utils.h" +#include "util/test_utils.h" namespace {