{"thread":{"id":"2514","subject":"[PATCH] cogito tutorial-script - more testsuite improvements","startedAt":"2005-11-14T23:14:45Z","lastAt":"2005-11-14T23:14:45Z","messageCount":1,"participants":["Pavel Roskin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"11855","messageId":"1132010085.24084.32.camel@dv","threadId":"2514","inReplyTo":null,"subject":"[PATCH] cogito tutorial-script - more testsuite improvements","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-14T23:14:45Z","receivedAt":"2005-11-14T23:14:45Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Report line in should_fail().  Require bash, since reporting calling\nline is bash specific.  Set \"-e\" flag in the script, so that e.g.\n\"bash -x script.sh\" cannot cancel it accidentally.  Trap and report\nunexpected errors.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/Documentation/tutorial-script/script.sh b/Documentation/tutorial-script/script.sh\nindex 8cdfe36..bc70b77 100755\n--- a/Documentation/tutorial-script/script.sh\n+++ b/Documentation/tutorial-script/script.sh\n@@ -1,4 +1,4 @@\n-#!/bin/sh -e\n+#!/bin/bash\n #\n # FIXME: This script has many GITisms. Some of them are unnecessary, while\n # some stem from missing Cogito features (especially no support for pushing\n@@ -10,10 +10,16 @@\n # for executing this script to make sure we did not break it with any\n # Cogito changes.\n should_fail () {\n-\techo \"Expected failure, got success - aborting\" >&2\n+\techo \"Expected failure, got success on line ${BASH_LINENO[0]}\" \\\n+\t     \"- aborting\" >&2\n+\ttrap - exit\n \texit 1\n }\n \n+# Conversely, if something fails when it shouldn't, report it and exit.\n+set -e\n+trap 'echo >&2 \"Unexpected error $? on line $LINENO\"; exit 1' exit\n+\n \n ### Set up playground\n sh 0000-playground.sh\n@@ -309,4 +315,5 @@ cg-add stack.h\n cg-commit -m \"Merge with 0.4\"\n \n # Great, we are done.\n+trap - exit\n echo \"Script completed successfully!\"\n\n\n\n-- \nRegards,\nPavel Roskin\n"}]}