From 7124cc4e5dc49914f7dd68d7e93858112d61dfd9 Mon Sep 17 00:00:00 2001 From: Austin Eng Date: Thu, 25 Feb 2021 20:38:45 +0000 Subject: [PATCH] Log a warning if unrecognized args are passed to the test binary Bug: none Change-Id: Ic437dc7656613d9a8088dd51f1ed0713f1992415 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/42720 Auto-Submit: Austin Eng Reviewed-by: Stephen White Reviewed-by: Brandon Jones Commit-Queue: Austin Eng --- src/tests/DawnTest.cpp | 8 ++++++++ src/tests/unittests/validation/ValidationTest.cpp | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/tests/DawnTest.cpp b/src/tests/DawnTest.cpp index 7cc9693e26..45f415dbfe 100644 --- a/src/tests/DawnTest.cpp +++ b/src/tests/DawnTest.cpp @@ -382,6 +382,14 @@ void DawnTestEnvironment::ParseArgs(int argc, char** argv) { "available device type\n"; continue; } + + // Skip over args that look like they're for Googletest. + constexpr const char kGtestArgPrefix[] = "--gtest_"; + if (strncmp(kGtestArgPrefix, argv[i], sizeof(kGtestArgPrefix) - 1) == 0) { + continue; + } + + dawn::WarningLog() << " Unused argument: " << argv[i]; } } diff --git a/src/tests/unittests/validation/ValidationTest.cpp b/src/tests/unittests/validation/ValidationTest.cpp index 7960583429..40c3a2b375 100644 --- a/src/tests/unittests/validation/ValidationTest.cpp +++ b/src/tests/unittests/validation/ValidationTest.cpp @@ -43,6 +43,14 @@ void InitDawnValidationTestEnvironment(int argc, char** argv) { gWireTraceDir = argv[i] + argLen; continue; } + + // Skip over args that look like they're for Googletest. + constexpr const char kGtestArgPrefix[] = "--gtest_"; + if (strncmp(kGtestArgPrefix, argv[i], sizeof(kGtestArgPrefix) - 1) == 0) { + continue; + } + + dawn::WarningLog() << " Unused argument: " << argv[i]; } }