Skip to content

Commit 38074b6

Browse files
committed
temp
1 parent 8aa15a9 commit 38074b6

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

fuzzing/Jamfile

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ local corpus.tar = [ glob-ex . : corpus.tar ] ;
4242
local test-corpus ;
4343
if $(corpus.tar)
4444
{
45+
echo Using old corpus ;
4546
# if an old corpus exists, use it
4647
make old-corpus
4748
: $(corpus.tar)
@@ -56,7 +57,7 @@ else
5657
}
5758

5859
local old-runs = [ SORT [ glob-tree-ex old_crashes : * ] ] ;
59-
make old_crashes : : common.MkDir : <location>. ;
60+
make old_crashes : : @mkdir : <location>. ;
6061
explicit old_crashes ;
6162

6263
local variants = basic_parser parse parser direct_parse ;
@@ -100,7 +101,7 @@ for local variant in basic_parser parse parser direct_parse
100101
}
101102
make oldcorpus/$(variant)
102103
: $(old-corpus-deps)
103-
: common.MkDir
104+
: @mkdir
104105
: <location>.
105106
;
106107
explicit oldcorpus/$(variant) ;
@@ -139,6 +140,13 @@ alias run : $(variants)-run ;
139140
explicit run $(variants)-run ;
140141

141142

143+
rule mkdir ( target : source * : props * )
144+
{
145+
local dir = [ path.make [ on $(target) return $(LOCATE) ] ] ;
146+
dir = [ path.join $(dir) $(target:G=) ] ;
147+
common.MkDir $(dir) ;
148+
}
149+
142150
rule fuzzer-props ( props * )
143151
{
144152
local toolset = [ property.select toolset : $(props) ] ;
@@ -169,21 +177,43 @@ rule run-fuzzer ( target : sources * : props * )
169177
local flags = [ property.select flags : $(props) ] ;
170178
FLAGS on $(target) = $(flags:G=) ;
171179

180+
LOG on $(target) = [ path.native [ path.join $(target) _log ] ] ;
181+
172182
local dir = [ path.make [ on $(target) return $(LOCATE) ] ] ;
173183
dir = $(dir)/$(target:G=) ;
174184
common.MkDir $(dir) ;
175185
DEPENDS $(target) : $(dir) ;
186+
187+
LOG on $(target) = [ path.native [ path.join $(dir) _log ] ] ;
176188
}
177189

190+
.SET_STATUS = [ modules.peek testing : .SET_STATUS ] ;
191+
.STATUS = [ modules.peek testing : .STATUS ] ;
192+
.RUN_OUTPUT_NL = [ modules.peek testing : .RUN_OUTPUT_NL ] ;
193+
.STATUS_NOT_0 = [ modules.peek testing : .STATUS_NOT_0 ] ;
194+
.CATENATE = [ modules.peek testing : .CATENATE ] ;
195+
.ENDIF = [ modules.peek testing : .ENDIF ] ;
196+
.NULL_OUT = [ modules.peek common : NULL_OUT ] ;
197+
.RM = [ common.rm-command ] ;
178198
actions run-fuzzer
179199
{
180200
$(.UBSAN_OPTIONS)
181-
$(>[1]) $(<) $(>[2-]) $(FLAGS)
201+
$(>[1]) $(<) $(>[2-]) $(FLAGS) > "$(LOG)" 2>&1
202+
$(.SET_STATUS)
203+
if $(.STATUS_NOT_0)
204+
echo ====== BEGIN OUTPUT ======
205+
$(.CATENATE) "$(LOG)"
206+
echo ====== END OUTPUT ======
207+
$(RM) $(LOG) $(.NULL_OUT)
208+
exit 1
209+
$(.ENDIF)
182210
}
183211

184212
.TOUCH_FILE = [ common.file-touch-command ] ;
185213
actions untar-corpus
186214
{
187215
tar xf $(>) -C $(<:D)
188216
$(.TOUCH_FILE) $(<)
217+
echo $(<:D)
218+
ls $(<:D)
189219
}

0 commit comments

Comments
 (0)