git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Roskin <proski@gnu.org>
To: git <git@vger.kernel.org>, Petr Baudis <pasky@suse.cz>
Cc: "Horst H. von Brand" <vonbrand@inf.utfsm.cl>
Subject: [PATCH] cogito: make tutorial-script a testsuite
Date: Wed, 02 Nov 2005 20:16:22 -0500	[thread overview]
Message-ID: <1130980582.20017.14.camel@dv> (raw)

Documentation/tutorial-script/script.sh can be used as a testsuite.
Errors should cause the script to exit.  Unexpected success should be
treated like an error.  Successful completion should be reported.

Signed-off-by: Pavel Roskin <proski@gnu.org>

---

Currently, the last cg-merge invocation doesn't fail as it should, and
the subsequent ed scripts fail for Makefile and rpn.c.  I don't have a
fix for that.  Most likely, the script in cogito differs from the
original version.  Horst, could you please have a look?

diff --git a/Documentation/tutorial-script/script.sh
b/Documentation/tutorial-script/script.sh
index 26adec0..fe43e65 100755
--- a/Documentation/tutorial-script/script.sh
+++ b/Documentation/tutorial-script/script.sh
@@ -1,10 +1,16 @@
-#!/bin/sh
+#!/bin/sh -e
 #
 # FIXME: This script has many GITisms. Some of them are unnecessary, while
 # some stem from missing Cogito features (especially no support for pushing
 # tags, and consequently no support for remotes/).
 
 
+should_fail () {
+	echo "Expected failure, got success - aborting" >&2
+	exit 1
+}
+
+
 ### Set up playground
 sh 0000-playground.sh
 TOP=$(pwd)
@@ -98,7 +104,7 @@ git branch
 # Alice needs to register his remote branch
 cg-branch-add bobswork $BOB/rpn
 # Now try to merge Bob's work to the bob branch
-cg-update bobswork
+cg-update bobswork && should_fail
 
 # There are conflicts in rpn.c. Looking at the file, Alice sees the
 # difference between her version and Bob's:
@@ -190,11 +196,12 @@ cd $ALICE/rpn
 git checkout master
 # Alice tries "git merge" instead of "cg-merge" since she wanted to
 # merge both branches at once, which "cg-merge" cannot do.
-git merge "Integrate changes from Bob and Charlie" master bob charlie
+git merge "Integrate changes from Bob and Charlie" master bob charlie \
+	&& should_fail
 
 # Automatic 3-way merge fails! Have to do it step by step
 
-cg-merge bob
+cg-merge bob && should_fail
 
 # Merge fails:
 
@@ -213,7 +220,7 @@ ed Makefile < $TOP/0017-alice-bob-fixup.
 
 cg-commit -m "Integrate Bob's changes"
 
-cg-merge charlie
+cg-merge charlie && should_fail
 
 # Merge conflicts!
 
@@ -282,10 +289,10 @@ cg-fetch
 # (Note that originally, rpn-0.4 was signed, but that would require you
 # to set up a GPG key before running the script... verify-tag on unsigned
 # scripts does not make much sense.)
-git verify-tag rpn-0.4
+git verify-tag rpn-0.4 && should_fail
 
 # Everything's OK, integrate the changes
-echo "Merge with 0.4" | cg-merge
+echo "Merge with 0.4" | cg-merge && should_fail
 
 # Merge conflicts in Makefile, rpn.c
 # Mishandled stack.h
@@ -296,3 +303,6 @@ cg-add stack.h
 
 # Now commit the whole
 cg-commit -m "Merge with 0.4"
+
+# Great, we are done.
+echo "Script completed successfully!"


-- 
Regards,
Pavel Roskin

             reply	other threads:[~2005-11-03  1:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-03  1:16 Pavel Roskin [this message]
2005-11-03 10:36 ` [PATCH] cogito: make tutorial-script a testsuite Petr Baudis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1130980582.20017.14.camel@dv \
    --to=proski@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=pasky@suse.cz \
    --cc=vonbrand@inf.utfsm.cl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).