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