summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-12-31 11:11:14 +0100
committerMax Kellermann <max@duempel.org>2009-12-31 15:50:59 +0100
commita0384aaead1427e9f7bd3643c4149371d687e53d (patch)
tree7a60322cedc1fb3af7c01ad773053ea2fe33f7a9
parentefc885a9dc2e6632ca2a24a0ff52ab51bb1d82d1 (diff)
Makefile.am: added unit tests for the archive plugins
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am14
-rw-r--r--NEWS1
-rw-r--r--configure.ac18
-rwxr-xr-xtest/test_archive_bzip2.sh10
-rwxr-xr-xtest/test_archive_iso9660.sh10
-rwxr-xr-xtest/test_archive_zzip.sh10
7 files changed, 64 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 551ab47c3..3ce1b5582 100644
--- a/.gitignore
+++ b/.gitignore
@@ -55,3 +55,4 @@ test/run_input
test/read_mixer
test/dump_playlist
test/run_normalize
+test/tmp
diff --git a/Makefile.am b/Makefile.am
index b703529a9..020a2aeec 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -755,6 +755,8 @@ sparse-check:
if ENABLE_TEST
+TESTS =
+
noinst_PROGRAMS = \
test/read_conf \
test/run_input \
@@ -974,6 +976,18 @@ test_read_mixer_SOURCES = test/read_mixer.c \
src/fd_util.c \
$(MIXER_SRC)
+if ENABLE_BZIP2_TEST
+TESTS += test/test_archive_bzip2.sh
+endif
+
+if ENABLE_ZZIP_TEST
+TESTS += test/test_archive_zzip.sh
+endif
+
+if ENABLE_ISO9660_TEST
+TESTS += test/test_archive_iso9660.sh
+endif
+
endif
diff --git a/NEWS b/NEWS
index e54d1223f..92f737c63 100644
--- a/NEWS
+++ b/NEWS
@@ -80,6 +80,7 @@ ver 0.16 (20??/??/??)
* CUE sheet support
* obey $(sysconfdir) for default mpd.conf location
* build with large file support by default
+* added test suite ("make check")
* require GLib 2.12
diff --git a/configure.ac b/configure.ac
index d2313a654..c45574b0b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -353,8 +353,14 @@ fi
AM_CONDITIONAL(HAVE_BZ2, test x$enable_bzip2 = xyes)
if test x$enable_bzip2 = xyes; then
AC_DEFINE(HAVE_BZ2, 1, [Define to have bz2 archive support])
+
+ AC_PATH_PROG(BZIP2, bzip2, no)
+else
+ BZIP2="no"
fi
+AM_CONDITIONAL(ENABLE_BZIP2_TEST, test x$BZIP2 != xno)
+
dnl zzip
AC_ARG_ENABLE(zzip,
AS_HELP_STRING([--enable-zzip],
@@ -367,8 +373,14 @@ MPD_AUTO_PKG(zzip, ZZIP, [zziplib >= 0.13],
AM_CONDITIONAL(HAVE_ZZIP, test x$enable_zzip = xyes)
if test x$enable_zzip = xyes; then
AC_DEFINE(HAVE_ZZIP, 1, [Define to have zip archive support])
+
+ AC_PATH_PROG(ZIP, zip, no)
+else
+ ZIP="no"
fi
+AM_CONDITIONAL(ENABLE_ZZIP_TEST, test x$ZIP != xno)
+
dnl iso9660
AC_ARG_ENABLE(iso9660,
AS_HELP_STRING([--enable-iso9660],
@@ -381,8 +393,14 @@ MPD_AUTO_PKG(iso9660, ISO9660, [libiso9660],
AM_CONDITIONAL(HAVE_ISO9660, test x$enable_iso9660 = xyes)
if test x$enable_iso9660 = xyes; then
AC_DEFINE(HAVE_ISO9660, 1, [Define to have ISO9660 archive support])
+
+ AC_PATH_PROG(MKISOFS, mkisofs, no)
+else
+ MKISOFS="no"
fi
+AM_CONDITIONAL(ENABLE_ISO9660_TEST, test x$MKISOFS != xno)
+
dnl archive API
if
test x$enable_bzip2 = xyes ||
diff --git a/test/test_archive_bzip2.sh b/test/test_archive_bzip2.sh
new file mode 100755
index 000000000..2c45076aa
--- /dev/null
+++ b/test/test_archive_bzip2.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+SRC_BASE=configure
+SRC="$(dirname $0)/../${SRC_BASE}"
+DST="$(pwd)/test/tmp/${SRC_BASE}.bz2"
+
+mkdir -p test/tmp
+rm -f "$DST"
+bzip2 -c "$SRC" >"$DST"
+./test/run_input "$DST/${SRC_BASE}" |diff "$SRC" -
diff --git a/test/test_archive_iso9660.sh b/test/test_archive_iso9660.sh
new file mode 100755
index 000000000..070d2da0a
--- /dev/null
+++ b/test/test_archive_iso9660.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+SRC_BASE=configure
+SRC="$(dirname $0)/../${SRC_BASE}"
+DST="$(pwd)/test/tmp/${SRC_BASE}.iso"
+
+mkdir -p test/tmp
+rm -f "$DST"
+mkisofs -quiet -l -o "$DST" "$SRC"
+./test/run_input "$DST/${SRC_BASE}" |diff "$SRC" -
diff --git a/test/test_archive_zzip.sh b/test/test_archive_zzip.sh
new file mode 100755
index 000000000..a8d23f6d7
--- /dev/null
+++ b/test/test_archive_zzip.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+SRC_BASE=configure
+SRC="$(dirname $0)/../${SRC_BASE}"
+DST="$(pwd)/test/tmp/${SRC_BASE}.zip"
+
+mkdir -p test/tmp
+rm -f "$DST"
+zip --quiet --junk-paths "$DST" "$SRC"
+./test/run_input "$DST/${SRC_BASE}" |diff "$SRC" -