@@ -2686,8 +2686,11 @@ class DustmiteCommand : PackageBuildCommand {
26862686 int m_compilerStatusCode = int .min;
26872687 int m_linkerStatusCode = int .min;
26882688 int m_programStatusCode = int .min;
2689+ string m_compilerText;
26892690 string m_compilerRegex;
2691+ string m_linkerText;
26902692 string m_linkerRegex;
2693+ string m_programText;
26912694 string m_programRegex;
26922695 string m_testPackage;
26932696 bool m_noRedirect;
@@ -2714,10 +2717,13 @@ class DustmiteCommand : PackageBuildCommand {
27142717 override void prepare (scope CommandArgs args)
27152718 {
27162719 args.getopt(" compiler-status" , &m_compilerStatusCode, [" The expected status code of the compiler run" ]);
2720+ args.getopt(" compiler-text" , &m_compilerText, [" A (sub) string used to match against the compiler output" ]);
27172721 args.getopt(" compiler-regex" , &m_compilerRegex, [" A regular expression used to match against the compiler output" ]);
27182722 args.getopt(" linker-status" , &m_linkerStatusCode, [" The expected status code of the linker run" ]);
2723+ args.getopt(" linker-text" , &m_linkerText, [" A (sub) string used to match against the linker output" ]);
27192724 args.getopt(" linker-regex" , &m_linkerRegex, [" A regular expression used to match against the linker output" ]);
27202725 args.getopt(" program-status" , &m_programStatusCode, [" The expected status code of the built executable" ]);
2726+ args.getopt(" program-text" , &m_programText, [" A (sub) string used to match against the program output" ]);
27212727 args.getopt(" program-regex" , &m_programRegex, [" A regular expression used to match against the program output" ]);
27222728 args.getopt(" test-package" , &m_testPackage, [" Perform a test run - usually only used internally" ]);
27232729 args.getopt(" combined" , &this .baseSettings.combined, [" Builds multiple packages with one compiler run" ]);
@@ -2755,9 +2761,9 @@ class DustmiteCommand : PackageBuildCommand {
27552761 gensettings.run = m_programStatusCode != int .min || m_programRegex.length;
27562762 gensettings.runArgs = app_args;
27572763 gensettings.force = true ;
2758- gensettings.compileCallback = check(m_compilerStatusCode, m_compilerRegex);
2759- gensettings.linkCallback = check(m_linkerStatusCode, m_linkerRegex);
2760- gensettings.runCallback = check(m_programStatusCode, m_programRegex);
2764+ gensettings.compileCallback = check(m_compilerStatusCode, m_compilerText, m_compilerRegex);
2765+ gensettings.linkCallback = check(m_linkerStatusCode, m_linkerText, m_linkerRegex);
2766+ gensettings.runCallback = check(m_programStatusCode, m_programText, m_programRegex);
27612767 try dub.generateProject(" build" , gensettings);
27622768 catch (DustmiteMismatchException) {
27632769 logInfoNoTag(" Dustmite test doesn't match." );
@@ -2849,10 +2855,13 @@ class DustmiteCommand : PackageBuildCommand {
28492855 if (m_compilerName.length) testcmd.formattedWrite(" \" --compiler=%s\" " , m_compilerName);
28502856 if (m_arch.length) testcmd.formattedWrite(" --arch=%s" , m_arch);
28512857 if (m_compilerStatusCode != int .min) testcmd.formattedWrite(" --compiler-status=%s" , m_compilerStatusCode);
2858+ if (m_compilerText.length) testcmd.formattedWrite(" \" --compiler-text=%s\" " , m_compilerText);
28522859 if (m_compilerRegex.length) testcmd.formattedWrite(" \" --compiler-regex=%s\" " , m_compilerRegex);
28532860 if (m_linkerStatusCode != int .min) testcmd.formattedWrite(" --linker-status=%s" , m_linkerStatusCode);
2861+ if (m_linkerText.length) testcmd.formattedWrite(" \" --linker-text=%s\" " , m_linkerText);
28542862 if (m_linkerRegex.length) testcmd.formattedWrite(" \" --linker-regex=%s\" " , m_linkerRegex);
28552863 if (m_programStatusCode != int .min) testcmd.formattedWrite(" --program-status=%s" , m_programStatusCode);
2864+ if (m_programText.length) testcmd.formattedWrite(" \" --program-text=%s\" " , m_programText);
28562865 if (m_programRegex.length) testcmd.formattedWrite(" \" --program-regex=%s\" " , m_programRegex);
28572866 if (this .baseSettings.combined) testcmd ~= " --combined" ;
28582867
@@ -2875,7 +2884,7 @@ class DustmiteCommand : PackageBuildCommand {
28752884 return 0 ;
28762885 }
28772886
2878- void delegate (int , string ) check(int code_match, string regex_match)
2887+ void delegate (int , string ) check(int code_match, string string_match, string regex_match)
28792888 {
28802889 return (code, output) {
28812890 import std.encoding ;
@@ -2888,6 +2897,12 @@ class DustmiteCommand : PackageBuildCommand {
28882897 throw new DustmiteMismatchException;
28892898 }
28902899
2900+ if (string_match.length > 0 && ! output.sanitize.canFind(string_match)) {
2901+ logInfo(" Output doesn't contain (sub) string:" );
2902+ logInfo(" %s" , output);
2903+ throw new DustmiteMismatchException;
2904+ }
2905+
28912906 if (regex_match.length > 0 && ! match(output.sanitize, regex_match)) {
28922907 logInfo(" Output doesn't match regex:" );
28932908 logInfo(" %s" , output);
0 commit comments