From 0c933db8a89e9f86fdf7663f9fc13eff2b2b6579 Mon Sep 17 00:00:00 2001 From: Christian Krause Date: Sat, 8 Aug 2015 12:30:49 +0200 Subject: [PATCH] testing framework and first test --- .gitignore | 6 ++++++ Makefile.am | 2 +- configure.ac | 3 ++- test/Makefile.am | 7 +++++++ test/single-file-round-trip.sh | 14 ++++++++++++++ 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 test/Makefile.am create mode 100644 test/single-file-round-trip.sh diff --git a/.gitignore b/.gitignore index 1c07a37..4581266 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ Makefile.in /install-sh /ltmain.sh /missing +/test-driver # created by configure @@ -38,3 +39,8 @@ Makefile pixz pixz.1 *.tar.* + +# created by make check + +/test/*.log +/test/*.trs diff --git a/Makefile.am b/Makefile.am index 67f4286..a1dbe88 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src +SUBDIRS = src test EXTRA_DIST = LICENSE m4 NEWS README test.sh TODO diff --git a/configure.ac b/configure.ac index a4604da..0b9111d 100644 --- a/configure.ac +++ b/configure.ac @@ -46,5 +46,6 @@ AC_FUNC_STRTOD AC_CHECK_FUNCS([memchr memmove memset strtol]) AC_CONFIG_FILES([Makefile - src/Makefile]) + src/Makefile + test/Makefile]) AC_OUTPUT diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..0b65468 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,7 @@ +TESTS = \ + single-file-round-trip.sh + +EXTRA_DIST = $(TESTS) + +TEST_EXTENSIONS = .sh +SH_LOG_COMPILER = bash diff --git a/test/single-file-round-trip.sh b/test/single-file-round-trip.sh new file mode 100644 index 0000000..5784138 --- /dev/null +++ b/test/single-file-round-trip.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +PIXZ=../src/pixz + +INPUT=$(basename $0) + +COMPRESSED=$INPUT.xz +UNCOMPRESSED=$INPUT.extracted +trap "rm -f $COMPRESSED $UNCOMPRESSED" EXIT + +$PIXZ $INPUT $COMPRESSED +$PIXZ -d $COMPRESSED $UNCOMPRESSED + +[[ $(cat $INPUT | md5sum) = $(cat $UNCOMPRESSED | md5sum) ]] || exit 1