From f3198202cee2fc0cea8bbb91815b4772e11e9ec3 Mon Sep 17 00:00:00 2001 From: Jonathan Marler Date: Tue, 20 Mar 2018 07:59:35 -0600 Subject: [PATCH] Make rdmd-test-compiler optional --- rdmd_test.d | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/rdmd_test.d b/rdmd_test.d index c19d430921..3bcad39005 100755 --- a/rdmd_test.d +++ b/rdmd_test.d @@ -55,7 +55,7 @@ int main(string[] args) string testCompilerList; // e.g. "ldmd2,gdmd" (comma-separated list of compiler names) auto helpInfo = getopt(args, - "rdmd-default-compiler", "[REQUIRED] default D compiler used by rdmd executable", &defaultCompiler, + "rdmd-default-compiler", "default D compiler used by rdmd executable", &defaultCompiler, "concurrency", "whether to perform the concurrency test cases", &concurrencyTest, "m|model", "architecture to run the tests for [32 or 64]", &model, "test-compilers", "comma-separated list of D compilers to test with rdmd", &testCompilerList, @@ -86,9 +86,6 @@ int main(string[] args) if (rdmd.length == 0) reportHelp("ERROR: missing required --rdmd flag"); - if (defaultCompiler.length == 0) - reportHelp("ERROR: missing required --rdmd-default-compiler flag"); - enforce(rdmd.exists, format("rdmd executable path '%s' does not exist", rdmd)); @@ -134,7 +131,7 @@ auto execute(T...)(T args) return std.process.execute(args); } -void runCompilerAgnosticTests(string rdmdApp, string defaultCompiler, string model) +void runCompilerAgnosticTests(string rdmdApp, ref string defaultCompiler, string model) { /* Test help string output when no arguments passed. */ auto res = execute([rdmdApp]); @@ -155,7 +152,14 @@ void runCompilerAgnosticTests(string rdmdApp, string defaultCompiler, string mod assert(offset >= 0); auto compilerInHelp = helpText[offset + compilerHelpLine.length .. $]; compilerInHelp = compilerInHelp[0 .. compilerInHelp.indexOf('\n')]; - assert(defaultCompiler.baseName == compilerInHelp); + if (defaultCompiler.length > 0) + assert(defaultCompiler.baseName == compilerInHelp); + else + { + writefln("Warning: missing --rdmd-default-compiler option, using '%s' from rdmd's help text", + compilerInHelp); + defaultCompiler = compilerInHelp; + } } // run the fallback compiler test (this involves