@@ -18,6 +18,8 @@ inputs:
18
18
default : false
19
19
load-all :
20
20
description : ' If set to true then execute LoadAllPackages() before the package being tested'
21
+ warnings-as-errors :
22
+ description : ' If set to true then any errors produced whilst loading the package will be treated as errors'
21
23
required : false
22
24
type : boolean
23
25
default : false
64
66
if IsEmpty(GAP_TESTFILE) or not IsExistingFile(GAP_TESTFILE) then
65
67
GAP_TESTFILE := info.TestFile;
66
68
fi;
67
- # Load the package with debug info
69
+
68
70
SetInfoLevel(InfoPackageLoading, PACKAGE_DEBUG);
69
71
SetPackagePath(info.PackageName, "/tmp/gaproot/pkg/$(basename $PWD)");
72
+
73
+ # Capture the output of loading
74
+ output := "";
75
+ output_stream := OutputTextString(output, true);
76
+ SetPrintFormattingStatus(output_stream, false);
77
+ OutputLogTo(output_stream);
78
+
79
+ # Load the package with debug info
70
80
if ${{ inputs.only-needed }} = true then
71
81
LoadPackage(info.PackageName : OnlyNeeded);
72
82
else
75
85
if ${{ inputs.load-all }} = true then
76
86
LoadAllPackages();
77
87
fi;
88
+
89
+ OutputLogTo();
90
+ CloseStream(output_stream);
91
+
92
+ # Treat warnings as errors if specified
93
+ if ${{ inputs.warnings-as-errors }} = 'true' ; then
94
+ if PositionSublist(output, "warning") <> fail then
95
+ Error("Warnings were found when loading the package");
96
+ fi;
97
+ fi;
98
+
78
99
SetInfoLevel(InfoPackageLoading, PACKAGE_ERROR);
79
100
Print("Now running tests from ", GAP_TESTFILE, "\n");
80
101
if EndsWith(GAP_TESTFILE, ".tst") then
0 commit comments