Hash :
58957f3d
Author :
Date :
2019-05-03T12:52:22
Add option to run each test config in a separate process. This CL adds a command line option to angle_end2end_tests that will iterate over all test configs. For each config it'll fork a new child process that will run only a single config. This will allow us to isolate each config to a specific child process. Hopefully this will reduce test flakiness due to driver issues with multiple configs. The command line option is "--separate-process-per-config". Note that there are about 25 configs right now. Bug: angleproject:3393 Change-Id: Ia117b371bbe159c1b0d28d82befffeb0f40467a9 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1591428 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
//
// Copyright (c) 2014 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// angle_test_instantiate.h: Adds support for filtering parameterized
// tests by platform, so we skip unsupported configs.
#ifndef ANGLE_TEST_INSTANTIATE_H_
#define ANGLE_TEST_INSTANTIATE_H_
#include <gtest/gtest.h>
namespace angle
{
struct SystemInfo;
struct PlatformParameters;
// Operating systems
bool IsAndroid();
bool IsLinux();
bool IsOSX();
bool IsOzone();
bool IsWindows();
bool IsFuchsia();
// Android devices
bool IsNexus5X();
bool IsNexus6P();
bool IsPixelXL();
bool IsPixel2();
bool IsNVIDIAShield();
bool IsPlatformAvailable(const PlatformParameters ¶m);
// This functions is used to filter which tests should be registered,
// T must be or inherit from angle::PlatformParameters.
template <typename T>
std::vector<T> FilterTestParams(const T *params, size_t numParams)
{
std::vector<T> filtered;
for (size_t i = 0; i < numParams; i++)
{
if (IsPlatformAvailable(params[i]))
{
filtered.push_back(params[i]);
}
}
return filtered;
}
template <typename T>
std::vector<T> FilterTestParams(const std::vector<T> ¶ms)
{
return FilterTestParams(params.data(), params.size());
}
// Used to generate valid test names out of testing::PrintToStringParamName used in combined tests.
struct CombinedPrintToStringParamName
{
template <class ParamType>
std::string operator()(const testing::TestParamInfo<ParamType> &info) const
{
std::string name = testing::PrintToStringParamName()(info);
std::string sanitized;
for (const char c : name)
{
if (c == ',')
{
sanitized += '_';
}
else if (isalnum(c) || c == '_')
{
sanitized += c;
}
}
return sanitized;
}
};
#define ANGLE_INSTANTIATE_TEST_PLATFORMS(testName) \
testing::ValuesIn(::angle::FilterTestParams(testName##params, ArraySize(testName##params)))
// Instantiate the test once for each extra argument. The types of all the
// arguments must match, and getRenderer must be implemented for that type.
#define ANGLE_INSTANTIATE_TEST(testName, first, ...) \
const decltype(first) testName##params[] = {first, ##__VA_ARGS__}; \
INSTANTIATE_TEST_SUITE_P(, testName, ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
testing::PrintToStringParamName())
// Instantiate the test for a combination of N parameters and the enumeration of platforms in the
// extra args, similar to ANGLE_INSTANTIATE_TEST. The macros are defined only for the Ns currently
// in use, and can be expanded as necessary.
#define ANGLE_INSTANTIATE_TEST_COMBINE_1(testName, print, combine1, first, ...) \
const decltype(first) testName##params[] = {first, ##__VA_ARGS__}; \
INSTANTIATE_TEST_SUITE_P( \
, testName, testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), combine1), print)
#define ANGLE_INSTANTIATE_TEST_COMBINE_4(testName, print, combine1, combine2, combine3, combine4, \
first, ...) \
const decltype(first) testName##params[] = {first, ##__VA_ARGS__}; \
INSTANTIATE_TEST_SUITE_P(, testName, \
testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
combine1, combine2, combine3, combine4), \
print)
#define ANGLE_INSTANTIATE_TEST_COMBINE_5(testName, print, combine1, combine2, combine3, combine4, \
combine5, first, ...) \
const decltype(first) testName##params[] = {first, ##__VA_ARGS__}; \
INSTANTIATE_TEST_SUITE_P(, testName, \
testing::Combine(ANGLE_INSTANTIATE_TEST_PLATFORMS(testName), \
combine1, combine2, combine3, combine4, combine5), \
print)
// Checks if a config is expected to be supported by checking a system-based white list.
bool IsConfigWhitelisted(const SystemInfo &systemInfo, const PlatformParameters ¶m);
// Determines if a config is supported by trying to initialize it. Does not require SystemInfo.
bool IsConfigSupported(const PlatformParameters ¶m);
// Returns shared test system information. Can be used globally in the tests.
SystemInfo *GetTestSystemInfo();
// Returns a list of all enabled test platform names. For use in configuration enumeration.
std::vector<std::string> GetAvailableTestPlatformNames();
// Active config (e.g. ES2_Vulkan).
extern std::string gSelectedConfig;
// Use a separate isolated process per test config. This works around driver flakiness when using
// multiple APIs/windows/etc in the same process.
extern bool gSeparateProcessPerConfig;
} // namespace angle
#endif // ANGLE_TEST_INSTANTIATE_H_