]> granicus.if.org Git - libvpx/commitdiff
Add support for downloading test data
authorJohn Koleszar <jkoleszar@google.com>
Wed, 20 Jun 2012 21:45:22 +0000 (14:45 -0700)
committerJohn Koleszar <jkoleszar@google.com>
Thu, 21 Jun 2012 17:41:48 +0000 (10:41 -0700)
The commit introduces a make target 'testdata' that downloads the
required test data from the WebM project website. The data will also
be downloaded if invoking `make test` but is not a strict requirement
for only building the test executable.

The download directory is taken from the LIBVPX_TEST_DATA_PATH
environment variable, or may be specified as part of the make command.
If unset, it defaults to the current directory. It's expected that
most developers will want to set this environment variable to a place
outside their source/build trees, to avoid having to download the data
more than once.

To add test data file:

  1) add a line to test/test.mk:

      LIBVPX_TEST_DATA-yes += foo-bar-file.y4m

  2) add its sha1sum to the test/test-data.sha1 file in the following
     format:

      528cc88c821e5f5b133c2b40f9c8e3f22eaacc4c  foo-bar-file.y4m

  3) upload the file to the website

      $ gsutil cp foo-bar-file.y4m gs://downloads.webmproject.org/test_data/libvpx

This implementation will check the integrity of the test data
automatically if the `sha1sum` executable is available.

Change-Id: If6910fe304bb3f5cdcc5cb9e5f9afa5be74720d2

README
build/make/Makefile
libs.mk

diff --git a/README b/README
index 0dfb0fe186b865c1d8699de3ed4e12ab5b70d464..0475dad791ea51899d97a13c0dfe025f82e23fc4 100644 (file)
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
 vpx Multi-Format Codec SDK
-README - 19 May 2010
+README - 21 June 2012
 
 Welcome to the WebM VP8 Codec SDK!
 
@@ -15,11 +15,19 @@ COMPILING THE APPLICATIONS/LIBRARIES:
     * Building the documentation requires PHP[3] and Doxygen[4]. If you do not
       have these packages, you must pass --disable-install-docs to the
       configure script.
+    * Downloading the data for the unit tests requires curl[5] and sha1sum.
+      sha1sum is provided via the GNU coreutils, installed by default on
+      many *nix platforms, as well as MinGW and Cygwin. If coreutils is not
+      available, a compatible version of sha1sum can be built from
+      source[6]. These requirements are optional if not running the unit
+      tests.
 
     [1]: http://www.tortall.net/projects/yasm
     [2]: http://www.cygwin.com
     [3]: http://php.net
     [4]: http://www.doxygen.org
+    [5]: http://curl.haxx.se
+    [6]: http://www.microbrew.org/tools/md5sha1sum/
 
   2. Out-of-tree builds
   Out of tree builds are a supported method of building the application. For
@@ -94,5 +102,5 @@ COMPILING THE APPLICATIONS/LIBRARIES:
 
 SUPPORT
   This library is an open source project supported by its community. Please
-  please email webm-users@webmproject.org for help.
+  please email webm-discuss@webmproject.org for help.
 
index 26ca0be70dfdfdeedf4a55a5e03c03742222a38f..1088c841a159369b71b8a084cf72c7fe8c74020e 100644 (file)
@@ -21,6 +21,7 @@ all: .DEFAULT
 clean:: .DEFAULT
 install:: .DEFAULT
 test:: .DEFAULT
+testdata:: .DEFAULT
 
 
 # Note: md5sum is not installed on OS X, but openssl is. Openssl may not be
@@ -99,6 +100,8 @@ dist:
 install::
 .PHONY: test
 test::
+.PHONY: testdata
+testdata::
 
 $(BUILD_PFX)%.c.d: %.c
        $(if $(quiet),@echo "    [DEP] $@")
diff --git a/libs.mk b/libs.mk
index 1f4ffa29874600bfe88e9c5fed8cda4461932922..0ddc69a64a3368532c5bc49ead73d4bde95ca9a6 100644 (file)
--- a/libs.mk
+++ b/libs.mk
@@ -352,10 +352,28 @@ CODEC_DOC_SRCS += vpx/vpx_codec.h \
 ## libvpx test directives
 ##
 ifeq ($(CONFIG_UNIT_TESTS),yes)
+LIBVPX_TEST_DATA_PATH ?= .
 
 include $(SRC_PATH_BARE)/test/test.mk
 LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
 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)
+
+$(LIBVPX_TEST_DATA):
+       @echo "    [DOWNLOAD] $@"
+       $(qexec)trap 'rm -f $@' INT TERM &&\
+            curl -L -o $@ $(call libvpx_test_data_url,$(@F))
+
+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; \
+        else\
+            echo "Skipping test data integrity check, sha1sum not found.";\
+        fi
 
 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
 ifeq ($(CONFIG_MSVS),yes)
@@ -390,7 +408,7 @@ test_libvpx.vcproj: $(LIBVPX_TEST_SRCS)
 
 PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj
 
-test::
+test:: testdata
        @set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
 endif
 else
@@ -422,7 +440,7 @@ $(foreach bin,$(LIBVPX_TEST_BINS),\
         )))\
     $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
 
-test:: $(LIBVPX_TEST_BINS)
+test:: $(LIBVPX_TEST_BINS) testdata
        @set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
 
 endif