@@ -2686,8 +2686,11 @@ class DustmiteCommand : PackageBuildCommand {
2686
2686
int m_compilerStatusCode = int .min;
2687
2687
int m_linkerStatusCode = int .min;
2688
2688
int m_programStatusCode = int .min;
2689
+ string m_compilerText;
2689
2690
string m_compilerRegex;
2691
+ string m_linkerText;
2690
2692
string m_linkerRegex;
2693
+ string m_programText;
2691
2694
string m_programRegex;
2692
2695
string m_testPackage;
2693
2696
bool m_noRedirect;
@@ -2714,10 +2717,13 @@ class DustmiteCommand : PackageBuildCommand {
2714
2717
override void prepare (scope CommandArgs args)
2715
2718
{
2716
2719
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" ]);
2717
2721
args.getopt(" compiler-regex" , &m_compilerRegex, [" A regular expression used to match against the compiler output" ]);
2718
2722
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" ]);
2719
2724
args.getopt(" linker-regex" , &m_linkerRegex, [" A regular expression used to match against the linker output" ]);
2720
2725
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" ]);
2721
2727
args.getopt(" program-regex" , &m_programRegex, [" A regular expression used to match against the program output" ]);
2722
2728
args.getopt(" test-package" , &m_testPackage, [" Perform a test run - usually only used internally" ]);
2723
2729
args.getopt(" combined" , &this .baseSettings.combined, [" Builds multiple packages with one compiler run" ]);
@@ -2755,9 +2761,9 @@ class DustmiteCommand : PackageBuildCommand {
2755
2761
gensettings.run = m_programStatusCode != int .min || m_programRegex.length;
2756
2762
gensettings.runArgs = app_args;
2757
2763
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);
2761
2767
try dub.generateProject(" build" , gensettings);
2762
2768
catch (DustmiteMismatchException) {
2763
2769
logInfoNoTag(" Dustmite test doesn't match." );
@@ -2849,10 +2855,13 @@ class DustmiteCommand : PackageBuildCommand {
2849
2855
if (m_compilerName.length) testcmd.formattedWrite(" \" --compiler=%s\" " , m_compilerName);
2850
2856
if (m_arch.length) testcmd.formattedWrite(" --arch=%s" , m_arch);
2851
2857
if (m_compilerStatusCode != int .min) testcmd.formattedWrite(" --compiler-status=%s" , m_compilerStatusCode);
2858
+ if (m_compilerText.length) testcmd.formattedWrite(" \" --compiler-text=%s\" " , m_compilerText);
2852
2859
if (m_compilerRegex.length) testcmd.formattedWrite(" \" --compiler-regex=%s\" " , m_compilerRegex);
2853
2860
if (m_linkerStatusCode != int .min) testcmd.formattedWrite(" --linker-status=%s" , m_linkerStatusCode);
2861
+ if (m_linkerText.length) testcmd.formattedWrite(" \" --linker-text=%s\" " , m_linkerText);
2854
2862
if (m_linkerRegex.length) testcmd.formattedWrite(" \" --linker-regex=%s\" " , m_linkerRegex);
2855
2863
if (m_programStatusCode != int .min) testcmd.formattedWrite(" --program-status=%s" , m_programStatusCode);
2864
+ if (m_programText.length) testcmd.formattedWrite(" \" --program-text=%s\" " , m_programText);
2856
2865
if (m_programRegex.length) testcmd.formattedWrite(" \" --program-regex=%s\" " , m_programRegex);
2857
2866
if (this .baseSettings.combined) testcmd ~= " --combined" ;
2858
2867
@@ -2875,7 +2884,7 @@ class DustmiteCommand : PackageBuildCommand {
2875
2884
return 0 ;
2876
2885
}
2877
2886
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)
2879
2888
{
2880
2889
return (code, output) {
2881
2890
import std.encoding ;
@@ -2888,8 +2897,14 @@ class DustmiteCommand : PackageBuildCommand {
2888
2897
throw new DustmiteMismatchException;
2889
2898
}
2890
2899
2900
+ if (string_match.length > 0 && ! output.sanitize.canFind(string_match)) {
2901
+ logInfo(" Output doesn't contain (sub) string %s:" , string_match);
2902
+ logInfo(" %s" , output);
2903
+ throw new DustmiteMismatchException;
2904
+ }
2905
+
2891
2906
if (regex_match.length > 0 && ! match(output.sanitize, regex_match)) {
2892
- logInfo(" Output doesn't match regex: " );
2907
+ logInfo(" Output doesn't match regex %s: " , regex_match );
2893
2908
logInfo(" %s" , output);
2894
2909
throw new DustmiteMismatchException;
2895
2910
}
0 commit comments