[FFmpeg-devel] [PATCH 2/3] Selftest coverage for libavutil/fifo.c

Thomas Turner thomastdt at googlemail.com
Tue Oct 11 06:56:52 EEST 2016


code coverage for av_fifo_grow(...), av_fifo_generic_peek(...)

Modified the folling files to get the selftest program to compile with:
"make fate-fifo2"
---
 libavutil/Makefile       | 1 +
 libavutil/tests/fifo2.c  | 3 ++-
 tests/fate/libavutil.mak | 4 ++++
 tests/ref/fate/fifo2     | 3 +++
 4 files changed, 10 insertions(+), 1 deletion(-)
 create mode 100644 tests/ref/fate/fifo2

diff --git a/libavutil/Makefile b/libavutil/Makefile
index 0fa90fe..a34171e 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -195,6 +195,7 @@ TESTPROGS = adler32                                                     \
             eval                                                        \
             file                                                        \
             fifo                                                        \
+            fifo2                                                       \
             float_dsp                                                   \
             hash                                                        \
             hmac                                                        \
diff --git a/libavutil/tests/fifo2.c b/libavutil/tests/fifo2.c
index 923feee..e40b8cd 100644
--- a/libavutil/tests/fifo2.c
+++ b/libavutil/tests/fifo2.c
@@ -35,7 +35,8 @@ int main(void)
 
     /*fill fifo buffer*/
 
-    if (av_fifo_generic_write(fifo, (void*)elem, av_fifo_space(fifo), NULL) != sizeof(elem)) {
+    if (av_fifo_generic_write(fifo, (void*)elem, av_fifo_space(fifo), NULL) != 
+        sizeof(elem)) {
 
         fprintf(stderr, "written incorrect number of bytes\n");
         return 1;
diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak
index 6fbad64..fdf9086 100644
--- a/tests/fate/libavutil.mak
+++ b/tests/fate/libavutil.mak
@@ -69,6 +69,10 @@ FATE_LIBAVUTIL += fate-fifo
 fate-fifo: libavutil/tests/fifo$(EXESUF)
 fate-fifo: CMD = run libavutil/tests/fifo
 
+FATE_LIBAVUTIL += fate-fifo2
+fate-fifo2: libavutil/tests/fifo2$(EXESUF)
+fate-fifo2: CMD = run libavutil/tests/fifo2
+
 FATE_LIBAVUTIL += fate-float-dsp
 fate-float-dsp: libavutil/tests/float_dsp$(EXESUF)
 fate-float-dsp: CMD = run libavutil/tests/float_dsp $(CPUFLAGS:%=-c%)
diff --git a/tests/ref/fate/fifo2 b/tests/ref/fate/fifo2
new file mode 100644
index 0000000..8df9243
--- /dev/null
+++ b/tests/ref/fate/fifo2
@@ -0,0 +1,3 @@
+fifo->buffer: 0, 2, 4, 6, 8, 10, 12, 
+space before av_fifo_grow	:0
+space after av_fifo_grow	:28
-- 
1.9.1



More information about the ffmpeg-devel mailing list