summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2018-03-25 21:17:18 -0700
committerSergey Poznyakoff <gray@gnu.org>2018-04-07 10:32:38 +0300
commite8c3f4860d6b821f9e1df322821df2895596ac22 (patch)
tree5720edce067eb96e9dad2141df15fa038895a9da
parent00f03498a949dd8a0abb6b78b1fddd948bc67a9e (diff)
downloadtar-e8c3f4860d6b821f9e1df322821df2895596ac22.tar.gz
tests: add coverage for new --zstd and all other compression tools
* tests/compress.at.in: New file: template from which each per-compression-tool test is derived. * tests/Makefile.am (TESTSUITE_AT): Add it. (EXTRA_DIST): Add compress.at.in. (compress-*.at): New rules to generate a file/tests for each compression tool. * tests/testsuite.at (Compression): Add each of these generated files in a new section. * tests/.gitignore: Ignore the new generated files.
-rw-r--r--tests/.gitignore1
-rw-r--r--tests/Makefile.am48
-rw-r--r--tests/compress.at.in67
-rw-r--r--tests/testsuite.at10
4 files changed, 124 insertions, 2 deletions
diff --git a/tests/.gitignore b/tests/.gitignore
index 9c0103d3..802adb1a 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -12,3 +12,4 @@ download
ttyemu
checkseekhole
ckmtime
+/compress-*.at
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2d7939d5..fb463252 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,9 +17,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 star/README star/quicktest.sh
+EXTRA_DIST = $(TESTSUITE_AT) \
+ testsuite package.m4 star/README star/quicktest.sh \
+ compress.at.in
+
DISTCLEANFILES = atconfig $(check_SCRIPTS)
MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+CLEANFILES =
## ------------ ##
## package.m4. ##
@@ -66,6 +70,12 @@ TESTSUITE_AT = \
chtype.at\
comprec.at\
comperr.at\
+ compress-zstd.at\
+ compress-xz.at\
+ compress-bzip2.at\
+ compress-gzip.at\
+ compress-lzip.at\
+ compress-lzop.at\
delete01.at\
delete02.at\
delete03.at\
@@ -264,6 +274,42 @@ TESTSUITE_AT = \
selacl01.at\
capabs_raw01.at
+CLEANFILES += compress-zstd.at
+compress-zstd.at: compress.at.in
+ $(AM_V_GEN)rm -rf $@ $@-t
+ $(AM_V_at)sed 's/@tool@/zstd/g;s/@suff@/zst/g;s/@suff2@/tzst/g;' \
+ $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
+
+CLEANFILES += compress-gzip.at
+compress-gzip.at: compress.at.in
+ $(AM_V_GEN)rm -rf $@ $@-t
+ $(AM_V_at)sed 's/@tool@/gzip/g;s/@suff@/gz/g;s/@suff2@/tgz/g;' \
+ $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
+
+CLEANFILES += compress-xz.at
+compress-xz.at: compress.at.in
+ $(AM_V_GEN)rm -rf $@ $@-t
+ $(AM_V_at)sed 's/@tool@/xz/g;s/@suff@/xz/g;s/@suff2@/txz/g;' \
+ $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
+
+CLEANFILES += compress-bzip2.at
+compress-bzip2.at: compress.at.in
+ $(AM_V_GEN)rm -rf $@ $@-t
+ $(AM_V_at)sed 's/@tool@/bzip2/g;s/@suff@/bz2/g;s/@suff2@/tbz2/g;' \
+ $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
+
+CLEANFILES += compress-lzip.at
+compress-lzip.at: compress.at.in
+ $(AM_V_GEN)rm -rf $@ $@-t
+ $(AM_V_at)sed 's/@tool@/lzip/g;s/@suff@/lz/g;s/@suff2@//g;' \
+ $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
+
+CLEANFILES += compress-lzop.at
+compress-lzop.at: compress.at.in
+ $(AM_V_GEN)rm -rf $@ $@-t
+ $(AM_V_at)sed 's/@tool@/lzop/g;s/@suff@/lzo/g;s/@suff2@//g;' \
+ $(srcdir)/compress.at.in > $@-t && chmod a-w $@-t && mv $@-t $@
+
distclean-local:
-rm -rf download
diff --git a/tests/compress.at.in b/tests/compress.at.in
new file mode 100644
index 00000000..e9cc76a4
--- /dev/null
+++ b/tests/compress.at.in
@@ -0,0 +1,67 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU tar.
+# Copyright 2018 Free Software Foundation, Inc.
+
+# This file is part of GNU tar.
+
+# GNU tar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+
+# GNU tar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# tar can create/decompress @tool@-compressed tarballs
+
+AT_SETUP([compress: @tool@])
+AT_KEYWORDS([compression @tool@])
+
+unset TAR_OPTIONS
+
+AT_CHECK([
+AT_GZIP_PREREQ([@tool@])
+
+touch empty
+# Create with --@tool@:
+tar --@tool@ -cf - empty 2>err > k.tar.@suff@ || exit 1
+test -s err && exit 1
+tar tf k.tar.@suff@ 2>err > out || exit 1
+test "$(cat out)" = empty || exit 1
+test -s err && exit 1
+
+# Ensure -ac works with an -f-specified .@suff@-suffixed name.
+tar -acf k2.tar.@suff@ empty 2>err > out || exit 1
+cmp k2.tar.@suff@ k.tar.@suff@ || exit 1
+test -s err && exit 1
+
+# Extraction: ensure the .@suff@ suffix is recognized.
+rm -f empty || exit 1
+tar xf k.tar.@suff@ 2>err > out || exit 1
+test -s err && exit 1
+test -f empty || exit 1
+
+if test -n '@suff2@'; then
+ # Extraction: ensure the .@suff2@ suffix is also recognized.
+ mv k.tar.@suff@ k.@suff2@ || exit 1
+ rm -f empty
+ tar xf k.@suff2@ 2>err > out || exit 1
+ test -s err && exit 1
+ test -f empty || exit 1
+else
+ :
+fi
+
+],
+[0],
+[],
+[],
+[],[])
+
+AT_CLEANUP
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 0f2600fb..dcccc7b1 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -216,6 +216,15 @@ m4_include([opcomp04.at])
m4_include([opcomp05.at])
m4_include([opcomp06.at])
+AT_BANNER([Compression])
+m4_include([compress-gzip.at])
+m4_include([compress-bzip2.at])
+m4_include([compress-xz.at])
+dnl: omit lzma, because it would fail due to magic number mismatch
+m4_include([compress-lzip.at])
+m4_include([compress-lzop.at])
+m4_include([compress-zstd.at])
+
AT_BANNER([Positional options])
m4_include([positional01.at])
m4_include([positional02.at])
@@ -490,4 +499,3 @@ m4_include([star/ustar-big-2g.at])
m4_include([star/ustar-big-8g.at])
m4_include([star/pax-big-10g.at])
-