]> granicus.if.org Git - libvpx/commitdiff
Build unit test driver from the default target
authorJohn Koleszar <jkoleszar@google.com>
Fri, 29 Jun 2012 19:15:00 +0000 (12:15 -0700)
committerJohn Koleszar <jkoleszar@google.com>
Fri, 29 Jun 2012 22:03:50 +0000 (15:03 -0700)
We need an easy way to build the unit test driver without running the
tests. This enables passing options like --gtest_filter to the
executable, which can't be done very cleanly when running under
`make test`.

Fixed a number of compiler errors/warnings when building the tests
in various configurations by Jenkins.

Change-Id: I9198122600bcf02520688e5f052ab379f963b77b

libs.mk
test/test.mk
vpx/internal/vpx_codec_internal.h

diff --git a/libs.mk b/libs.mk
index 0ddc69a64a3368532c5bc49ead73d4bde95ca9a6..d4a164d8c940e5ece82ab97bdc7a64104ba10b79 100644 (file)
--- a/libs.mk
+++ b/libs.mk
@@ -360,6 +360,7 @@ LIBVPX_TEST_BINS=./test_libvpx
 LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
                      $(call enabled,LIBVPX_TEST_DATA))
 libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
+BINS-yes += $(LIBVPX_TEST_BINS)
 
 $(LIBVPX_TEST_DATA):
        @echo "    [DOWNLOAD] $@"
@@ -369,8 +370,12 @@ $(LIBVPX_TEST_DATA):
 testdata:: $(LIBVPX_TEST_DATA)
        $(qexec)if [ -x "$$(which sha1sum)" ]; then\
             echo "Checking test data:";\
-            (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c)\
-                < $(SRC_PATH_BARE)/test/test-data.sha1; \
+            if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
+                for f in $(call enabled,LIBVPX_TEST_DATA); do\
+                    grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
+                        (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
+                done; \
+            fi; \
         else\
             echo "Skipping test data integrity check, sha1sum not found.";\
         fi
@@ -432,8 +437,11 @@ INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
     $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
 
+CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
+CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
 $(foreach bin,$(LIBVPX_TEST_BINS),\
-    $(if $(BUILD_LIBVPX),$(eval $(bin): libvpx.a libgtest.a ))\
+    $(if $(BUILD_LIBVPX),$(eval $(bin): \
+        lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
     $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
         $(LIBVPX_TEST_OBJS) \
         -L. -lvpx -lgtest -lpthread -lm)\
index ae5016c77566767834d1fe1dfd932ac5573bf262..2096b365b879d2ad7e1ee4e6984f1f9ba0ded3a8 100644 (file)
@@ -1,16 +1,41 @@
 LIBVPX_TEST_SRCS-yes += test.mk
-LIBVPX_TEST_SRCS-yes += boolcoder_test.cc
-LIBVPX_TEST_SRCS-yes += config_test.cc
-LIBVPX_TEST_SRCS-yes += encode_test_driver.cc
-LIBVPX_TEST_SRCS-yes += encode_test_driver.h
-LIBVPX_TEST_SRCS-yes += i420_video_source.h
-LIBVPX_TEST_SRCS-yes += idctllm_test.cc
-LIBVPX_TEST_SRCS-yes += intrapred_test.cc
-LIBVPX_TEST_SRCS-yes += fdct4x4_test.cc
-LIBVPX_TEST_SRCS-yes += keyframe_test.cc
-LIBVPX_TEST_SRCS-yes += pp_filter_test.cc
-LIBVPX_TEST_SRCS-yes += resize_test.cc
 LIBVPX_TEST_SRCS-yes += test_libvpx.cc
-LIBVPX_TEST_SRCS-yes += video_source.h
 
-LIBVPX_TEST_DATA-yes += hantro_collage_w352h288.yuv
+##
+## BLACK BOX TESTS
+##
+## Black box tests only use the public API.
+##
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += config_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += encode_test_driver.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += encode_test_driver.h
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += i420_video_source.h
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += keyframe_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += resize_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += video_source.h
+
+##
+## WHITE BOX TESTS
+##
+## Whitebox tests invoke functions not exposed via the public API. Certain
+## shared library builds don't make these functions accessible.
+##
+ifeq ($(CONFIG_SHARED),)
+
+# These tests require both the encoder and decoder to be built.
+ifeq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),yesyes)
+LIBVPX_TEST_SRCS-yes                   += boolcoder_test.cc
+endif
+
+LIBVPX_TEST_SRCS-$(CONFIG_VP8_ENCODER) += fdct4x4_test.cc
+LIBVPX_TEST_SRCS-yes                   += idctllm_test.cc
+LIBVPX_TEST_SRCS-yes                   += intrapred_test.cc
+LIBVPX_TEST_SRCS-$(CONFIG_POSTPROC)    += pp_filter_test.cc
+
+endif
+
+
+##
+## TEST DATA
+##
+LIBVPX_TEST_DATA-$(CONFIG_VP8_ENCODER) += hantro_collage_w352h288.yuv
index 0703d6a4f2c02adc6ea8eca7145fcb15819e7e02..447433111d1292d26a50d3ec5601c33908aaf354 100644 (file)
@@ -165,7 +165,7 @@ typedef vpx_codec_err_t (*vpx_codec_control_fn_t)(vpx_codec_alg_priv_t  *ctx,
  * mapping. This implies that ctrl_id values chosen by the algorithm
  * \ref MUST be non-zero.
  */
-typedef const struct
+typedef const struct vpx_codec_ctrl_fn_map
 {
     int                    ctrl_id;
     vpx_codec_control_fn_t   fn;
@@ -280,7 +280,7 @@ typedef vpx_codec_err_t
  * one mapping must be present, in addition to the end-of-list.
  *
  */
-typedef const struct
+typedef const struct vpx_codec_enc_cfg_map
 {
     int                 usage;
     vpx_codec_enc_cfg_t cfg;
@@ -302,14 +302,14 @@ struct vpx_codec_iface
     vpx_codec_ctrl_fn_map_t  *ctrl_maps;   /**< \copydoc ::vpx_codec_ctrl_fn_map_t */
     vpx_codec_get_mmap_fn_t   get_mmap;    /**< \copydoc ::vpx_codec_get_mmap_fn_t */
     vpx_codec_set_mmap_fn_t   set_mmap;    /**< \copydoc ::vpx_codec_set_mmap_fn_t */
-    struct
+    struct vpx_codec_dec_iface
     {
         vpx_codec_peek_si_fn_t    peek_si;     /**< \copydoc ::vpx_codec_peek_si_fn_t */
         vpx_codec_get_si_fn_t     get_si;      /**< \copydoc ::vpx_codec_peek_si_fn_t */
         vpx_codec_decode_fn_t     decode;      /**< \copydoc ::vpx_codec_decode_fn_t */
         vpx_codec_get_frame_fn_t  get_frame;   /**< \copydoc ::vpx_codec_get_frame_fn_t */
     } dec;
-    struct
+    struct vpx_codec_enc_iface
     {
         vpx_codec_enc_cfg_map_t           *cfg_maps;      /**< \copydoc ::vpx_codec_enc_cfg_map_t */
         vpx_codec_encode_fn_t              encode;        /**< \copydoc ::vpx_codec_encode_fn_t */