mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-17 15:03:25 +09:00
[Chore] (MG_Backend, MG_Backend/DirectGLES, MG_Backend/DirectVulkan, MG_Backend/MGPipe, MG_Backend/Record, MG_Benchmark/Buffer, MG_Benchmark/Container, MG_Benchmark/Driver, MG_Benchmark/Program, MG_Benchmark/ShaderCache, MG_Benchmark/Transpile, MG_Gbm, MG_Impl, MG_Impl/CGLImpl, MG_Impl/DyldInterpose, MG_Impl/EGLImpl, MG_Impl/GLImpl, MG_Impl/GLXImpl, MG_Impl/NSOpenGLImpl, MG_Impl/Pipe, MG_Impl/WGLImpl, MG_IntegrationTest, MG_IntegrationTest/Harness, MG_IntegrationTest/Scenarios, MG_Pipe, MG_Remote, MG_Remote/Client, MG_Remote/Protocol, MG_Remote/Server, MG_Remote/Transport, MG_Remote/Wire, MG_State/EGLState, MG_State/GLState, MG_Test, MG_Test/Backend, MG_Test/BackendLoader, MG_Test/Buffer, MG_Test/EGLState, MG_Test/Framebuffer, MG_Test/Gbm, MG_Test/Pipe, MG_Test/Pipeline, MG_Test/Program, MG_Test/Query, MG_Test/SelfTest, MG_Test/ShaderTranspiler, MG_Test/State, MG_Test/Swapchain, MG_Test/Texture, MG_Test/Util, MG_Test/VertexArray, MG_Test/Wire, MG_Util/Async, MG_Util/BackendLoaders, MG_Util/Converters, MG_Util/Damage, MG_Util/Debug, MG_Util/Math, MG_Util/Metrics, MG_Util/SelfTest, MG_Util/ShaderTranspiler, MG_Util/Texture, MG_Util/X11, MobileGL, scripts/data, tools/cts, tools/device_bench, tools/spikes, tools/trace_replay, tools/wgl-smoke): clang-format every C and C++ source
- Layout only: token streams match up to split literals, continuations and using order - The size totals fall, so the structure baseline is lowered
This commit is contained in:
@@ -26,50 +26,47 @@
|
||||
|
||||
namespace {
|
||||
|
||||
int gFailures = 0;
|
||||
int gFailures = 0;
|
||||
|
||||
void ExpectSplit(const std::string& input, const std::vector<std::string>& expected) {
|
||||
const std::vector<std::string> actual = mobilegl_trace::SplitSemicolonList(input);
|
||||
if (actual == expected) {
|
||||
return;
|
||||
void ExpectSplit(const std::string& input, const std::vector<std::string>& expected) {
|
||||
const std::vector<std::string> actual = mobilegl_trace::SplitSemicolonList(input);
|
||||
if (actual == expected) {
|
||||
return;
|
||||
}
|
||||
++gFailures;
|
||||
std::cerr << "SplitSemicolonList(\"" << input << "\") gave " << actual.size() << " entries, expected "
|
||||
<< expected.size() << ":";
|
||||
for (const std::string& entry : actual) {
|
||||
std::cerr << " [" << entry << "]";
|
||||
}
|
||||
std::cerr << "\n";
|
||||
}
|
||||
++gFailures;
|
||||
std::cerr << "SplitSemicolonList(\"" << input << "\") gave " << actual.size()
|
||||
<< " entries, expected " << expected.size() << ":";
|
||||
for (const std::string& entry : actual) {
|
||||
std::cerr << " [" << entry << "]";
|
||||
}
|
||||
std::cerr << "\n";
|
||||
}
|
||||
|
||||
const char* ActionName(mobilegl_trace::EnvOverrideAction action) {
|
||||
switch (action) {
|
||||
const char* ActionName(mobilegl_trace::EnvOverrideAction action) {
|
||||
switch (action) {
|
||||
case mobilegl_trace::EnvOverrideAction::Ignore:
|
||||
return "Ignore";
|
||||
case mobilegl_trace::EnvOverrideAction::Set:
|
||||
return "Set";
|
||||
case mobilegl_trace::EnvOverrideAction::Unset:
|
||||
return "Unset";
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
void ExpectParse(const std::string& entry,
|
||||
mobilegl_trace::EnvOverrideAction expectedAction,
|
||||
const std::string& expectedKey,
|
||||
const std::string& expectedValue) {
|
||||
std::string key = "<untouched>";
|
||||
std::string value = "<untouched>";
|
||||
const mobilegl_trace::EnvOverrideAction action =
|
||||
mobilegl_trace::ParseEnvOverride(entry, &key, &value);
|
||||
if (action == expectedAction && key == expectedKey && value == expectedValue) {
|
||||
return;
|
||||
void ExpectParse(const std::string& entry, mobilegl_trace::EnvOverrideAction expectedAction,
|
||||
const std::string& expectedKey, const std::string& expectedValue) {
|
||||
std::string key = "<untouched>";
|
||||
std::string value = "<untouched>";
|
||||
const mobilegl_trace::EnvOverrideAction action = mobilegl_trace::ParseEnvOverride(entry, &key, &value);
|
||||
if (action == expectedAction && key == expectedKey && value == expectedValue) {
|
||||
return;
|
||||
}
|
||||
++gFailures;
|
||||
std::cerr << "ParseEnvOverride(\"" << entry << "\") gave " << ActionName(action) << " key=[" << key
|
||||
<< "] value=[" << value << "], expected " << ActionName(expectedAction) << " key=[" << expectedKey
|
||||
<< "] value=[" << expectedValue << "]\n";
|
||||
}
|
||||
++gFailures;
|
||||
std::cerr << "ParseEnvOverride(\"" << entry << "\") gave " << ActionName(action) << " key=["
|
||||
<< key << "] value=[" << value << "], expected " << ActionName(expectedAction)
|
||||
<< " key=[" << expectedKey << "] value=[" << expectedValue << "]\n";
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -79,8 +76,7 @@ int main() {
|
||||
// Splitting.
|
||||
ExpectSplit("", {});
|
||||
ExpectSplit("MOBILEGL_PIPE_PUSH=1", {"MOBILEGL_PIPE_PUSH=1"});
|
||||
ExpectSplit("MOBILEGL_PIPE_PUSH=1;MOBILEGL_PIPE_VERIFY=1",
|
||||
{"MOBILEGL_PIPE_PUSH=1", "MOBILEGL_PIPE_VERIFY=1"});
|
||||
ExpectSplit("MOBILEGL_PIPE_PUSH=1;MOBILEGL_PIPE_VERIFY=1", {"MOBILEGL_PIPE_PUSH=1", "MOBILEGL_PIPE_VERIFY=1"});
|
||||
// A trailing ';' is what a caller that joins a list gets for free, and an empty entry
|
||||
// must not be turned into an unsetenv("") - the whole passthrough would then depend on
|
||||
// how carefully the shell script trimmed its own string.
|
||||
|
||||
Reference in New Issue
Block a user