Merge commit '706208ef47bffd525c982975d2756f7b2b220b8d'
[ffmpeg.git] / tests / Makefile
1 FFSERVER_REFFILE = $(SRC_PATH)/tests/ffserver.regression.ref
2
3 VREF = tests/vsynth1/00.pgm
4 AREF = tests/data/asynth1.sw
5
6 FATEW = 34
7 FATEH = 34
8
9 $(AREF): CMP=
10
11 ffservertest: ffserver$(EXESUF) tests/vsynth1/00.pgm tests/data/asynth1.sw
12         @echo
13         @echo "Unfortunately ffserver is broken and therefore its regression"
14         @echo "test fails randomly. Treat the results accordingly."
15         @echo
16         $(SRC_PATH)/tests/ffserver-regression.sh $(FFSERVER_REFFILE) $(SRC_PATH)/tests/ffserver.conf
17
18 OBJDIRS += tests/data tests/vsynth1 tests/data/filtergraphs
19
20 $(VREF): tests/videogen$(HOSTEXESUF) | tests/vsynth1
21         $(M)./$< 'tests/vsynth1/'
22
23 $(AREF): tests/audiogen$(HOSTEXESUF) | tests/data
24         $(M)./$< $@
25
26 tests/data/asynth-%.wav: tests/audiogen$(HOSTEXESUF) | tests/data
27         $(M)./$< $@ $(subst -, ,$*)
28
29 tests/data/vsynth1.yuv: tests/videogen$(HOSTEXESUF) | tests/data
30         $(M)$< $@
31
32 tests/data/vsynth2.yuv: tests/rotozoom$(HOSTEXESUF) | tests/data
33         $(M)$< $(SRC_PATH)/tests/lena.pnm $@
34
35 tests/data/vsynth3.yuv: tests/videogen$(HOSTEXESUF) | tests/data
36         $(M)$< $@ $(FATEW) $(FATEH)
37
38 tests/data/ffprobe-test.nut: ffmpeg$(EXESUF) | tests/data
39         $(M)$(TARGET_EXEC) ./$< \
40         -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]" \
41         -f ffmetadata -i $(SRC_PATH)/tests/test.ffmeta \
42         -flags +bitexact -map 0:0 -map 0:1 -map 0:2 -map_metadata 1 \
43         -map_metadata:s:0 1:s:0 -map_metadata:s:1 1:s:1 \
44         -vcodec rawvideo -acodec pcm_s16le \
45         -y $@ 2>/dev/null
46
47 tests/data/%.sw tests/data/asynth% tests/data/vsynth%.yuv tests/vsynth%/00.pgm tests/data/%.nut: TAG = GEN
48
49 tests/data/filtergraphs/%: TAG = COPY
50 tests/data/filtergraphs/%: $(SRC_PATH)/tests/filtergraphs/% | tests/data/filtergraphs
51         $(M)cp $< $@
52
53 RUNNING_FATE := $(filter check fate%,$(filter-out fate-rsync,$(MAKECMDGOALS)))
54
55 # Check sanity of dependencies when running FATE tests.
56 ifneq (,$(RUNNING_FATE))
57 CHKCFG  = $(if $($(1))$(!$(1)),$($(1)), $(error No such config: $(1)))
58 endif
59
60 ALLYES  = $(strip $(call XYES, $(1)))
61 XYES    = $(if $(strip $(1)),                                           \
62                $(if $(call CHKCFG,CONFIG_$(firstword $(1))),            \
63                     $(call XYES, $(wordlist 2, $(words $(1)), $(1)))),  \
64                yes)
65
66 ENCDEC  = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER  \
67                          $(firstword $(2))_MUXER   $(lastword $(2))_DEMUXER)
68
69 ENCDEC2 = $(call ALLYES, $(firstword $(1))_ENCODER $(lastword $(1))_DECODER  \
70                          $(firstword $(2))_ENCODER $(lastword $(2))_DECODER  \
71                          $(firstword $(3))_MUXER   $(lastword $(3))_DEMUXER)
72
73 DEMDEC  = $(call ALLYES, $(1)_DEMUXER $(2:%=%_DECODER))
74 ENCMUX  = $(call ALLYES, $(1:%=%_ENCODER) $(2)_MUXER)
75
76 DEMMUX  = $(call ALLYES, $(1)_DEMUXER $(2)_MUXER)
77
78 FILTERDEMDEC       = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER $(3)_DECODER)
79 FILTERDEMDECMUX    = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER $(3)_DECODER $(4)_MUXER)
80 FILTERDEMDECENCMUX = $(call ALLYES, $(1:%=%_FILTER) $(2)_DEMUXER $(3)_DECODER $(4)_ENCODER $(5)_MUXER)
81
82 PARSERDEMDEC       = $(call ALLYES, $(1)_PARSER $(2)_DEMUXER $(3)_DECODER)
83
84 include $(SRC_PATH)/tests/fate/acodec.mak
85 include $(SRC_PATH)/tests/fate/vcodec.mak
86 include $(SRC_PATH)/tests/fate/avformat.mak
87 include $(SRC_PATH)/tests/fate/seek.mak
88
89 include $(SRC_PATH)/tests/fate/aac.mak
90 include $(SRC_PATH)/tests/fate/ac3.mak
91 include $(SRC_PATH)/tests/fate/adpcm.mak
92 include $(SRC_PATH)/tests/fate/alac.mak
93 include $(SRC_PATH)/tests/fate/als.mak
94 include $(SRC_PATH)/tests/fate/amrnb.mak
95 include $(SRC_PATH)/tests/fate/amrwb.mak
96 include $(SRC_PATH)/tests/fate/atrac.mak
97 include $(SRC_PATH)/tests/fate/audio.mak
98 include $(SRC_PATH)/tests/fate/bmp.mak
99 include $(SRC_PATH)/tests/fate/cdxl.mak
100 include $(SRC_PATH)/tests/fate/cover-art.mak
101 include $(SRC_PATH)/tests/fate/demux.mak
102 include $(SRC_PATH)/tests/fate/dfa.mak
103 include $(SRC_PATH)/tests/fate/dpcm.mak
104 include $(SRC_PATH)/tests/fate/ea.mak
105 include $(SRC_PATH)/tests/fate/exif.mak
106 include $(SRC_PATH)/tests/fate/ffmpeg.mak
107 include $(SRC_PATH)/tests/fate/ffprobe.mak
108 include $(SRC_PATH)/tests/fate/filter-audio.mak
109 include $(SRC_PATH)/tests/fate/filter-video.mak
110 include $(SRC_PATH)/tests/fate/flac.mak
111 include $(SRC_PATH)/tests/fate/fft.mak
112 include $(SRC_PATH)/tests/fate/gif.mak
113 include $(SRC_PATH)/tests/fate/h264.mak
114 include $(SRC_PATH)/tests/fate/hevc.mak
115 include $(SRC_PATH)/tests/fate/image.mak
116 include $(SRC_PATH)/tests/fate/indeo.mak
117 include $(SRC_PATH)/tests/fate/libavcodec.mak
118 include $(SRC_PATH)/tests/fate/libavdevice.mak
119 include $(SRC_PATH)/tests/fate/libavformat.mak
120 include $(SRC_PATH)/tests/fate/libavresample.mak
121 include $(SRC_PATH)/tests/fate/libavutil.mak
122 include $(SRC_PATH)/tests/fate/libswresample.mak
123 include $(SRC_PATH)/tests/fate/lossless-audio.mak
124 include $(SRC_PATH)/tests/fate/lossless-video.mak
125 include $(SRC_PATH)/tests/fate/microsoft.mak
126 include $(SRC_PATH)/tests/fate/monkeysaudio.mak
127 include $(SRC_PATH)/tests/fate/mp3.mak
128 include $(SRC_PATH)/tests/fate/mpc.mak
129 include $(SRC_PATH)/tests/fate/opus.mak
130 include $(SRC_PATH)/tests/fate/pcm.mak
131 include $(SRC_PATH)/tests/fate/probe.mak
132 include $(SRC_PATH)/tests/fate/prores.mak
133 include $(SRC_PATH)/tests/fate/qt.mak
134 include $(SRC_PATH)/tests/fate/qtrle.mak
135 include $(SRC_PATH)/tests/fate/real.mak
136 include $(SRC_PATH)/tests/fate/screen.mak
137 include $(SRC_PATH)/tests/fate/subtitles.mak
138 include $(SRC_PATH)/tests/fate/utvideo.mak
139 include $(SRC_PATH)/tests/fate/video.mak
140 include $(SRC_PATH)/tests/fate/voice.mak
141 include $(SRC_PATH)/tests/fate/vorbis.mak
142 include $(SRC_PATH)/tests/fate/vpx.mak
143 include $(SRC_PATH)/tests/fate/vqf.mak
144 include $(SRC_PATH)/tests/fate/wavpack.mak
145 include $(SRC_PATH)/tests/fate/wma.mak
146 include $(SRC_PATH)/tests/fate/xvid.mak
147
148 FATE_FFMPEG += $(FATE_FFMPEG-yes) $(FATE_AVCONV) $(FATE_AVCONV-yes)
149 FATE-$(CONFIG_FFMPEG) += $(FATE_FFMPEG)
150 FATE-$(CONFIG_FFPROBE) += $(FATE_FFPROBE)
151
152 FATE_SAMPLES_AVCONV           += $(FATE_SAMPLES_AVCONV-yes)
153 FATE_SAMPLES_FFMPEG           += $(FATE_SAMPLES_FFMPEG-yes)
154 FATE_EXTERN-$(CONFIG_FFMPEG)  += $(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMPEG) $(FATE_SAMPLES_FFPROBE)
155 FATE_EXTERN += $(FATE_EXTERN-yes)
156
157 FATE += $(FATE-yes)
158
159 RSYNC_OPTIONS-$(HAVE_RSYNC_CONTIMEOUT) += --contimeout=60
160 RSYNC_OPTIONS = -vrltLW --timeout=60 $(RSYNC_OPTIONS-yes)
161
162 $(FATE_FFMPEG) $(FATE_SAMPLES_AVCONV) $(FATE_SAMPLES_FFMPEG): ffmpeg$(EXESUF)
163
164 $(FATE_FFPROBE) $(FATE_SAMPLES_FFPROBE): ffprobe$(EXESUF)
165
166 ifdef SAMPLES
167 FATE += $(FATE_FULL) $(FATE_FULL-yes)
168 FATE += $(FATE_EXTERN)
169 fate-rsync:
170         rsync $(RSYNC_OPTIONS) rsync://fate-suite.ffmpeg.org/fate-suite/ $(SAMPLES)
171 else
172 fate::
173         @echo "warning: only a subset of the fate tests will be run because SAMPLES is not specified"
174 fate-rsync:
175         @echo "use 'make fate-rsync SAMPLES=/path/to/samples' to sync the fate suite"
176 $(FATE_EXTERN):
177         @echo "$@ requires external samples and SAMPLES not specified"; false
178 endif
179
180 FATE_UTILS = base64 tiny_psnr tiny_ssim
181
182 TOOL = ffmpeg
183
184 fate:: $(FATE)
185
186 $(FATE) $(FATE_TESTS-no): $(FATE_UTILS:%=tests/%$(HOSTEXESUF))
187         @echo "TEST    $(@:fate-%=%)"
188         $(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)'
189
190 fate-list:
191         @printf '%s\n' $(sort $(FATE))
192
193 coverage.info: TAG = LCOV
194 coverage.info:
195         $(M)lcov -q -d $(CURDIR) -b $(SRC_PATH) --capture | \
196             sed "s,$(CURDIR)/\./,$(CURDIR)/," > $@
197         $(M)lcov -q --remove $@ "/usr*" -o $@
198
199 lcov:  TAG = GENHTML
200 lcov: coverage.info
201         $(M)genhtml -q -o $(CURDIR)/lcov $<
202
203 lcov-reset: TAG = LCOV
204 lcov-reset:
205         $(M)lcov -d $(CURDIR) --zerocounters
206         $(Q)$(RM) -f coverage.info
207
208 clean:: testclean
209
210 testclean:
211         $(RM) -r tests/vsynth1 tests/data tools/lavfi-showfiltfmts$(EXESUF)
212         $(RM) $(CLEANSUFFIXES:%=tests/%)
213         $(RM) $(TESTTOOLS:%=tests/%$(HOSTEXESUF))
214         $(RM) tests/pixfmts.mak
215
216 -include $(wildcard tests/*.d)
217
218 .PHONY: fate* lcov lcov-reset
219 .INTERMEDIATE: coverage.info