* [PATCH] cogito tutorial-script - more testsuite improvements
@ 2005-11-14 23:14 Pavel Roskin
0 siblings, 0 replies; only message in thread
From: Pavel Roskin @ 2005-11-14 23:14 UTC (permalink / raw)
To: git, Petr Baudis
Report line in should_fail(). Require bash, since reporting calling
line is bash specific. Set "-e" flag in the script, so that e.g.
"bash -x script.sh" cannot cancel it accidentally. Trap and report
unexpected errors.
Signed-off-by: Pavel Roskin <proski@gnu.org>
diff --git a/Documentation/tutorial-script/script.sh b/Documentation/tutorial-script/script.sh
index 8cdfe36..bc70b77 100755
--- a/Documentation/tutorial-script/script.sh
+++ b/Documentation/tutorial-script/script.sh
@@ -1,4 +1,4 @@
-#!/bin/sh -e
+#!/bin/bash
#
# FIXME: This script has many GITisms. Some of them are unnecessary, while
# some stem from missing Cogito features (especially no support for pushing
@@ -10,10 +10,16 @@
# for executing this script to make sure we did not break it with any
# Cogito changes.
should_fail () {
- echo "Expected failure, got success - aborting" >&2
+ echo "Expected failure, got success on line ${BASH_LINENO[0]}" \
+ "- aborting" >&2
+ trap - exit
exit 1
}
+# Conversely, if something fails when it shouldn't, report it and exit.
+set -e
+trap 'echo >&2 "Unexpected error $? on line $LINENO"; exit 1' exit
+
### Set up playground
sh 0000-playground.sh
@@ -309,4 +315,5 @@ cg-add stack.h
cg-commit -m "Merge with 0.4"
# Great, we are done.
+trap - exit
echo "Script completed successfully!"
--
Regards,
Pavel Roskin
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2005-11-14 23:14 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-14 23:14 [PATCH] cogito tutorial-script - more testsuite improvements Pavel Roskin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.