[FFmpeg-devel] [PATCH] avutil/tests: run the cpu_init.c test conditionally on HAVE_THREADS

Wan-Teh Chang wtc at google.com
Tue Dec 6 21:00:02 EET 2016


Also declare the main() function with void arguments because argc and
argv are unused.

These changes are suggested by Diego Biurrun and James Almer.

Signed-off-by: Wan-Teh Chang <wtc at google.com>
---
 libavutil/Makefile         | 2 +-
 libavutil/tests/cpu_init.c | 9 +--------
 tests/fate/libavutil.mak   | 2 +-
 3 files changed, 3 insertions(+), 10 deletions(-)

diff --git a/libavutil/Makefile b/libavutil/Makefile
index c61ca9c..607fe6a 100644
--- a/libavutil/Makefile
+++ b/libavutil/Makefile
@@ -188,7 +188,6 @@ TESTPROGS = adler32                                                     \
             camellia                                                    \
             color_utils                                                 \
             cpu                                                         \
-            cpu_init                                                    \
             crc                                                         \
             des                                                         \
             dict                                                        \
@@ -223,6 +222,7 @@ TESTPROGS = adler32                                                     \
             tea                                                         \
 
 TESTPROGS-$(HAVE_LZO1X_999_COMPRESS) += lzo
+TESTPROGS-$(HAVE_THREADS) += cpu_init
 
 TOOLS = crypto_bench ffhash ffeval ffescape
 
diff --git a/libavutil/tests/cpu_init.c b/libavutil/tests/cpu_init.c
index 5a5ecda..a379e47 100644
--- a/libavutil/tests/cpu_init.c
+++ b/libavutil/tests/cpu_init.c
@@ -24,12 +24,9 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "config.h"
-
 #include "libavutil/cpu.h"
 #include "libavutil/thread.h"
 
-#if HAVE_PTHREADS
 static void *thread_main(void *arg)
 {
     int *flags = arg;
@@ -37,12 +34,9 @@ static void *thread_main(void *arg)
     *flags = av_get_cpu_flags();
     return NULL;
 }
-#endif
-
 
-int main(int argc, char **argv)
+int main(void)
 {
-#if HAVE_PTHREADS
     int cpu_flags1;
     int cpu_flags2;
     int ret;
@@ -66,7 +60,6 @@ int main(int argc, char **argv)
         return 2;
     if (cpu_flags1 != cpu_flags2)
         return 3;
-#endif
 
     return 0;
 }
diff --git a/tests/fate/libavutil.mak b/tests/fate/libavutil.mak
index 0ab6fc5..4ecc741 100644
--- a/tests/fate/libavutil.mak
+++ b/tests/fate/libavutil.mak
@@ -44,7 +44,7 @@ fate-cpu: libavutil/tests/cpu$(EXESUF)
 fate-cpu: CMD = runecho libavutil/tests/cpu $(CPUFLAGS:%=-c%) $(THREADS:%=-t%)
 fate-cpu: REF = /dev/null
 
-FATE_LIBAVUTIL += fate-cpu_init
+FATE_LIBAVUTIL-$(HAVE_THREADS) += fate-cpu_init
 fate-cpu_init: libavutil/tests/cpu_init$(EXESUF)
 fate-cpu_init: CMD = run libavutil/tests/cpu_init
 fate-cpu_init: REF = /dev/null
-- 
2.8.0.rc3.226.g39d4020



More information about the ffmpeg-devel mailing list