Browse code

fate: add an option to generate the references

Useful to add or update fate tests.

Luca Barbato authored on 2013/03/19 07:45:58
Showing 3 changed files
... ...
@@ -85,6 +85,8 @@ by default @var{slice+frame}
85 85
 Specify a mask to be applied to autodetected CPU flags.
86 86
 @item TARGET_EXEC
87 87
 Specify or override the wrapper used to run the tests.
88
+@item GEN
89
+Set to @var{1} to generate the missing or mismatched references.
88 90
 @end table
89 91
 
90 92
 @example
... ...
@@ -118,7 +118,7 @@ fate: $(FATE)
118 118
 
119 119
 $(FATE): $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
120 120
 	@echo "TEST    $(@:fate-%=%)"
121
-	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)'
121
+	$(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)' '$(GEN)'
122 122
 
123 123
 fate-list:
124 124
 	@printf '%s\n' $(sort $(FATE))
... ...
@@ -22,6 +22,7 @@ cmp_shift=${12:-0}
22 22
 cmp_target=${13:-0}
23 23
 size_tolerance=${14:-0}
24 24
 cmp_unit=${15:-2}
25
+gen=${16:-no}
25 26
 
26 27
 outdir="tests/data/fate"
27 28
 outfile="${outdir}/${test}"
... ...
@@ -189,5 +190,11 @@ fi
189 189
 
190 190
 echo "${test}:${sig:-$err}:$($base64 <$cmpfile):$($base64 <$errfile)" >$repfile
191 191
 
192
+if test $err != 0 && test $gen != "no" ; then
193
+    echo "GEN     $ref"
194
+    cp -f "$outfile" "$ref"
195
+    err=$?
196
+fi
197
+
192 198
 test $err = 0 && rm -f $outfile $errfile $cmpfile $cleanfiles
193 199
 exit $err