diff options
author | Jim Meyering <jim@meyering.net> | 1997-07-10 15:26:51 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-07-10 15:26:51 +0000 |
commit | deb5b314a5e11a8e1d3231f88fddec11a1c3a486 (patch) | |
tree | 35137028ca57fb2fe7d97adf03e54707a1c3ce12 /tests/head | |
parent | c23aa46af63f50f24661dbbe2a73f0c5a82bea69 (diff) | |
download | coreutils-deb5b314a5e11a8e1d3231f88fddec11a1c3a486.tar.xz |
.
Diffstat (limited to 'tests/head')
-rw-r--r-- | tests/head/.cvsignore | 8 | ||||
-rw-r--r-- | tests/head/Makefile.am | 45 | ||||
-rw-r--r-- | tests/head/Makefile.in | 252 | ||||
-rw-r--r-- | tests/head/Test.pm | 27 |
4 files changed, 332 insertions, 0 deletions
diff --git a/tests/head/.cvsignore b/tests/head/.cvsignore new file mode 100644 index 000000000..852508156 --- /dev/null +++ b/tests/head/.cvsignore @@ -0,0 +1,8 @@ +*.I +*.E +*.X +*.O +*-tests +build-script +Makefile +mk-script diff --git a/tests/head/Makefile.am b/tests/head/Makefile.am new file mode 100644 index 000000000..5ed3c7517 --- /dev/null +++ b/tests/head/Makefile.am @@ -0,0 +1,45 @@ +## Process this file with automake to produce Makefile.in. + +##test-files-begin +x = head +explicit = +maint_gen = idem-1.I idem-1.X idem-2.I idem-2.X idem-3.I idem-3.X idem-4.I \ +idem-4.X +run_gen = idem-1.O idem-1.E idem-2.O idem-2.E idem-3.O idem-3.E idem-4.O \ +idem-4.E +##test-files-end + +EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen) +noinst_SCRIPTS = $x-tests + +PERL = @PERL@ +editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g' + +TESTS = $x-tests + +$(srcdir)/$x-tests: @MAINT@mk-script Test.pm + ./mk-script ../../src/$x > $@.n + mv $@.n $@ + chmod 755 $@ + +mk-script: ../../config.status + +SUFFIXES = .pl + +.pl: + rm -f $@ $@.tmp + $(editpl) $< > $@.tmp + chmod +x-w $@.tmp + mv $@.tmp $@ + +MAINTAINERCLEANFILES = $x-tests $(maint_gen) +CLEANFILES = $(run_gen) + +@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script +@MAINT@ rm -f $@ $@t +@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t +@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \ +@MAINT@ echo "x = $$tool" >> $@t +@MAINT@ ./mk-script --list >> $@t +@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t +@MAINT@ mv $@t $@ diff --git a/tests/head/Makefile.in b/tests/head/Makefile.in new file mode 100644 index 000000000..8ba9b7439 --- /dev/null +++ b/tests/head/Makefile.in @@ -0,0 +1,252 @@ +# Makefile.in generated automatically by automake 1.2 from Makefile.am + +# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + + +SHELL = /bin/sh + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = true +PRE_INSTALL = true +POST_INSTALL = true +NORMAL_UNINSTALL = true +PRE_UNINSTALL = true +POST_UNINSTALL = true +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +LIBOBJS = @LIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +POW_LIBM = @POW_LIBM@ +RANLIB = @RANLIB@ +U = @U@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +x = tac +explicit = +maint_gen = basic-0.I basic-0.X basic-a.I basic-a.X basic-b.I basic-b.X \ +basic-c.I basic-c.X basic-d.I basic-d.X basic-e.I basic-e.X basic-f.I \ +basic-f.X basic-g.I basic-g.X basic-h.I basic-h.X basic-i.I basic-i.X \ +basic-j.I basic-j.X basic-k.I basic-k.X b2-e.I b2-e.X b2-f.I b2-f.X b2-g.I \ +b2-g.X b2-h.I b2-h.X b2-i.I b2-i.X b2-j.I b2-j.X b2-k.I b2-k.X +run_gen = basic-0.O basic-0.E basic-a.O basic-a.E basic-b.O basic-b.E \ +basic-c.O basic-c.E basic-d.O basic-d.E basic-e.O basic-e.E basic-f.O \ +basic-f.E basic-g.O basic-g.E basic-h.O basic-h.E basic-i.O basic-i.E \ +basic-j.O basic-j.E basic-k.O basic-k.E b2-e.O b2-e.E b2-f.O b2-f.E b2-g.O \ +b2-g.E b2-h.O b2-h.E b2-i.O b2-i.E b2-j.O b2-j.E b2-k.O b2-k.E + +EXTRA_DIST = mk-script.pl Test.pm $x-tests $(explicit) $(maint_gen) +noinst_SCRIPTS = $x-tests + +PERL = @PERL@ +editpl = sed -e 's,@''PERL''@,$(PERL),g' -e 's,@''srcdir''@,@srcdir@,g' + +TESTS = $x-tests + +SUFFIXES = .pl + +MAINTAINERCLEANFILES = $x-tests $(maint_gen) +CLEANFILES = $(run_gen) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../config.h +CONFIG_CLEAN_FILES = +SCRIPTS = $(noinst_SCRIPTS) + +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = tar +GZIP = --best +default: all + +.SUFFIXES: +.SUFFIXES: .pl +$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnits tests/tac/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +tags: TAGS +TAGS: + + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = tests/tac + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnits tests/tac/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file; \ + done +check-TESTS: $(TESTS) + @failed=0; all=0; \ + srcdir=$(srcdir); export srcdir; \ + for tst in $(TESTS); do \ + if test -f $$tst; then dir=.; \ + else dir="$(srcdir)"; fi; \ + if $(TESTS_ENVIRONMENT) $$dir/$$tst; then \ + all=`expr $$all + 1`; \ + echo "PASS: $$tst"; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + failed=`expr $$failed + 1`; \ + echo "FAIL: $$tst"; \ + fi; \ + done; \ + if test "$$failed" -eq 0; then \ + banner="All $$all tests passed"; \ + else \ + banner="$$failed of $$all tests failed"; \ + fi; \ + dashes=`echo "$$banner" | sed s/./=/g`; \ + echo "$$dashes"; \ + echo "$$banner"; \ + echo "$$dashes"; \ + test "$$failed" -eq 0 +info: +dvi: +check: all + $(MAKE) check-TESTS +installcheck: +install-exec: + @$(NORMAL_INSTALL) + +install-data: + @$(NORMAL_INSTALL) + +install: install-exec install-data all + @: + +uninstall: + +all: Makefile $(SCRIPTS) + +install-strip: + $(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install +installdirs: + + +mostlyclean-generic: + test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES) + +clean-generic: + test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + rm -f Makefile $(DISTCLEANFILES) + rm -f config.cache config.log stamp-h stamp-h[0-9]* + test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES) + test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +mostlyclean: mostlyclean-generic + +clean: clean-generic mostlyclean + +distclean: distclean-generic clean + rm -f config.status + +maintainer-clean: maintainer-clean-generic distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +.PHONY: default tags distdir check-TESTS info dvi installcheck \ +install-exec install-data install uninstall all installdirs \ +mostlyclean-generic distclean-generic clean-generic \ +maintainer-clean-generic clean mostlyclean distclean maintainer-clean + + +$(srcdir)/$x-tests: @MAINT@mk-script Test.pm + ./mk-script ../../src/$x > $@.n + mv $@.n $@ + chmod 755 $@ + +mk-script: ../../config.status + +.pl: + rm -f $@ $@.tmp + $(editpl) $< > $@.tmp + chmod +x-w $@.tmp + mv $@.tmp $@ + +@MAINT@Makefile.am: ../Makefile.am.in Test.pm mk-script +@MAINT@ rm -f $@ $@t +@MAINT@ sed -n '1,/^##test-files-begin/p' $< > $@t +@MAINT@ tool=`echo $(subdir)|sed 's/^tests.//;s/-test//'`; \ +@MAINT@ echo "x = $$tool" >> $@t +@MAINT@ ./mk-script --list >> $@t +@MAINT@ sed -n '/^##test-files-end/,$$p' $< >> $@t +@MAINT@ mv $@t $@ + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/tests/head/Test.pm b/tests/head/Test.pm new file mode 100644 index 000000000..729795609 --- /dev/null +++ b/tests/head/Test.pm @@ -0,0 +1,27 @@ +package Test; +require 5.002; +use strict; + +my @tv = ( +# test name, options, input, expected output, expected return code +# +['idem-1', '', "", "", 0], +['idem-2', '', "a", "a\n", 0], +['idem-3', '', "\n", "\n", 0], +['idem-4', '', "a\n", "a\n", 0], + +); + +sub test_vector +{ + my $t; + foreach $t (@tv) + { + my ($test_name, $flags, $in, $exp, $ret) = @$t; + $Test::input_via{$test_name} = {REDIR => 0, FILE => 0, PIPE => 0} + } + + return @tv; +} + +1; |