summaryrefslogtreecommitdiffabout
path: root/t
Side-by-side diff
Diffstat (limited to 't') (more/less context) (ignore whitespace changes)
-rw-r--r--t/.gitignore4
-rwxr-xr-xt/06mon.t101
-rwxr-xr-xt/07mon.t101
-rw-r--r--t/Makefile.am82
-rw-r--r--t/atlocal.in6
-rw-r--r--t/linemon00.at98
-rw-r--r--t/linemon01.at98
-rw-r--r--[-rwxr-xr-x]t/lines.at (renamed from t/01lines.t)18
-rw-r--r--[-rwxr-xr-x]t/longout.at (renamed from t/03longout.t)19
-rw-r--r--[-rwxr-xr-x]t/pipe.at (renamed from t/04stdin.t)18
-rw-r--r--t/rt.c14
-rw-r--r--[-rwxr-xr-x]t/seek00.at (renamed from t/08seek.t)26
-rw-r--r--[-rwxr-xr-x]t/seek01.at (renamed from t/09seek.t)28
-rw-r--r--[-rwxr-xr-x]t/simple.at (copied from t/00simple.t)21
-rw-r--r--[-rwxr-xr-x]t/stdin.at (renamed from t/05stdin.t)18
-rwxr-xr-xt/testsuite139
-rw-r--r--[-rwxr-xr-x]t/testsuite.at (renamed from t/00simple.t)26
-rw-r--r--[-rwxr-xr-x]t/two.at (renamed from t/02two.t)19
18 files changed, 374 insertions, 462 deletions
diff --git a/t/.gitignore b/t/.gitignore
index bb11f3b..64c47ea 100644
--- a/t/.gitignore
+++ b/t/.gitignore
@@ -1,4 +1,8 @@
+/testsuite
/testsuite.dir
/testsuite.log
/rt
/genout
+/atconfig
+/atlocal
+/package.m4
diff --git a/t/06mon.t b/t/06mon.t
deleted file mode 100755
index 4ff3dac..0000000
--- a/t/06mon.t
+++ b/dev/null
@@ -1,101 +0,0 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
-# Copyright (C) 2017 Sergey Poznyakoff
-#
-# Runcap 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.
-#
-# Runcap 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 Runcap. If not, see <http://www.gnu.org/licenses/>.
-
-TC_TITLE line monitor
-
-TC_EXPECT out <<EOT
-[stdout]: CHAPTER I. Down the Rabbit-Hole
-[stdout]:
-[stdout]: Alice was beginning to get very tired of sitting by her sister on the
-[stdout]: bank, and of having nothing to do: once or twice she had peeped into the
-[stdout]: book her sister was reading, but it had no pictures or conversations
-[stdout]: in it, 'and what is the use of a book,' thought Alice 'without
-[stdout]: pictures or conversations?'
-[stdout]:
-[stdout]: So she was considering in her own mind (as well as she could, for the
-[stdout]: hot day made her feel very sleepy and stupid), whether the pleasure of
-[stdout]: making a daisy-chain would be worth the trouble of getting up and picking
-[stdout]: the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
-[stdout]:
-[stdout]: There was nothing so very remarkable in that; nor did Alice think it
-[stdout]: so very much out of the way to hear the Rabbit say to itself, 'Oh
-[stdout]: dear! Oh dear! I shall be late!' (when she thought it over afterwards,
-[stdout]: it occurred to her that she ought to have wondered at this, but at the
-[stdout]: time it all seemed quite natural); but when the Rabbit actually took a
-[stdout]: watch out of its waistcoat-pocket, and looked at it, and then hurried on,
-[stdout]: Alice started to her feet, for it flashed across her mind that she had
-[stdout]: never before seen a rabbit with either a waistcoat-pocket, or a watch
-[stdout]: to take out of it, and burning with curiosity, she ran across the field
-[stdout]: after it, and fortunately was just in time to see it pop down a large
-[stdout]: rabbit-hole under the hedge.
-[stdout]:
-[stdout]: In another moment down went Alice after it, never once considering how
-[stdout]: in the world she was to get out again.
-[stdout]:
-[stdout]: The rabbit-hole went straight on like a tunnel for some way, and then
-[stdout]: dipped suddenly down, so suddenly that Alice had not a moment to think
-[stdout]: about stopping herself before she found herself falling down a very
-[stdout]: deep well.
-[stdout]:
-[stdout]: Either the well was very deep, or she fell very slowly, for she had plenty
-[stdout]: of time as she went down to look about her and to wonder what was going
-[stdout]: to happen next. First, she tried to look down and make out what she was
-[stdout]: coming to, but it was too dark to see anything; then she looked at the
-[stdout]: sides of the well, and noticed that they were filled with cupboards
-[stdout]: and book-shelves; here and there she saw maps and pictures hung upon
-[stdout]: pegs. She took down a jar from one of the shelves as she passed; it was
-[stdout]: labelled 'ORANGE MARMALADE', but to her great disappointment it was
-[stdout]: empty: she did not like to drop the jar for fear of killing somebody,
-[stdout]: so managed to put it into one of the cupboards as she fell past it.
-[stdout]:
-[stdout]: 'Well!' thought Alice to herself, 'after such a fall as this,
-[stdout]: I shall think nothing of tumbling down stairs! How brave they'll all
-[stdout]: think me at home! Why, I wouldn't say anything about it, even if I
-[stdout]: fell off the top of the house!' (Which was very likely true.)
-[stdout]:
-[stdout]: Down, down, down. Would the fall never come to an end! 'I wonder how
-[stdout]: many miles I've fallen by this time?' she said aloud. 'I must be
-[stdout]: getting somewhere near the centre of the earth. Let me see: that would be
-[stdout]: four thousand miles down, I think--' (for, you see, Alice had learnt
-[stdout]: several things of this sort in her lessons in the schoolroom, and though
-[stdout]: this was not a very good opportunity for showing off her knowledge,
-[stdout]: as there was no one to listen to her, still it was good practice to
-[stdout]: say it over) '--yes, that's about the right distance--but then I
-[stdout]: wonder what Latitude or Longitude I've got to?' (Alice had no idea
-[stdout]: what Latitude was, or Longitude either, but thought they were nice grand
-[stdout]: words to say.)
-[stdout]:
-[stdout]: Presently she began again. 'I wonder if I shall fall right through
-[stdout]: the earth! How funny it'll seem to come out among the people that
-[stdout]: walk with their heads downward! The Antipathies, I think--' (she was
-[stdout]: rather glad there was no one listening, this time, as it didn't sound
-[stdout]: at all the right word) '--but I shall have to ask them what the name
-[stdout]: of the country is, you know. Please, Ma'am, is this New Zealand or
-[stdout]: Australia?' (and she tried to curtsey as she spoke--fancy curtseying
-[stdout]: as you're falling through the air! Do you think you could manage
-[stdout]: it?) 'And what an ignorant little girl she'll think me for asking! No,
-[stdout]: it'll never do to ask: perhaps I shall see it written up somewhere.'
-res=0
-exit code: 0
-stdout: 71 lines, 4051 bytes
-stderr: 0 lines, 0 bytes
-EOT
-
-rt -m -- genout $testdir/INPUT
-
-
-
diff --git a/t/07mon.t b/t/07mon.t
deleted file mode 100755
index 4224f87..0000000
--- a/t/07mon.t
+++ b/dev/null
@@ -1,101 +0,0 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
-# Copyright (C) 2017 Sergey Poznyakoff
-#
-# Runcap 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.
-#
-# Runcap 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 Runcap. If not, see <http://www.gnu.org/licenses/>.
-
-TC_TITLE line monitor, short buffer
-
-TC_EXPECT out <<EOT
-[stdout]: CHAPTER I. Down the Rabbit-Hole
-[stdout]:
-[stdout]: Alice was beginning to get very tired of sitting by her sister on the
-[stdout]: bank, and of having nothing to do: once or twice she had peeped into the
-[stdout]: book her sister was reading, but it had no pictures or conversations
-[stdout]: in it, 'and what is the use of a book,' thought Alice 'without
-[stdout]: pictures or conversations?'
-[stdout]:
-[stdout]: So she was considering in her own mind (as well as she could, for the
-[stdout]: hot day made her feel very sleepy and stupid), whether the pleasure of
-[stdout]: making a daisy-chain would be worth the trouble of getting up and picking
-[stdout]: the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
-[stdout]:
-[stdout]: There was nothing so very remarkable in that; nor did Alice think it
-[stdout]: so very much out of the way to hear the Rabbit say to itself, 'Oh
-[stdout]: dear! Oh dear! I shall be late!' (when she thought it over afterwards,
-[stdout]: it occurred to her that she ought to have wondered at this, but at the
-[stdout]: time it all seemed quite natural); but when the Rabbit actually took a
-[stdout]: watch out of its waistcoat-pocket, and looked at it, and then hurried on,
-[stdout]: Alice started to her feet, for it flashed across her mind that she had
-[stdout]: never before seen a rabbit with either a waistcoat-pocket, or a watch
-[stdout]: to take out of it, and burning with curiosity, she ran across the field
-[stdout]: after it, and fortunately was just in time to see it pop down a large
-[stdout]: rabbit-hole under the hedge.
-[stdout]:
-[stdout]: In another moment down went Alice after it, never once considering how
-[stdout]: in the world she was to get out again.
-[stdout]:
-[stdout]: The rabbit-hole went straight on like a tunnel for some way, and then
-[stdout]: dipped suddenly down, so suddenly that Alice had not a moment to think
-[stdout]: about stopping herself before she found herself falling down a very
-[stdout]: deep well.
-[stdout]:
-[stdout]: Either the well was very deep, or she fell very slowly, for she had plenty
-[stdout]: of time as she went down to look about her and to wonder what was going
-[stdout]: to happen next. First, she tried to look down and make out what she was
-[stdout]: coming to, but it was too dark to see anything; then she looked at the
-[stdout]: sides of the well, and noticed that they were filled with cupboards
-[stdout]: and book-shelves; here and there she saw maps and pictures hung upon
-[stdout]: pegs. She took down a jar from one of the shelves as she passed; it was
-[stdout]: labelled 'ORANGE MARMALADE', but to her great disappointment it was
-[stdout]: empty: she did not like to drop the jar for fear of killing somebody,
-[stdout]: so managed to put it into one of the cupboards as she fell past it.
-[stdout]:
-[stdout]: 'Well!' thought Alice to herself, 'after such a fall as this,
-[stdout]: I shall think nothing of tumbling down stairs! How brave they'll all
-[stdout]: think me at home! Why, I wouldn't say anything about it, even if I
-[stdout]: fell off the top of the house!' (Which was very likely true.)
-[stdout]:
-[stdout]: Down, down, down. Would the fall never come to an end! 'I wonder how
-[stdout]: many miles I've fallen by this time?' she said aloud. 'I must be
-[stdout]: getting somewhere near the centre of the earth. Let me see: that would be
-[stdout]: four thousand miles down, I think--' (for, you see, Alice had learnt
-[stdout]: several things of this sort in her lessons in the schoolroom, and though
-[stdout]: this was not a very good opportunity for showing off her knowledge,
-[stdout]: as there was no one to listen to her, still it was good practice to
-[stdout]: say it over) '--yes, that's about the right distance--but then I
-[stdout]: wonder what Latitude or Longitude I've got to?' (Alice had no idea
-[stdout]: what Latitude was, or Longitude either, but thought they were nice grand
-[stdout]: words to say.)
-[stdout]:
-[stdout]: Presently she began again. 'I wonder if I shall fall right through
-[stdout]: the earth! How funny it'll seem to come out among the people that
-[stdout]: walk with their heads downward! The Antipathies, I think--' (she was
-[stdout]: rather glad there was no one listening, this time, as it didn't sound
-[stdout]: at all the right word) '--but I shall have to ask them what the name
-[stdout]: of the country is, you know. Please, Ma'am, is this New Zealand or
-[stdout]: Australia?' (and she tried to curtsey as she spoke--fancy curtseying
-[stdout]: as you're falling through the air! Do you think you could manage
-[stdout]: it?) 'And what an ignorant little girl she'll think me for asking! No,
-[stdout]: it'll never do to ask: perhaps I shall see it written up somewhere.'
-res=0
-exit code: 0
-stdout: 71 lines, 4051 bytes
-stderr: 0 lines, 0 bytes
-EOT
-
-rt -s 16 -m -- genout $testdir/INPUT
-
-
-
diff --git a/t/Makefile.am b/t/Makefile.am
index 681184f..b41aa20 100644
--- a/t/Makefile.am
+++ b/t/Makefile.am
@@ -1,4 +1,4 @@
-# runcap - run program and capture its output
+# This file is part of runcap testsuite.
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -14,28 +14,74 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TESTPROGS=genout rt
-check: $(TESTPROGS)
- @$(srcdir)/testsuite
+EXTRA_DIST = $(TESTSUITE_AT) testsuite package.m4 INPUT
+DISTCLEANFILES = atconfig $(check_SCRIPTS)
+MAINTAINERCLEANFILES = Makefile.in $(TESTSUITE)
+CLEANFILES = .TESTINIT FAILURE
+
+## ------------ ##
+## package.m4. ##
+## ------------ ##
+
+$(srcdir)/package.m4: $(top_srcdir)/configure.ac
+ $(AM_V_GEN){ \
+ 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\
+ simple.at\
+ lines.at\
+ two.at\
+ longout.at\
+ stdin.at\
+ pipe.at\
+ linemon00.at\
+ linemon01.at\
+ seek00.at\
+ seek01.at
+# Add more files here
+
+TESTSUITE = $(srcdir)/testsuite
+M4=m4
+
+AUTOTEST = $(AUTOM4TE) --language=autotest
+$(TESTSUITE): package.m4 $(TESTSUITE_AT)
+ $(AM_V_GEN)$(AUTOTEST) -I $(srcdir) testsuite.at -o $@.tmp
+ $(AM_V_at)mv $@.tmp $@
+
+atconfig: $(top_builddir)/config.status
+ @cd $(top_builddir) && ./config.status tests/$@
+
+clean-local:
+ @test ! -f $(TESTSUITE) || $(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
AM_CPPFLAGS=@RUNCAP_INC@
noinst_PROGRAMS = rt genout
rt_SOURCES=rt.c
-rt_LDADD=../libruncap.a
+rt_LDADD=@RUNCAP_LDADD@
genout_SOURCES = genout.c
-TESTSUITE =\
- testsuite\
- 00simple.t\
- 01lines.t\
- 02two.t\
- 03longout.t\
- 04stdin.t\
- 05stdin.t\
- 06mon.t\
- 08seek.t\
- 09seek.t
-
-EXTRA_DIST = $(TESTSUITE) INPUT
+
+
+
diff --git a/t/atlocal.in b/t/atlocal.in
new file mode 100644
index 0000000..1c524f5
--- a/dev/null
+++ b/t/atlocal.in
@@ -0,0 +1,6 @@
+# @configure_input@ -*- shell-script -*-
+# Configurable variable values for runcap test suite.
+# Copyright (C) 2017 Sergey Poznyakoff
+
+PATH=@abs_builddir@:@abs_top_srcdir@:$top_srcdir:$srcdir:$PATH
+INPUT=@abs_top_srcdir@/t/INPUT
diff --git a/t/linemon00.at b/t/linemon00.at
new file mode 100644
index 0000000..7310040
--- a/dev/null
+++ b/t/linemon00.at
@@ -0,0 +1,98 @@
+# Testcase for runcap - run program and capture its output -*- autotest -*-
+# Copyright (C) 2017 Sergey Poznyakoff
+#
+# Runcap 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.
+#
+# Runcap 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 Runcap. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([line monitor])
+AT_KEYWORDS([linemon monitor])
+AT_CHECK([rt -m -- genout $INPUT
+],
+[0],
+[stdout: CHAPTER I. Down the Rabbit-Hole
+stdout:
+stdout: Alice was beginning to get very tired of sitting by her sister on the
+stdout: bank, and of having nothing to do: once or twice she had peeped into the
+stdout: book her sister was reading, but it had no pictures or conversations
+stdout: in it, 'and what is the use of a book,' thought Alice 'without
+stdout: pictures or conversations?'
+stdout:
+stdout: So she was considering in her own mind (as well as she could, for the
+stdout: hot day made her feel very sleepy and stupid), whether the pleasure of
+stdout: making a daisy-chain would be worth the trouble of getting up and picking
+stdout: the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
+stdout:
+stdout: There was nothing so very remarkable in that; nor did Alice think it
+stdout: so very much out of the way to hear the Rabbit say to itself, 'Oh
+stdout: dear! Oh dear! I shall be late!' (when she thought it over afterwards,
+stdout: it occurred to her that she ought to have wondered at this, but at the
+stdout: time it all seemed quite natural); but when the Rabbit actually took a
+stdout: watch out of its waistcoat-pocket, and looked at it, and then hurried on,
+stdout: Alice started to her feet, for it flashed across her mind that she had
+stdout: never before seen a rabbit with either a waistcoat-pocket, or a watch
+stdout: to take out of it, and burning with curiosity, she ran across the field
+stdout: after it, and fortunately was just in time to see it pop down a large
+stdout: rabbit-hole under the hedge.
+stdout:
+stdout: In another moment down went Alice after it, never once considering how
+stdout: in the world she was to get out again.
+stdout:
+stdout: The rabbit-hole went straight on like a tunnel for some way, and then
+stdout: dipped suddenly down, so suddenly that Alice had not a moment to think
+stdout: about stopping herself before she found herself falling down a very
+stdout: deep well.
+stdout:
+stdout: Either the well was very deep, or she fell very slowly, for she had plenty
+stdout: of time as she went down to look about her and to wonder what was going
+stdout: to happen next. First, she tried to look down and make out what she was
+stdout: coming to, but it was too dark to see anything; then she looked at the
+stdout: sides of the well, and noticed that they were filled with cupboards
+stdout: and book-shelves; here and there she saw maps and pictures hung upon
+stdout: pegs. She took down a jar from one of the shelves as she passed; it was
+stdout: labelled 'ORANGE MARMALADE', but to her great disappointment it was
+stdout: empty: she did not like to drop the jar for fear of killing somebody,
+stdout: so managed to put it into one of the cupboards as she fell past it.
+stdout:
+stdout: 'Well!' thought Alice to herself, 'after such a fall as this,
+stdout: I shall think nothing of tumbling down stairs! How brave they'll all
+stdout: think me at home! Why, I wouldn't say anything about it, even if I
+stdout: fell off the top of the house!' (Which was very likely true.)
+stdout:
+stdout: Down, down, down. Would the fall never come to an end! 'I wonder how
+stdout: many miles I've fallen by this time?' she said aloud. 'I must be
+stdout: getting somewhere near the centre of the earth. Let me see: that would be
+stdout: four thousand miles down, I think--' (for, you see, Alice had learnt
+stdout: several things of this sort in her lessons in the schoolroom, and though
+stdout: this was not a very good opportunity for showing off her knowledge,
+stdout: as there was no one to listen to her, still it was good practice to
+stdout: say it over) '--yes, that's about the right distance--but then I
+stdout: wonder what Latitude or Longitude I've got to?' (Alice had no idea
+stdout: what Latitude was, or Longitude either, but thought they were nice grand
+stdout: words to say.)
+stdout:
+stdout: Presently she began again. 'I wonder if I shall fall right through
+stdout: the earth! How funny it'll seem to come out among the people that
+stdout: walk with their heads downward! The Antipathies, I think--' (she was
+stdout: rather glad there was no one listening, this time, as it didn't sound
+stdout: at all the right word) '--but I shall have to ask them what the name
+stdout: of the country is, you know. Please, Ma'am, is this New Zealand or
+stdout: Australia?' (and she tried to curtsey as she spoke--fancy curtseying
+stdout: as you're falling through the air! Do you think you could manage
+stdout: it?) 'And what an ignorant little girl she'll think me for asking! No,
+stdout: it'll never do to ask: perhaps I shall see it written up somewhere.'
+res=0
+exit code: 0
+stdout: 71 lines, 4051 bytes
+stderr: 0 lines, 0 bytes
+])
+AT_CLEANUP
diff --git a/t/linemon01.at b/t/linemon01.at
new file mode 100644
index 0000000..f3249a0
--- a/dev/null
+++ b/t/linemon01.at
@@ -0,0 +1,98 @@
+# Testcase for runcap - run program and capture its output -*- autotest -*-
+# Copyright (C) 2017 Sergey Poznyakoff
+#
+# Runcap 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.
+#
+# Runcap 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 Runcap. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([line monitor, short buffer])
+AT_KEYWORDS([linemon linemon01.at])
+AT_CHECK([rt -s 16 -m -- genout $INPUT
+],
+[0],
+[stdout: CHAPTER I. Down the Rabbit-Hole
+stdout:
+stdout: Alice was beginning to get very tired of sitting by her sister on the
+stdout: bank, and of having nothing to do: once or twice she had peeped into the
+stdout: book her sister was reading, but it had no pictures or conversations
+stdout: in it, 'and what is the use of a book,' thought Alice 'without
+stdout: pictures or conversations?'
+stdout:
+stdout: So she was considering in her own mind (as well as she could, for the
+stdout: hot day made her feel very sleepy and stupid), whether the pleasure of
+stdout: making a daisy-chain would be worth the trouble of getting up and picking
+stdout: the daisies, when suddenly a White Rabbit with pink eyes ran close by her.
+stdout:
+stdout: There was nothing so very remarkable in that; nor did Alice think it
+stdout: so very much out of the way to hear the Rabbit say to itself, 'Oh
+stdout: dear! Oh dear! I shall be late!' (when she thought it over afterwards,
+stdout: it occurred to her that she ought to have wondered at this, but at the
+stdout: time it all seemed quite natural); but when the Rabbit actually took a
+stdout: watch out of its waistcoat-pocket, and looked at it, and then hurried on,
+stdout: Alice started to her feet, for it flashed across her mind that she had
+stdout: never before seen a rabbit with either a waistcoat-pocket, or a watch
+stdout: to take out of it, and burning with curiosity, she ran across the field
+stdout: after it, and fortunately was just in time to see it pop down a large
+stdout: rabbit-hole under the hedge.
+stdout:
+stdout: In another moment down went Alice after it, never once considering how
+stdout: in the world she was to get out again.
+stdout:
+stdout: The rabbit-hole went straight on like a tunnel for some way, and then
+stdout: dipped suddenly down, so suddenly that Alice had not a moment to think
+stdout: about stopping herself before she found herself falling down a very
+stdout: deep well.
+stdout:
+stdout: Either the well was very deep, or she fell very slowly, for she had plenty
+stdout: of time as she went down to look about her and to wonder what was going
+stdout: to happen next. First, she tried to look down and make out what she was
+stdout: coming to, but it was too dark to see anything; then she looked at the
+stdout: sides of the well, and noticed that they were filled with cupboards
+stdout: and book-shelves; here and there she saw maps and pictures hung upon
+stdout: pegs. She took down a jar from one of the shelves as she passed; it was
+stdout: labelled 'ORANGE MARMALADE', but to her great disappointment it was
+stdout: empty: she did not like to drop the jar for fear of killing somebody,
+stdout: so managed to put it into one of the cupboards as she fell past it.
+stdout:
+stdout: 'Well!' thought Alice to herself, 'after such a fall as this,
+stdout: I shall think nothing of tumbling down stairs! How brave they'll all
+stdout: think me at home! Why, I wouldn't say anything about it, even if I
+stdout: fell off the top of the house!' (Which was very likely true.)
+stdout:
+stdout: Down, down, down. Would the fall never come to an end! 'I wonder how
+stdout: many miles I've fallen by this time?' she said aloud. 'I must be
+stdout: getting somewhere near the centre of the earth. Let me see: that would be
+stdout: four thousand miles down, I think--' (for, you see, Alice had learnt
+stdout: several things of this sort in her lessons in the schoolroom, and though
+stdout: this was not a very good opportunity for showing off her knowledge,
+stdout: as there was no one to listen to her, still it was good practice to
+stdout: say it over) '--yes, that's about the right distance--but then I
+stdout: wonder what Latitude or Longitude I've got to?' (Alice had no idea
+stdout: what Latitude was, or Longitude either, but thought they were nice grand
+stdout: words to say.)
+stdout:
+stdout: Presently she began again. 'I wonder if I shall fall right through
+stdout: the earth! How funny it'll seem to come out among the people that
+stdout: walk with their heads downward! The Antipathies, I think--' (she was
+stdout: rather glad there was no one listening, this time, as it didn't sound
+stdout: at all the right word) '--but I shall have to ask them what the name
+stdout: of the country is, you know. Please, Ma'am, is this New Zealand or
+stdout: Australia?' (and she tried to curtsey as she spoke--fancy curtseying
+stdout: as you're falling through the air! Do you think you could manage
+stdout: it?) 'And what an ignorant little girl she'll think me for asking! No,
+stdout: it'll never do to ask: perhaps I shall see it written up somewhere.'
+res=0
+exit code: 0
+stdout: 71 lines, 4051 bytes
+stderr: 0 lines, 0 bytes
+])
+AT_CLEANUP
diff --git a/t/01lines.t b/t/lines.at
index 0d20dcd..fde7680 100755..100644
--- a/t/01lines.t
+++ b/t/lines.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,12 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE read lines
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([lines])
+AT_KEYWORDS([lines])
+AT_CHECK([rt -n stdout -- genout $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 71 lines, 4051 bytes
stderr: 0 lines, 0 bytes
@@ -95,7 +96,6 @@ stdout listing:
70: it?) 'And what an ignorant little girl she'll think me for asking! No,
71: it'll never do to ask: perhaps I shall see it written up somewhere.'
stdout listing ends
-EOT
-
-rt -n stdout -- genout $testdir/INPUT
+])
+AT_CLEANUP
diff --git a/t/03longout.t b/t/longout.at
index 8204168..45391b2 100755..100644
--- a/t/03longout.t
+++ b/t/longout.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,12 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE file buffered output
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([file buffered output])
+AT_KEYWORDS([longout])
+AT_CHECK([rt -s 16 -n stdout -- genout $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 71 lines, 4051 bytes
stderr: 0 lines, 0 bytes
@@ -95,7 +96,5 @@ stdout listing:
70: it?) 'And what an ignorant little girl she'll think me for asking! No,
71: it'll never do to ask: perhaps I shall see it written up somewhere.'
stdout listing ends
-EOT
-
-rt -s 16 -n stdout -- genout $testdir/INPUT
-
+])
+AT_CLEANUP
diff --git a/t/04stdin.t b/t/pipe.at
index 9b05e16..3b31f3f 100755..100644
--- a/t/04stdin.t
+++ b/t/pipe.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,12 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE supply stdin
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([pipe stdin])
+AT_KEYWORDS([pipe])
+AT_CHECK([rt -n all -i -f $INPUT -- genout -l 337 -o - -s 628 -l 734 -e $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 8 lines, 337 bytes
stderr: 11 lines, 734 bytes
@@ -45,6 +46,5 @@ stderr listing:
10: after it, and fortunately was just in time to see it pop down a large
11: rabbit-hole under the hedge.
stderr listing ends
-EOT
-
-rt -n all -f $testdir/INPUT -- genout -l 337 -o - -s 628 -l 734 -e $testdir/INPUT
+])
+AT_CLEANUP
diff --git a/t/rt.c b/t/rt.c
index 12a3232..e5c1bbb 100644
--- a/t/rt.c
+++ b/t/rt.c
@@ -91,9 +91,12 @@ static void
linemon(const char *ptr, size_t len, void *data)
{
struct linemon_closure *clos = data;
-
- if (!clos->cont)
- fprintf(stdout, "[%s]: ", clos->prefix);
+
+ if (!clos->cont) {
+ printf("%s:", clos->prefix);
+ if (!(len == 1 && ptr[0] == '\n'))
+ putchar(' ');
+ }
fwrite(ptr, len, 1, stdout);
clos->cont = ptr[len-1] != '\n';
}
@@ -116,7 +119,10 @@ nl(struct runcap *rc, int stream)
n = 1;
while ((res = runcap_getline(rc, stream, &buf, &size)) > 0) {
buf[res-1] = 0;
- printf("%*zu: %s\n", width, n, buf);
+ printf("%*zu:", width, n);
+ if (buf[0])
+ printf(" %s", buf);
+ putchar('\n');
n++;
}
if (res)
diff --git a/t/08seek.t b/t/seek00.at
index c2312bd..4e1f4b0 100755..100644
--- a/t/08seek.t
+++ b/t/seek00.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,16 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE seek
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([seek])
+AT_KEYWORDS([seek])
+AT_CHECK([rt -r stdout:100:15:0\
+ -r stdout:10:-20:1\
+ -r stdout:10:0:1\
+ -r stdout:10:-20:2\
+ -- genout $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 71 lines, 4051 bytes
stderr: 0 lines, 0 bytes
@@ -34,10 +39,5 @@ READ 2:
nk, and of
READ 3:
tten up so
-EOT
-
-rt -r stdout:100:15:0\
- -r stdout:10:-20:1\
- -r stdout:10:0:1\
- -r stdout:10:-20:2\
- -- genout $testdir/INPUT
+])
+AT_CLEANUP
diff --git a/t/09seek.t b/t/seek01.at
index 87628f1..62c1650 100755..100644
--- a/t/09seek.t
+++ b/t/seek01.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,17 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE seek, short buffer
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([seek, short buffer])
+AT_KEYWORDS([seek shortbuf])
+AT_CHECK([rt -s 16\
+ -r stdout:100:15:0\
+ -r stdout:10:-20:1\
+ -r stdout:10:0:1\
+ -r stdout:10:-20:2\
+ -- genout $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 71 lines, 4051 bytes
stderr: 0 lines, 0 bytes
@@ -34,11 +40,5 @@ READ 2:
nk, and of
READ 3:
tten up so
-EOT
-
-rt -s 16\
- -r stdout:100:15:0\
- -r stdout:10:-20:1\
- -r stdout:10:0:1\
- -r stdout:10:-20:2\
- -- genout $testdir/INPUT
+])
+AT_CLEANUP
diff --git a/t/00simple.t b/t/simple.at
index 31a4da2..d1f6a58 100755..100644
--- a/t/00simple.t
+++ b/t/simple.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testsuite for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,16 +14,14 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE simple capture
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([simple capture])
+AT_KEYWORDS([simple])
+AT_CHECK([rt genout $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 71 lines, 4051 bytes
stderr: 0 lines, 0 bytes
-EOT
-
-rt genout $testdir/INPUT
-
-
-
+])
+AT_CLEANUP
diff --git a/t/05stdin.t b/t/stdin.at
index 6f9de3d..36f684c 100755..100644
--- a/t/05stdin.t
+++ b/t/stdin.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,12 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE pipe stdin
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([supply stdin])
+AT_KEYWORDS([stdin])
+AT_CHECK([rt -n all -f $INPUT -- genout -l 337 -o - -s 628 -l 734 -e $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 8 lines, 337 bytes
stderr: 11 lines, 734 bytes
@@ -45,6 +46,5 @@ stderr listing:
10: after it, and fortunately was just in time to see it pop down a large
11: rabbit-hole under the hedge.
stderr listing ends
-EOT
-
-rt -n all -i -f $testdir/INPUT -- genout -l 337 -o - -s 628 -l 734 -e $testdir/INPUT
+])
+AT_CLEANUP
diff --git a/t/testsuite b/t/testsuite
deleted file mode 100755
index bd870ce..0000000
--- a/t/testsuite
+++ b/dev/null
@@ -1,139 +0,0 @@
-#! /bin/sh
-# testsuite for runcap - run program and capture its output
-# Copyright (C) 2017 Sergey Poznyakoff
-#
-# Runcap 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.
-#
-# Runcap 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 Runcap. If not, see <http://www.gnu.org/licenses/>.
-
-testdir=$(cd $(dirname $0); pwd)
-progname=$(basename $0)
-
-topworkdir=$(pwd)
-workdir=$topworkdir/testsuite.dir
-if [ ! -d $workdir ]; then
- mkdir $workdir
-fi
-
-cd $testdir
-numfiles=$(ls -1 *.t 2>/dev/null| sed -n '$=')
-
-if [ ${numfiles:-0} -eq 0 ]; then
- echo >&2 "$progname: no test files in $testdir"
- exit 2
-fi
-
-printheader() {
- awk -v P=$numfiles 'NR==1 { num=$1; next }
- NR==2 { printf("%0d: %s", num, $1); next }
- { if (NF!=0) printf(" - %s", $0);
- printf(": "); }' <<EOF
-$1
-$2
-$3
-EOF
-}
-
-PATH=$topworkdir:$PATH
-echo $PATH
-TC_EXPECT() {
- cat > exp$1
-}
-TC_TITLE() {
- :
-}
-
-numtests=0
-numfail=0
-cd $testdir
-exec 3>$topworkdir/testsuite.log
-
-if [ $# -gt 0 ]; then
- testlist=$(ls $*) || exit 1
-else
- testlist=$(ls *.t)
-fi
-
-for tc in $testlist
-do
- cd $testdir
- tc=$(echo $tc|sed 's|\./||')
- # Skip if invalid name
- echo "$tc" | grep -q '[^a-zA-Z0-9._-]' && continue
- # Skip if not executable
- test -x $tc || continue
-
- cd $workdir
-
- dirname=${tc%%.t}
- if [ -d $dirname ]; then
- rm -rf $dirname/*
- else
- mkdir $dirname || continue
- fi
- cd $dirname
-
- descr=$(sed -n '/TC_TITLE /s///p' $testdir/$tc)
- printheader $numtests $tc "$descr"
- ( . $testdir/$tc ) >out 2>err
- retcode=$?
- numtests=$(( $numtests + 1 ))
- cd $workdir
-
- exec 4>templog
- if [ $retcode -eq 77 ]; then
- echo "SKIP"
- continue
- fi
- if [ $retcode -ne 0 ]; then
- echo >&4 "# exit code: $retcode"
- fi
-
- test -r $dirname/expout || > $dirname/expout
- if ! cmp $dirname/expout $dirname/out 2>/dev/null >&2; then
- echo >&4 "# stdout diff"
- diff -pu $dirname/expout $dirname/out >&4
- fi
- test -r $dirname/experr || > $dirname/experr
- if ! cmp $dirname/experr $dirname/err 2>/dev/null >&2; then
- echo >&4 "# stderr diff"
- diff -pu $dirname/experr $dirname/err >&4
- fi
-
- if [ -s templog ]; then
- echo "FAIL"
- numfail=$(( $numfail + 1 ))
- echo >&3 "# Testcase $tc FAILED"
- cat >&3 templog
- echo >&3 "# Content:"
- cat >&3 $testdir/$tc
- echo >&3 "# stdout:"
- cat >&3 $dirname/out
- echo >&3 "# stderr:"
- cat >&3 $dirname/err
- else
- echo "OK"
- rm -rf $dirname
- fi
- rm templog
-done
-
-cd $topworkdir
-
-if [ $numfail -ne 0 ]; then
- echo >&2 "# $numfail out of $numtests tests failed"
- echo >&2 "# See testsuite.log for more info"
- exit 1
-else
- rmdir $workdir 2>/dev/null
- rm testsuite.log
-fi
diff --git a/t/00simple.t b/t/testsuite.at
index 31a4da2..cdcec12 100755..100644
--- a/t/00simple.t
+++ b/t/testsuite.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testcase for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,16 +14,17 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE simple capture
-
-TC_EXPECT out <<EOT
-res=0
-exit code: 0
-stdout: 71 lines, 4051 bytes
-stderr: 0 lines, 0 bytes
-EOT
-
-rt genout $testdir/INPUT
-
+m4_version_prereq([2.69])
+AT_INIT
+m4_include([simple.at])
+m4_include([lines.at])
+m4_include([two.at])
+m4_include([longout.at])
+m4_include([stdin.at])
+m4_include([pipe.at])
+m4_include([linemon00.at])
+m4_include([linemon01.at])
+m4_include([seek00.at])
+m4_include([seek01.at])
diff --git a/t/02two.t b/t/two.at
index 142bbce..3be76b2 100755..100644
--- a/t/02two.t
+++ b/t/two.at
@@ -1,5 +1,4 @@
-#! ./testsuite
-# testsuite for runcap - run program and capture its output
+# Testsuite for runcap - run program and capture its output -*- autotest -*-
# Copyright (C) 2017 Sergey Poznyakoff
#
# Runcap is free software; you can redistribute it and/or modify it
@@ -15,10 +14,12 @@
# You should have received a copy of the GNU General Public License along
# with Runcap. If not, see <http://www.gnu.org/licenses/>.
-TC_TITLE capture both stdout and stderr
-
-TC_EXPECT out <<EOT
-res=0
+AT_SETUP([capture both stdout and stderr])
+AT_KEYWORDS([two])
+AT_CHECK([rt -n all -- genout -l 337 -o $INPUT -s 628 -l 734 -e $INPUT
+],
+[0],
+[res=0
exit code: 0
stdout: 8 lines, 337 bytes
stderr: 11 lines, 734 bytes
@@ -45,7 +46,5 @@ stderr listing:
10: after it, and fortunately was just in time to see it pop down a large
11: rabbit-hole under the hedge.
stderr listing ends
-EOT
-
-rt -n all -- genout -l 337 -o $testdir/INPUT -s 628 -l 734 -e $testdir/INPUT
-
+])
+AT_CLEANUP

Return to:

Send suggestions and report system problems to the System administrator.