authorSergey Poznyakoff <>2017-07-19 06:22:22 (GMT)
committer Sergey Poznyakoff <>2017-07-19 06:33:32 (GMT)
commit3e59cfb01443a14962547ed75bbbaaefa25a7633 (patch) (side-by-side diff)
parentb0c0f377b5d4eb3344f22cd87171f83085eaa994 (diff)
Implement make dist; add new test
* Makefile (distdir,dist,distcheck): New goals. * t/Makefile (dist): New goal. * t/06mon.t: New file.
Diffstat (more/less context) (ignore whitespace changes)
4 files changed, 149 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 4eb3a1c..03b87d8 100644
--- a/Makefile
+++ b/Makefile
@@ -28,6 +28,9 @@ MKHIER = install -d
# Compiler options
O = -ggdb -Wall
+PROJECT = libruncap
+VERSION = 1.0
SOURCES = runcap.c getc.c getl.c seek.c tell.c
HEADERS = runcap.h
@@ -58,7 +61,30 @@ install-man:;
# $(INSTALL) runcap.2 $(DESTDIR)$(MAN2DIR)
-.PHONY: check
+.PHONY: check distdir
+check: all
$(MAKE) -C t check
+ test -d $(DISTDIR) || mkdir $(DISTDIR)
+ $(MAKE) -C t distdir TOPDISTDIR=`cd $(DISTDIR); pwd`
+dist: distdir
+ tar hzcf $(DISTDIR).tar.gz $(DISTDIR)
+ rm -rf $(DISTDIR)
+distcheck: dist
+ @mkdir _build; \
+ cd _build; \
+ tar xzf ../$(DISTDIR).tar.gz; \
+ if $(MAKE) -C $(DISTDIR) check; then \
+ echo "$(DISTDIR).tar.gz is ready for distribution";\
+ else \
+ echo "Please, inspect " `pwd`;\
+ fi
diff --git a/t/06mon.t b/t/06mon.t
new file mode 100755
index 0000000..4ff3dac
--- a/dev/null
+++ b/t/06mon.t
@@ -0,0 +1,101 @@
+#! ./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
+# 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 <>.
+TC_TITLE line monitor
+[stdout]: CHAPTER I. Down the Rabbit-Hole
+[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]: 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]: 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]: In another moment down went Alice after it, never once considering how
+[stdout]: in the world she was to get out again.
+[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]: 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]: '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]: 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]: 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.'
+exit code: 0
+stdout: 71 lines, 4051 bytes
+stderr: 0 lines, 0 bytes
+rt -m -- genout $testdir/INPUT
diff --git a/t/Makefile b/t/Makefile
index a8c8bac..7e62a8b 100644
--- a/t/Makefile
+++ b/t/Makefile
@@ -26,3 +26,22 @@ rt: rt.o libruncap.a
cc $(CFLAGS) -o$@ $^
genout: genout.o
+ testsuite\
+ 00simple.t\
+ 01lines.t\
+ 02two.t\
+ 03longout.t\
+ 04stdin.t\
+ 05stdin.t\
+ 06mon.t
+DISTFILES = Makefile rt.c genout.c $(TESTSUITE) INPUT
+.PHONY: distdir
+ test -d $(DISTDIR) || mkdir $(DISTDIR)
diff --git a/t/rt.c b/t/rt.c
index a465640..6496cfd 100644
--- a/t/rt.c
+++ b/t/rt.c
@@ -100,7 +100,7 @@ nl(struct runcap *rc, int stream)
n = 1;
while ((res = runcap_getline(rc, stream, &buf, &size)) > 0) {
buf[res-1] = 0;
- printf("% *d: %s\n", width, n, buf);
+ printf("% *zd: %s\n", width, n, buf);
if (res)

Return to:

Send suggestions and report system problems to the System administrator.