summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRay Lai <ray@cvs.openbsd.org>2006-03-11 06:22:48 +0000
committerRay Lai <ray@cvs.openbsd.org>2006-03-11 06:22:48 +0000
commitd2e9b2643feb2b75787bb8706c82ead9216efc21 (patch)
treec67f956d6f8614dd002a1b4ac7cb37a6b140e43e
parent7e83753c24bbcb7ae9e8840a7bcd7baf70364693 (diff)
RCS regression tests.
ok joris, niallo, otto, and xsa
-rw-r--r--regress/usr.bin/Makefile4
-rw-r--r--regress/usr.bin/rcs/Makefile190
-rw-r--r--regress/usr.bin/rcs/rcsdiff-rflag.out10
-rw-r--r--regress/usr.bin/rcs/rcsdiff-uflag.out5
-rw-r--r--regress/usr.bin/rcs/rcsdiff.out18
-rw-r--r--regress/usr.bin/rcs/rcsmerge.out33
-rw-r--r--regress/usr.bin/rcs/rev12
-rw-r--r--regress/usr.bin/rcs/rev26
-rw-r--r--regress/usr.bin/rcs/rev315
9 files changed, 281 insertions, 2 deletions
diff --git a/regress/usr.bin/Makefile b/regress/usr.bin/Makefile
index b94e5afdca8..b3b3bcca7e6 100644
--- a/regress/usr.bin/Makefile
+++ b/regress/usr.bin/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.15 2006/03/10 05:47:05 ray Exp $
+# $OpenBSD: Makefile,v 1.16 2006/03/11 06:22:47 ray Exp $
# $NetBSD: Makefile,v 1.1 1997/12/30 23:27:11 cgd Exp $
SUBDIR+= basename bc cap_mkdb dc diff diff3 dirname grep gzsig m4 make patch
-SUBDIR+= sdiff sort ssh tsort
+SUBDIR+= rcs sdiff sort ssh tsort
.include <bsd.subdir.mk>
diff --git a/regress/usr.bin/rcs/Makefile b/regress/usr.bin/rcs/Makefile
new file mode 100644
index 00000000000..027388729ea
--- /dev/null
+++ b/regress/usr.bin/rcs/Makefile
@@ -0,0 +1,190 @@
+# $OpenBSD: Makefile,v 1.1 2006/03/11 06:22:47 ray Exp $
+
+# Regression tests by Niall O'Higgins <niallo@openbsd.org>.
+# ksh -> Makefile by Ray Lai <ray@cyth.net>.
+
+CI?= ci
+CO?= co
+RCS?= rcs
+RCSDIFF?= rcsdiff
+RCSMERGE?= rcsmerge
+
+CLEANFILES= blah.c blah.c,v test test,v
+
+# XXX - These may need to be done in order. (At least start with
+# test-ci-initial.)
+REGRESS_TARGETS= test-ci-initial test-ci-mflag test-ci-lflag
+REGRESS_TARGETS+=test-ci-rflag test-co-lflag test-ci-rev test-co-perm
+REGRESS_TARGETS+=test-co-perm2 test-ci-perm test-ci-perm2
+REGRESS_TARGETS+=test-ci-dinvalid test-ci-dold test-ci-wflag
+REGRESS_TARGETS+=test-rcsdiff-uflag
+REGRESS_TARGETS+=test-rcsdiff-rflag test-rcs-mflag test-rcs-mflag2
+REGRESS_TARGETS+=test-co-RCSINIT test-ci-nflag test-ci-Nflag
+REGRESS_TARGETS+=test-ci-sflag test-co-lflag2 test-rcsdiff
+#REGRESS_TARGETS+=test-rcsmerge
+REGRESS_TARGETS+=test-ci-dflag
+
+test-ci-initial: clean
+ @echo 'this is a test file' > test
+ @echo "a test file" | ${CI} -q -l test
+ @grep -q 'this is a test file' test,v
+
+# Testing 'ci test' with non-interactive log message
+test-ci-mflag:
+ @echo 'another revision' >> test
+ @${CI} -q -m'a second revision' test
+ @test ! -e test
+ @grep -q 'another revision' test,v
+
+# Testing 'co -l test'
+test-ci-lflag:
+ @${CO} -q -l test
+ @test -e test
+
+# Testing 'ci -r1.30 test' with non-interactive log message
+test-ci-rflag:
+ @echo "new stuff" >> test
+ @${CI} -q -r1.30 -m'bumped rev' test
+ @test ! -e test
+
+# Testing 'co -l test'
+test-co-lflag:
+ @${CO} -q -l test
+ @test -e test
+
+# Testing 'ci test' (should be rev 1.31) with non-interactive log message
+test-ci-rev:
+ @echo "a third revision" >> test
+ @${CI} -q -m'this should be rev 1.31' test
+ @grep -q '1.31' test,v
+
+# Testing 'co -u test' - ensuring permissions are 0444
+test-co-perm:
+ @${CO} -q -u test
+ @eval 'test `stat -f%p test` = 100444'
+
+# Testing 'co -l test' - ensuring permissions are 0644
+test-co-perm2:
+ @rm -rf test
+ @${CO} -q -l test
+ @eval 'test `stat -f%p test` = 100644'
+
+# Testing 'ci -u' - ensuring permissions are 0444
+test-ci-perm:
+ @echo "a line for ci -u" >> test
+ @${CI} -q -m'message for ci -u' -u test
+ @eval 'test `stat -f%p test` = 100444'
+
+# Testing 'ci -l' - ensuring permissions are 0644
+test-ci-perm2:
+ @rm -rf test
+ @${CO} -q -l test
+ @echo "a line for ci -l" >> test
+ @${CI} -q -m'message for ci -l' -l test
+ @eval 'test `stat -f%p test` = 100644'
+
+# Testing ci with an invalid date
+test-ci-dinvalid:
+ @echo 'some text for invalid date text' >> test
+ @if @${CI} -q -d'an invalid date' -m'invalid date' -l test 2>/dev/null; then false; fi
+ @if grep 'some text for invalid date text' test,v; then false; fi
+
+# Testing ci with a date older than previous revision
+test-ci-dold:
+ @echo 'some text for old date test' >> test
+ @if ${CI} -q -d'1990-01-12 04:00:00+00' -m'old dated revision' -l test 2>/dev/null; then false; fi
+ @if grep 'some text for old date test' test,v; then false; fi
+
+# Testing ci -wtestuser
+test-ci-wflag:
+ @rm -rf test
+ @${CO} -q -l test
+ @echo "blah blah" >> test
+ @echo "output for ci -w" >> test
+ @${CI} -q -wtestuser -mcomment -l test
+ @grep -q 'author testuser' test,v
+
+# Testing 'rcsdiff -u test' after adding another line
+test-rcsdiff-uflag:
+ @echo "a line for rcsdiff test" >> test
+ @${RCSDIFF} -q -u test | tail -n 5 | \
+ diff -u ${.CURDIR}/rcsdiff-uflag.out -
+
+# Testing 'rcsdiff -u -r1.2 test'
+test-rcsdiff-rflag:
+ @${RCSDIFF} -q -u -r1.2 test | tail -n +3 | \
+ diff -u ${.CURDIR}/rcsdiff-rflag.out -
+
+# Testing 'rcs -m1.2:logmessage'
+test-rcs-mflag:
+ @${RCS} -q -m1.2:logmessage test
+ @grep -q 'logmessage' test,v
+
+# Testing 'rcs -m'1.2:a new log message''
+test-rcs-mflag2:
+ @${RCS} -q -m1.1:'a new log message, one which is quite long and set by rcsprog' test
+ @grep -q 'a new log message, one which is quite long and set by rcsprog' test,v
+
+# Testing RCSINIT environment variable
+test-co-RCSINIT:
+ @rm -rf test
+ @RCSINIT=-l ${CO} -q test
+ @eval 'test `stat -f%p test` = 100644'
+
+# Testing check-in with symbol
+test-ci-nflag:
+ @echo "something to check in with a symbol" >> test
+ @${CI} -q -n'symbolname' -m'test symbols' -l test
+ @grep -q 'symbolname' test,v
+
+# Testing check-in, forcing symbol
+test-ci-Nflag:
+ @echo "something to check in with a forced symbol" >> test
+ @${CI} -q -N'symbolname' -m'test force symbol' -l test
+ @grep -q 'test force symbol' test,v
+
+# Trying some jiggerypokery with state
+test-ci-sflag:
+ @echo "blahblah" >> test
+ @if ${CI} -q -l -s'SPACE S' -m"state with a space" test; then false; fi
+ @if grep -q 'SPACE S' test,v; then false; fi
+
+# Trying to check it out
+test-co-lflag2:
+ @rm -rf test
+ @${CO} -q -l test
+ @test -e test
+
+test-rcsmerge:
+ @cp -f ${.CURDIR}/rev1 blah.c
+ @echo "descr" | ${CI} -q -l -m"first rev" blah.c
+ @cp -f ${.CURDIR}/rev2 blah.c
+ @${CI} -q -l -m"second rev" blah.c
+ @cp -f ${.CURDIR}/rev3 blah.c
+ @${CI} -q -l -m"third rev" blah.c
+
+ @${RCSMERGE} -q -r1.1 -r1.3 -p blah.c | \
+ sed 's/\($$Id: Makefile,v 1.1 2006/03/11 06:22:47 ray Exp $$]*/\1/' | \
+ diff -u ${.CURDIR}/rcsmerge.out -
+
+test-rcsdiff:
+ @rm -rf blah.c,v
+
+ @cp -f ${.CURDIR}/rev1 blah.c
+ @echo "descr" | ${CI} -q -l -m"first rev" blah.c
+ @cp -f ${.CURDIR}/rev2 blah.c
+ @${CI} -q -l -m"second rev" blah.c
+ @cp -f ${.CURDIR}/rev3 blah.c
+ @${CI} -q -l -m"third rev" blah.c
+
+ @${RCSDIFF} -q -r1.1 -r1.3 -u blah.c | tail -n +3 | \
+ sed 's/\($$Id: Makefile,v 1.1 2006/03/11 06:22:47 ray Exp $$]*/\1/' | \
+ diff -u ${.CURDIR}/rcsdiff.out -
+
+# Testing 'ci -d'2037-01-12 04:00:00+00' -l test
+test-ci-dflag:
+ @echo "some text for date test" >> test
+ @${CI} -q -d'2037-01-12 04:00:00+00' -m'dated revision' -l test
+ @grep -q 'dated revision' test,v
+
+.include <bsd.regress.mk>
diff --git a/regress/usr.bin/rcs/rcsdiff-rflag.out b/regress/usr.bin/rcs/rcsdiff-rflag.out
new file mode 100644
index 00000000000..b09e570d033
--- /dev/null
+++ b/regress/usr.bin/rcs/rcsdiff-rflag.out
@@ -0,0 +1,10 @@
+@@ -1,2 +1,9 @@
+ this is a test file
+ another revision
++new stuff
++a third revision
++a line for ci -u
++a line for ci -l
++blah blah
++output for ci -w
++a line for rcsdiff test
diff --git a/regress/usr.bin/rcs/rcsdiff-uflag.out b/regress/usr.bin/rcs/rcsdiff-uflag.out
new file mode 100644
index 00000000000..2bdb687f2be
--- /dev/null
+++ b/regress/usr.bin/rcs/rcsdiff-uflag.out
@@ -0,0 +1,5 @@
+@@ -6,3 +6,4 @@
+ a line for ci -l
+ blah blah
+ output for ci -w
++a line for rcsdiff test
diff --git a/regress/usr.bin/rcs/rcsdiff.out b/regress/usr.bin/rcs/rcsdiff.out
new file mode 100644
index 00000000000..17de04b5de4
--- /dev/null
+++ b/regress/usr.bin/rcs/rcsdiff.out
@@ -0,0 +1,18 @@
+@@ -1,2 +1,15 @@
+-/* $Id: rcsdiff.out,v 1.1 2006/03/11 06:22:47 ray Exp $ */
+-blah();
++/* $Id: rcsdiff.out,v 1.1 2006/03/11 06:22:47 ray Exp $ */
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++
++/* a comment */
++
++/* main function */
++int
++main(int argc, char **argv)
++{
++ printf("foo bar\n");
++
++ return (0);
++}
diff --git a/regress/usr.bin/rcs/rcsmerge.out b/regress/usr.bin/rcs/rcsmerge.out
new file mode 100644
index 00000000000..ca484deddc2
--- /dev/null
+++ b/regress/usr.bin/rcs/rcsmerge.out
@@ -0,0 +1,33 @@
+<<<<<<< blah.c
+/* $Id: rcsmerge.out,v 1.1 2006/03/11 06:22:47 ray Exp $ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* a comment */
+
+/* main function */
+int
+main(int argc, char **argv)
+{
+ printf("foo bar\n");
+
+ return (0);
+}
+=======
+/* $Id: rcsmerge.out,v 1.1 2006/03/11 06:22:47 ray Exp $ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* a comment */
+
+/* main function */
+int
+main(int argc, char **argv)
+{
+ printf("foo bar\n");
+
+ return (0);
+}
+>>>>>>> 1.3
diff --git a/regress/usr.bin/rcs/rev1 b/regress/usr.bin/rcs/rev1
new file mode 100644
index 00000000000..a980646e49e
--- /dev/null
+++ b/regress/usr.bin/rcs/rev1
@@ -0,0 +1,2 @@
+/* $Id: rev1,v 1.1 2006/03/11 06:22:47 ray Exp $ */
+blah();
diff --git a/regress/usr.bin/rcs/rev2 b/regress/usr.bin/rcs/rev2
new file mode 100644
index 00000000000..5b76b765ac4
--- /dev/null
+++ b/regress/usr.bin/rcs/rev2
@@ -0,0 +1,6 @@
+/* $Id: rev2,v 1.1 2006/03/11 06:22:47 ray Exp $ */
+#include <stdio.h>
+
+blah();
+
+/* a comment */
diff --git a/regress/usr.bin/rcs/rev3 b/regress/usr.bin/rcs/rev3
new file mode 100644
index 00000000000..307d7f785de
--- /dev/null
+++ b/regress/usr.bin/rcs/rev3
@@ -0,0 +1,15 @@
+/* $Id: rev3,v 1.1 2006/03/11 06:22:47 ray Exp $ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* a comment */
+
+/* main function */
+int
+main(int argc, char **argv)
+{
+ printf("foo bar\n");
+
+ return (0);
+}