From bda8d7a0b003f982cdb5e9b985711306a2602fbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Wed, 10 Feb 2021 18:09:45 +0100 Subject: [PATCH] testlib: Don't abort on unrecognized -AppleFoo command line arguments Allow passing command line arguments such as -AppleLocale, that override user preferences for the test process. Change-Id: I9e58e91fcb01a36f9d6c64ef52369308be5e95b5 Reviewed-by: Edward Welbourne --- src/testlib/qtestcase.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 17901eb08a1..8b66d04fab9 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -787,10 +787,15 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool } else if (strcmp(argv[i], "-vb") == 0) { QBenchmarkGlobalData::current->verboseOutput = true; -#if defined(Q_OS_MAC) && defined(HAVE_XCTEST) +#if defined(Q_OS_DARWIN) + } else if (strncmp(argv[i], "-Apple", 6) == 0) { + i += 1; // Skip Apple-specific user preferences + continue; +# if defined(HAVE_XCTEST) } else if (int skip = QXcodeTestLogger::parseCommandLineArgument(argv[i])) { i += (skip - 1); // Eating argv[i] with a continue counts towards skips continue; +# endif #endif } else if (argv[i][0] == '-') { fprintf(stderr, "Unknown option: '%s'\n\n%s", argv[i], testOptions);