summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2012-06-29 12:15:00 -0700
committerJohn Koleszar <jkoleszar@google.com>2012-06-29 15:03:50 -0700
commitacd147c50c02e43b1426450033b71d8ad28e6b98 (patch)
tree6f84b5f556b41392444ffcc3c5da6e95fd92c340
parente7bbedce5f2b9ecaeb4ebf1bfe446d8895cdf105 (diff)
downloadlibvpx-acd147c50c02e43b1426450033b71d8ad28e6b98.tar
libvpx-acd147c50c02e43b1426450033b71d8ad28e6b98.tar.gz
libvpx-acd147c50c02e43b1426450033b71d8ad28e6b98.tar.bz2
libvpx-acd147c50c02e43b1426450033b71d8ad28e6b98.zip
Build unit test driver from the default target
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
-rw-r--r--libs.mk14
-rw-r--r--test/test.mk51
-rw-r--r--vpx/internal/vpx_codec_internal.h8
3 files changed, 53 insertions, 20 deletions
diff --git a/libs.mk b/libs.mk
index 0ddc69a64..d4a164d8c 100644
--- 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)\
diff --git a/test/test.mk b/test/test.mk
index ae5016c77..2096b365b 100644
--- a/test/test.mk
+++ b/test/test.mk
@@ -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
diff --git a/vpx/internal/vpx_codec_internal.h b/vpx/internal/vpx_codec_internal.h
index 0703d6a4f..447433111 100644
--- a/vpx/internal/vpx_codec_internal.h
+++ b/vpx/internal/vpx_codec_internal.h
@@ -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 */