Merge commit '896fe15dbb7b78de495c4a7dd75e7faec66778da'
[ffmpeg.git] / tests / Makefile
1 THREADS = 1
2 VREF = tests/vsynth1/00.pgm
3 AREF = tests/data/asynth1.sw
4
5 FATEW = 34
6 FATEH = 34
7
8 FFMPEG=ffmpeg$(PROGSSUF)$(EXESUF)
9
10 $(AREF): CMP=
11
12 APITESTSDIR := tests/api
13 FATE_OUTDIRS = tests/data tests/data/fate tests/data/filtergraphs tests/data/lavf tests/data/lavf-fate tests/data/pixfmt tests/vsynth1 $(APITESTSDIR)
14 OUTDIRS += $(FATE_OUTDIRS)
15
16 $(VREF): tests/videogen$(HOSTEXESUF) | tests/vsynth1
17         $(M)./$< 'tests/vsynth1/'
18
19 $(AREF): tests/audiogen$(HOSTEXESUF) | tests/data
20         $(M)./$< $@
21
22 tests/data/asynth-%.wav: tests/audiogen$(HOSTEXESUF) | tests/data
23         $(M)./$< $@ $(subst -, ,$*)
24
25 tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data
26         $(M)$< $@
27
28 tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
29         $(M)$< $(SRC_PATH)/tests/reference.pnm $@
30
31 tests/data/vsynth_lena.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
32         $(M)$< $(SAMPLES)/lena.pnm $@
33
34 tests/data/vsynth3.yuv: tests/videogen$(HOSTEXESUF) | tests/data
35         $(M)$< $@ $(FATEW) $(FATEH)
36
37 tests/test_copy.ffmeta: TAG = COPY
38 tests/test_copy.ffmeta: tests/data
39         $(M)cp -f $(SRC_PATH)/tests/test.ffmeta tests/test_copy.ffmeta
40
41 tests/data/ffprobe-test.nut: ffmpeg$(PROGSSUF)$(EXESUF) tests/test_copy.ffmeta
42         $(M)$(TARGET_EXEC) $(TARGET_PATH)/$< \
43         -f lavfi -i "aevalsrc=sin(400*PI*2*t):d=0.125[out0]; testsrc=d=0.125[out1]; testsrc=s=100x100:d=0.125[out2]" \
44         -f ffmetadata -i $(TARGET_PATH)/tests/test_copy.ffmeta \
45         -flags +bitexact -fflags +bitexact -map 0:0 -map 0:1 -map 0:2 -map_metadata 1 \
46         -map_metadata:s:0 1:s:0 -map_metadata:s:1 1:s:1 \
47         -vcodec rawvideo -acodec pcm_s16le \
48         -y $(TARGET_PATH)/$@ 2>/dev/null
49
50 tests/data/%.sw tests/data/asynth% tests/data/vsynth%.yuv tests/vsynth%/00.pgm tests/data/%.nut: TAG = GEN
51
52 tests/data/filtergraphs/%: TAG = COPY
53 tests/data/filtergraphs/%: $(SRC_PATH)/tests/filtergraphs/% | tests/data/filtergraphs
54         $(M)cp $< $@
55
56 RUNNING_FATE := $(filter check fate%,$(filter-out fate-rsync,$(MAKECMDGOALS)))
57
58 # Check sanity of dependencies when running FATE tests.
59 ifneq (,$(RUNNING_FATE))
60 CHKCFG  = $(if $($(1))$(!$(1)),$($(1)), $(error No such config: $(1)))
61 endif
62
63 ALLYES  = $(strip $(call XYES, $(1)))
64 XYES    = $(if $(strip $(1)),                                           \
65                $(if $(call CHKCFG,CONFIG_$(firstword $(1))),            \
66                     $(call XYES, $(wordlist 2, $(words $(1)), $(1)))),  \
67                yes)
68
69 ENCDEC  = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER  \
70                          $(firstword $(2))_MUXER   $(lastword $(2))_DEMUXER)
71
72 ENCDEC2 = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER  \
73                          $(firstword $(2))_ENCODER $(lastword $(2))_DECODER  \
74                          $(firstword $(3))_MUXER   $(lastword $(3))_DEMUXER)
75
76 DEMDEC  = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER))
77 ENCMUX  = $(call ALLYES, $(1:%=%_ENCODER) $(2)_MUXER)
78
79 DEMMUX  = $(call ALLYES, $(1)_DEMUXER $(2)_MUXER)
80
81 FILTERDEMDEC       = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER $(3)_DECODER)
82 FILTERDEMDECMUX    = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER $(3)_DECODER $(4)_MUXER)
83 FILTERDEMDECENCMUX = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER $(3)_DECODER $(4)_ENCODER $(5)_MUXER)
84
85 PARSERDEMDEC       = $(call ALLYES, $(1)_PARSER $(2)_DEMUXER $(3)_DECODER)
86
87 include $(SRC_PATH)/$(APITESTSDIR)/Makefile
88
89 include $(SRC_PATH)/tests/fate/acodec.mak
90 include $(SRC_PATH)/tests/fate/vcodec.mak
91
92 include $(SRC_PATH)/tests/fate/avformat.mak
93 include $(SRC_PATH)/tests/fate/lavf-audio.mak
94 include $(SRC_PATH)/tests/fate/lavf-image.mak
95 include $(SRC_PATH)/tests/fate/lavf-image2pipe.mak
96 include $(SRC_PATH)/tests/fate/seek.mak
97
98 include $(SRC_PATH)/tests/fate/aac.mak
99 include $(SRC_PATH)/tests/fate/ac3.mak
100 include $(SRC_PATH)/tests/fate/adpcm.mak
101 include $(SRC_PATH)/tests/fate/alac.mak
102 include $(SRC_PATH)/tests/fate/als.mak
103 include $(SRC_PATH)/tests/fate/amrnb.mak
104 include $(SRC_PATH)/tests/fate/amrwb.mak
105 include $(SRC_PATH)/tests/fate/api.mak
106 include $(SRC_PATH)/tests/fate/apng.mak
107 include $(SRC_PATH)/tests/fate/atrac.mak
108 include $(SRC_PATH)/tests/fate/audio.mak
109 include $(SRC_PATH)/tests/fate/bmp.mak
110 include $(SRC_PATH)/tests/fate/build.mak
111 include $(SRC_PATH)/tests/fate/canopus.mak
112 include $(SRC_PATH)/tests/fate/cbs.mak
113 include $(SRC_PATH)/tests/fate/cdxl.mak
114 include $(SRC_PATH)/tests/fate/checkasm.mak
115 include $(SRC_PATH)/tests/fate/concatdec.mak
116 include $(SRC_PATH)/tests/fate/cover-art.mak
117 include $(SRC_PATH)/tests/fate/dca.mak
118 include $(SRC_PATH)/tests/fate/demux.mak
119 include $(SRC_PATH)/tests/fate/dfa.mak
120 include $(SRC_PATH)/tests/fate/dnxhd.mak
121 include $(SRC_PATH)/tests/fate/dpcm.mak
122 include $(SRC_PATH)/tests/fate/ea.mak
123 include $(SRC_PATH)/tests/fate/exif.mak
124 include $(SRC_PATH)/tests/fate/ffmpeg.mak
125 include $(SRC_PATH)/tests/fate/ffprobe.mak
126 include $(SRC_PATH)/tests/fate/fft.mak
127 include $(SRC_PATH)/tests/fate/fifo-muxer.mak
128 include $(SRC_PATH)/tests/fate/filter-audio.mak
129 include $(SRC_PATH)/tests/fate/filter-video.mak
130 include $(SRC_PATH)/tests/fate/fits.mak
131 include $(SRC_PATH)/tests/fate/flac.mak
132 include $(SRC_PATH)/tests/fate/flvenc.mak
133 include $(SRC_PATH)/tests/fate/gapless.mak
134 include $(SRC_PATH)/tests/fate/gif.mak
135 include $(SRC_PATH)/tests/fate/h264.mak
136 include $(SRC_PATH)/tests/fate/hap.mak
137 include $(SRC_PATH)/tests/fate/hevc.mak
138 include $(SRC_PATH)/tests/fate/hlsenc.mak
139 include $(SRC_PATH)/tests/fate/hw.mak
140 include $(SRC_PATH)/tests/fate/id3v2.mak
141 include $(SRC_PATH)/tests/fate/image.mak
142 include $(SRC_PATH)/tests/fate/indeo.mak
143 include $(SRC_PATH)/tests/fate/libavcodec.mak
144 include $(SRC_PATH)/tests/fate/libavdevice.mak
145 include $(SRC_PATH)/tests/fate/libavformat.mak
146 include $(SRC_PATH)/tests/fate/libavresample.mak
147 include $(SRC_PATH)/tests/fate/libavutil.mak
148 include $(SRC_PATH)/tests/fate/libswresample.mak
149 include $(SRC_PATH)/tests/fate/libswscale.mak
150 include $(SRC_PATH)/tests/fate/lossless-audio.mak
151 include $(SRC_PATH)/tests/fate/lossless-video.mak
152 include $(SRC_PATH)/tests/fate/matroska.mak
153 include $(SRC_PATH)/tests/fate/microsoft.mak
154 include $(SRC_PATH)/tests/fate/monkeysaudio.mak
155 include $(SRC_PATH)/tests/fate/mov.mak
156 include $(SRC_PATH)/tests/fate/mp3.mak
157 include $(SRC_PATH)/tests/fate/mpc.mak
158 include $(SRC_PATH)/tests/fate/mpeg4.mak
159 include $(SRC_PATH)/tests/fate/mpegps.mak
160 include $(SRC_PATH)/tests/fate/mpegts.mak
161 include $(SRC_PATH)/tests/fate/mxf.mak
162 include $(SRC_PATH)/tests/fate/opus.mak
163 include $(SRC_PATH)/tests/fate/pcm.mak
164 include $(SRC_PATH)/tests/fate/pixfmt.mak
165 include $(SRC_PATH)/tests/fate/pixlet.mak
166 include $(SRC_PATH)/tests/fate/probe.mak
167 include $(SRC_PATH)/tests/fate/prores.mak
168 include $(SRC_PATH)/tests/fate/qt.mak
169 include $(SRC_PATH)/tests/fate/qtrle.mak
170 include $(SRC_PATH)/tests/fate/real.mak
171 include $(SRC_PATH)/tests/fate/screen.mak
172 include $(SRC_PATH)/tests/fate/source.mak
173 include $(SRC_PATH)/tests/fate/speedhq.mak
174 include $(SRC_PATH)/tests/fate/subtitles.mak
175 include $(SRC_PATH)/tests/fate/utvideo.mak
176 include $(SRC_PATH)/tests/fate/video.mak
177 include $(SRC_PATH)/tests/fate/voice.mak
178 include $(SRC_PATH)/tests/fate/vorbis.mak
179 include $(SRC_PATH)/tests/fate/vpx.mak
180 include $(SRC_PATH)/tests/fate/vqf.mak
181 include $(SRC_PATH)/tests/fate/wavpack.mak
182 include $(SRC_PATH)/tests/fate/wma.mak
183 include $(SRC_PATH)/tests/fate/xvid.mak
184
185 FATE_FFMPEG += $(FATE_FFMPEG-yes) $(FATE_AVCONV) $(FATE_AVCONV-yes)
186 FATE-$(CONFIG_FFMPEG) += $(FATE_FFMPEG)
187 FATE-$(CONFIG_FFPROBE) += $(FATE_FFPROBE)
188
189 FATE_SAMPLES_AVCONV           += $(FATE_SAMPLES_AVCONV-yes)
190 FATE_SAMPLES_FFMPEG           += $(FATE_SAMPLES_FFMPEG-yes)
191 FATE_EXTERN-$(CONFIG_FFMPEG)  += $(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMPEG) $(FATE_SAMPLES_FFPROBE) $(FATE_SAMPLES_FASTSTART)
192 FATE_EXTERN += $(FATE_EXTERN-yes)
193
194 FATE += $(FATE-yes)
195
196 RSYNC_OPTIONS-$(HAVE_RSYNC_CONTIMEOUT) += --contimeout=60
197 RSYNC_OPTIONS = -vrltLW --timeout=60 $(RSYNC_OPTIONS-yes)
198
199 $(FATE_FFMPEG) $(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMPEG): ffmpeg$(PROGSSUF)$(EXESUF)
200
201 $(FATE_FFPROBE) $(FATE_SAMPLES_FFPROBE): ffprobe$(PROGSSUF)$(EXESUF)
202
203 $(FATE_SAMPLES_FASTSTART): tools/qt-faststart$(EXESUF)
204
205 ifdef SAMPLES
206 FATE += $(FATE_FULL) $(FATE_FULL-yes)
207 FATE += $(FATE_EXTERN)
208 fate-rsync:
209         rsync $(RSYNC_OPTIONS) rsync://fate-suite.ffmpeg.org/fate-suite/ $(SAMPLES)
210 else
211 fate::
212         @echo "warning: only a subset of the fate tests will be run because SAMPLES is not specified"
213 fate-rsync:
214         @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
215 $(FATE_EXTERN):
216         @echo "$@ requires external samples and SAMPLES not specified"; false
217 endif
218
219 FATE_UTILS = base64 tiny_psnr tiny_ssim audiomatch
220
221 TOOL = ffmpeg
222
223 $(addprefix fate-, $(IGNORE_TESTS)): REPORT=ignore
224
225 fate:: $(FATE)
226
227 # Tests requiring hardware support are not included in a default fate run.
228 fate-hw: $(FATE_HW-yes)
229 FATE += $(FATE_HW-yes)
230
231 $(FATE) $(FATE_TESTS-no): export PROGSUF = $(PROGSSUF)
232 $(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF)) | $(FATE_OUTDIRS)
233         @echo "TEST    $(@:fate-%=%)"
234         $(Q)$(SRC_PATH)/tests/fate-run.sh $@ "$(TARGET_SAMPLES)" "$(TARGET_EXEC)" "$(TARGET_PATH)" '$(CMD)' '$(CMP)' '$(REF)' '$(FUZZ)' '$(THREADS)' '$(THREAD_TYPE)' '$(CPUFLAGS)' '$(CMP_SHIFT)' '$(CMP_TARGET)' '$(SIZE_TOLERANCE)' '$(CMP_UNIT)' '$(GEN)' '$(HWACCEL)' '$(REPORT)' '$(KEEP)'
235
236 fate-list:
237         @printf '%s\n' $(sort $(FATE))
238
239 coverage.info: TAG = LCOV
240 coverage.info:
241         $(M)lcov -q -d $(CURDIR) -b $(patsubst src%,./,$(SRC_LINK)) --capture | \
242             sed "s,$(CURDIR)/\./,$(CURDIR)/," > $@.in
243         $(M)lcov -q --remove $@.in "/usr*" > $@
244         $(Q)$(RM) $@.in
245
246 lcov:  TAG = GENHTML
247 lcov: coverage.info
248         $(M)genhtml -q -o $(CURDIR)/lcov $<
249
250 lcov-reset: TAG = LCOV
251 lcov-reset:
252         $(M)lcov -q -d $(CURDIR) --zerocounters
253         $(Q)$(RM) -f coverage.info
254
255 clean:: testclean
256
257 testclean::
258         $(RM) -r tests/vsynth1 tests/data tools/lavfi-showfiltfmts$(PROGSSUF)$(EXESUF)
259         $(RM) $(CLEANSUFFIXES:%=tests/%)
260         $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
261         $(RM) tests/pixfmts.mak tests/test_copy.ffmeta
262
263 -include $(wildcard tests/*.d)
264
265 include $(SRC_PATH)/tests/checkasm/Makefile
266
267 .PHONY: fate* lcov lcov-reset
268 .INTERMEDIATE: coverage.info