diff options
author | Antti Ajanki <antti.ajanki@iki.fi> | 2011-04-17 13:29:41 +0300 |
---|---|---|
committer | Antti Ajanki <antti.ajanki@iki.fi> | 2011-04-17 13:29:41 +0300 |
commit | cff257c3a082608e4b91313b79f73020f14e6e53 (patch) | |
tree | cdc7295a510fe3f6cf9057a949ec2cf244f04364 /src | |
parent | 195747fe7a354bbd9b439203b3fb9a0f56bd1ebe (diff) | |
download | vdr-plugin-webvideo-cff257c3a082608e4b91313b79f73020f14e6e53.tar.gz vdr-plugin-webvideo-cff257c3a082608e4b91313b79f73020f14e6e53.tar.bz2 |
Fix testdownload, "make check" executes unittests
Diffstat (limited to 'src')
-rw-r--r-- | src/libwebvi/Makefile | 2 | ||||
-rw-r--r-- | src/unittest/Makefile | 24 | ||||
-rwxr-xr-x | src/unittest/runtests.sh | 7 | ||||
-rw-r--r-- | src/unittest/testdownload.c | 11 |
4 files changed, 33 insertions, 11 deletions
diff --git a/src/libwebvi/Makefile b/src/libwebvi/Makefile index 895478f..d5a2ff1 100644 --- a/src/libwebvi/Makefile +++ b/src/libwebvi/Makefile @@ -20,6 +20,8 @@ $(LIBMINOR): libwebvi.o ln -sf $(LIBMINOR) $(LIBSONAME) ln -sf $(LIBSONAME) $(LIBNAME) +libwebvi.so: $(LIBMINOR) + libwebvi.a: libwebvi.o ar rsc libwebvi.a libwebvi.o diff --git a/src/unittest/Makefile b/src/unittest/Makefile index 81b0ea2..9d82fb4 100644 --- a/src/unittest/Makefile +++ b/src/unittest/Makefile @@ -1,11 +1,33 @@ CFLAGS=-O2 -g -Wall -I../libwebvi LDFLAGS=-L../libwebvi -Wl,-rpath=../libwebvi -lwebvi +.PHONY: all clean check test + all: testlibwebvi testdownload testlibwebvi: testlibwebvi.o ../libwebvi/libwebvi.so - testdownload: testdownload.o ../libwebvi/libwebvi.so +../libwebvi/libwebvi.so: + make -C ../libwebvi libwebvi.so + clean: rm -f testlibwebvi testlibwebvi.o testdownload testdownload.o + +# testdownload and testwebvi.py require network access +check: testlibwebvi testdownload + FAILED_TESTS=; \ + PYTHONPATH=../libwebvi ./testlibwebvi; \ + if [ $$? -ne 0 ]; then echo "$$?"; FAILED_TESTS="$$FAILED_TESTS testlibwebvi"; fi; \ + PYTHONPATH=../libwebvi ./testdownload; \ + if [ $$? -ne 0 ]; then FAILED_TESTS="$$FAILED_TESTS testdownload"; fi; \ + PYTHONPATH=../libwebvi python ./testwebvi.py; \ + if [ $$? -ne 0 ]; then FAILED_TESTS="$$FAILED_TESTS testwebvi.py"; fi; \ + echo "================================================"; \ + if [ -n $$FAILED_TEST ]; then \ + echo "The following tests failed:$$FAILED_TESTS"; \ + else \ + echo "Tests completed successfully!"; \ + fi + +test: check diff --git a/src/unittest/runtests.sh b/src/unittest/runtests.sh deleted file mode 100755 index 9afc7a5..0000000 --- a/src/unittest/runtests.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -export PYTHONPATH=../libwebvi - -./testlibwebvi -#./testdownload -#./testwebvi.py diff --git a/src/unittest/testdownload.c b/src/unittest/testdownload.c index 134150a..07cd124 100644 --- a/src/unittest/testdownload.c +++ b/src/unittest/testdownload.c @@ -23,7 +23,7 @@ #include "libwebvi.h" -#define WVTREFERENCE "wvt:///youtube/video.xsl?srcurl=http%3A//www.youtube.com/watch%3Fv%3Dk5LmKNYTqvk" +#define WVTREFERENCE "wvt:///www.youtube.com/videopage.xsl?srcurl=http%3A//www.youtube.com/watch%3Fv%3Dk5LmKNYTqvk" #define CHECK_WEBVI_CALL(err, funcname) \ if (err != WEBVIERR_OK) { \ @@ -180,8 +180,13 @@ int main(int argc, const char* argv[]) { } while (msg_remaining > 0); } while (!done); - printf("\nRead %ld bytes.\n" - "Test successful.\n", callback_data.bytes_downloaded); + if (donemsg->status_code != 0) { + printf("Error: Unexpected status code %d\n", donemsg->status_code); + returncode = 127; + } else { + printf("\nRead %ld bytes.\n" + "Test successful.\n", callback_data.bytes_downloaded); + } cleanup: if (ctx != 0) { |