From 1dc4d5b15ef59513cc9895a7bef17000b68da74e Mon Sep 17 00:00:00 2001 From: Steve Karolewics Date: Mon, 3 Feb 2020 12:39:36 -0500 Subject: [PATCH] Display the demos UI if argv[1] isn't a valid test --- util/test/demos/main.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/util/test/demos/main.cpp b/util/test/demos/main.cpp index ca9796508..71d1247f7 100644 --- a/util/test/demos/main.cpp +++ b/util/test/demos/main.cpp @@ -328,14 +328,28 @@ Usage: %s Test_Name [test_options] return 1; } - std::string testchoice; + // Check if the first arg is a valid test name. If it isn't, + // allow the UI to appear, so that flags can be used with the UI + bool validTestArg = false; + if(argc >= 2) + { + for(const TestMetadata &test : tests) + { + if(!strcmp(test.Name, argv[1])) + { + validTestArg = true; + break; + } + } + } + std::string testchoice; if(tests.size() == 1) { // if there's only one test we've probably hardcoded this for a repro. Launch it testchoice = tests[0].Name; } - else if(argc >= 2) + else if(validTestArg) { testchoice = argv[1]; }