aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-09-08 11:46:37 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-09-08 11:46:37 +0000
commit43dac0161087615861c9d2bfb8f1f7670da03ba1 (patch)
treed32a09967a8f2bc7dac1381a2b766c42e23fcf74
parenta375e9269afa78c2d6b8b69f42ade656ed758146 (diff)
downloadcpio-43dac0161087615861c9d2bfb8f1f7670da03ba1.tar.gz
cpio-43dac0161087615861c9d2bfb8f1f7670da03ba1.tar.bz2
Added support for the test suite
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac5
-rw-r--r--tests/.cvsignore11
-rw-r--r--tests/Makefile.am82
-rw-r--r--tests/atlocal.in6
-rw-r--r--tests/inout.at39
-rw-r--r--tests/testsuite.at31
-rw-r--r--tests/version.at34
8 files changed, 209 insertions, 1 deletions
diff --git a/Makefile.am b/Makefile.am
index e71bddf..e8f90cb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -19,4 +19,4 @@ ACLOCAL_AMFLAGS = -I m4
AUTOMAKE_OPTIONS = gnits 1.8 dist-bzip2 std-options
-SUBDIRS = doc headers lib rmt src po
+SUBDIRS = doc headers lib rmt src po tests
diff --git a/configure.ac b/configure.ac
index 9f3c00e..8741c42 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,6 +102,11 @@ AC_CHECK_LIB(socket, setsockopt, [LIBS="$LIBS -lsocket"])
AM_GNU_GETTEXT([external], [need-ngettext])
AM_GNU_GETTEXT_VERSION(0.13)
+# Initialize the test suite.
+AC_CONFIG_TESTDIR(tests)
+AC_CONFIG_FILES([tests/Makefile tests/atlocal]) # FIXME: tests/preset?
+AM_MISSING_PROG([AUTOM4TE], [autom4te])
+
AC_CONFIG_FILES([Makefile
doc/Makefile
headers/Makefile
diff --git a/tests/.cvsignore b/tests/.cvsignore
new file mode 100644
index 0000000..8197398
--- /dev/null
+++ b/tests/.cvsignore
@@ -0,0 +1,11 @@
+Makefile.in
+Makefile
+.deps
+genfile
+atconfig
+atlocal
+testsuite
+genfile.c
+testsuite.dir
+testsuite.log
+package.m4
diff --git a/tests/Makefile.am b/tests/Makefile.am
new file mode 100644
index 0000000..e197514
--- /dev/null
+++ b/tests/Makefile.am
@@ -0,0 +1,82 @@
+# Makefile for GNU cpio regression tests.
+
+# Copyright (C) 2004 Free Software Foundation, Inc.
+
+## This program 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 2, or (at your option)
+## any later version.
+
+## This program 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, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+## 02111-1307, USA.
+
+EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4
+DISTCLEANFILES = atconfig $(check_SCRIPTS)
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+
+## ------------ ##
+## package.m4. ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ { \
+ echo '# Signature of the current package.'; \
+ echo 'm4_define([AT_PACKAGE_NAME], [@PACKAGE_NAME@])'; \
+ echo 'm4_define([AT_PACKAGE_TARNAME], [@PACKAGE_TARNAME@])'; \
+ echo 'm4_define([AT_PACKAGE_VERSION], [@PACKAGE_VERSION@])'; \
+ echo 'm4_define([AT_PACKAGE_STRING], [@PACKAGE_STRING@])'; \
+ echo 'm4_define([AT_PACKAGE_BUGREPORT], [@PACKAGE_BUGREPORT@])'; \
+ } >$(srcdir)/package.m4
+
+#
+
+## ------------ ##
+## Test suite. ##
+## ------------ ##
+
+TESTSUITE_AT = \
+ testsuite.at\
+ inout.at\
+ version.at
+
+TESTSUITE = $(srcdir)/testsuite
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): package.m4 $(TESTSUITE_AT)
+ $(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+ mv $@.tmp $@
+
+atconfig: $(top_builddir)/config.status
+ cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+ $(SHELL) $(TESTSUITE) --clean
+
+check-local: atconfig atlocal $(TESTSUITE)
+ $(SHELL) $(TESTSUITE)
+
+# Run the test suite on the *installed* tree.
+installcheck-local:
+ $(SHELL) $(TESTSUITE) AUTOTEST_PATH=$(exec_prefix)/bin
+
+
+## ------------ ##
+## genfile ##
+## ------------ ##
+
+check_PROGRAMS = genfile
+
+genfile_SOURCES = genfile.c
+
+localedir = $(datadir)/locale
+INCLUDES = -I$(top_srcdir)/lib -I../lib -I$(top_srcdir)/src
+
+LDADD = ../lib/libcpio.a $(LIBINTL)
+
diff --git a/tests/atlocal.in b/tests/atlocal.in
new file mode 100644
index 0000000..8fd5655
--- /dev/null
+++ b/tests/atlocal.in
@@ -0,0 +1,6 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for tar test suite.
+# Copyright (C) 2004 Free Software Foundation, Inc.
+
+PATH=@abs_builddir@:@abs_top_builddir@/src:$top_srcdir:$srcdir:$PATH
+
diff --git a/tests/inout.at b/tests/inout.at
new file mode 100644
index 0000000..2fce7a4
--- /dev/null
+++ b/tests/inout.at
@@ -0,0 +1,39 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+# Copyright (C) 2004 Free Software Foundation, Inc.
+
+# This program 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 2, or (at your option)
+# any later version.
+
+# This program 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AT_SETUP([basic functionality: copyin/copyout])
+
+AT_DATA([filelist],[a 18
+b 1024
+c 356
+d 20000
+e 3
+f 0
+g 10658
+h 45
+])
+
+AT_CHECK([
+while read NAME LENGTH
+do
+ genfile --length $LENGTH > $NAME
+ echo $NAME
+done < filelist |
+ cpio --quiet -o > archive])
+
+AT_CLEANUP \ No newline at end of file
diff --git a/tests/testsuite.at b/tests/testsuite.at
new file mode 100644
index 0000000..2300169
--- /dev/null
+++ b/tests/testsuite.at
@@ -0,0 +1,31 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+
+# Test suite for GNU cpio
+# Copyright (C) 2004 Free Software Foundation, Inc.
+
+# This program 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 2, or (at your option)
+# any later version.
+
+# This program 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+# We need a recent Autotest.
+m4_version_prereq([2.52g])
+
+AT_INIT
+
+AT_TESTED([cpio])
+
+m4_include([version.at])
+
+m4_include([inout.at])
+
diff --git a/tests/version.at b/tests/version.at
new file mode 100644
index 0000000..21bae49
--- /dev/null
+++ b/tests/version.at
@@ -0,0 +1,34 @@
+# Checking cpio version -*- Autotest -*-
+# Copyright (C) 2004 Free Software Foundation, Inc.
+
+# This program 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 2, or (at your option)
+# any later version.
+
+# This program 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+
+AT_SETUP([cpio version])
+
+AT_CHECK([cpio --version],
+ [0],
+ [AT_PACKAGE_TARNAME (AT_PACKAGE_NAME) AT_PACKAGE_VERSION
+],
+[],
+[],
+[
+echo '=============================================================='
+echo 'WARNING: Not using the proper version, *all* checks dubious...'
+echo '=============================================================='
+])
+
+AT_CLEANUP
+ \ No newline at end of file

Return to:

Send suggestions and report system problems to the System administrator.