{"thread":{"id":"2332","subject":"[PATCH] cogito: make tutorial-script a testsuite","startedAt":"2005-11-03T01:16:22Z","lastAt":"2005-11-03T10:36:37Z","messageCount":2,"participants":["Pavel Roskin","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"11052","messageId":"1130980582.20017.14.camel@dv","threadId":"2332","inReplyTo":null,"subject":"[PATCH] cogito: make tutorial-script a testsuite","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-11-03T01:16:22Z","receivedAt":"2005-11-03T01:16:22Z","isPatch":true,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Documentation/tutorial-script/script.sh can be used as a testsuite.\nErrors should cause the script to exit.  Unexpected success should be\ntreated like an error.  Successful completion should be reported.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\n---\n\nCurrently, the last cg-merge invocation doesn't fail as it should, and\nthe subsequent ed scripts fail for Makefile and rpn.c.  I don't have a\nfix for that.  Most likely, the script in cogito differs from the\noriginal version.  Horst, could you please have a look?\n\ndiff --git a/Documentation/tutorial-script/script.sh\nb/Documentation/tutorial-script/script.sh\nindex 26adec0..fe43e65 100755\n--- a/Documentation/tutorial-script/script.sh\n+++ b/Documentation/tutorial-script/script.sh\n@@ -1,10 +1,16 @@\n-#!/bin/sh\n+#!/bin/sh -e\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 # tags, and consequently no support for remotes/).\n \n \n+should_fail () {\n+\techo \"Expected failure, got success - aborting\" >&2\n+\texit 1\n+}\n+\n+\n ### Set up playground\n sh 0000-playground.sh\n TOP=$(pwd)\n@@ -98,7 +104,7 @@ git branch\n # Alice needs to register his remote branch\n cg-branch-add bobswork $BOB/rpn\n # Now try to merge Bob's work to the bob branch\n-cg-update bobswork\n+cg-update bobswork && should_fail\n \n # There are conflicts in rpn.c. Looking at the file, Alice sees the\n # difference between her version and Bob's:\n@@ -190,11 +196,12 @@ cd $ALICE/rpn\n git checkout master\n # Alice tries \"git merge\" instead of \"cg-merge\" since she wanted to\n # merge both branches at once, which \"cg-merge\" cannot do.\n-git merge \"Integrate changes from Bob and Charlie\" master bob charlie\n+git merge \"Integrate changes from Bob and Charlie\" master bob charlie \\\n+\t&& should_fail\n \n # Automatic 3-way merge fails! Have to do it step by step\n \n-cg-merge bob\n+cg-merge bob && should_fail\n \n # Merge fails:\n \n@@ -213,7 +220,7 @@ ed Makefile < $TOP/0017-alice-bob-fixup.\n \n cg-commit -m \"Integrate Bob's changes\"\n \n-cg-merge charlie\n+cg-merge charlie && should_fail\n \n # Merge conflicts!\n \n@@ -282,10 +289,10 @@ cg-fetch\n # (Note that originally, rpn-0.4 was signed, but that would require you\n # to set up a GPG key before running the script... verify-tag on unsigned\n # scripts does not make much sense.)\n-git verify-tag rpn-0.4\n+git verify-tag rpn-0.4 && should_fail\n \n # Everything's OK, integrate the changes\n-echo \"Merge with 0.4\" | cg-merge\n+echo \"Merge with 0.4\" | cg-merge && should_fail\n \n # Merge conflicts in Makefile, rpn.c\n # Mishandled stack.h\n@@ -296,3 +303,6 @@ cg-add stack.h\n \n # Now commit the whole\n cg-commit -m \"Merge with 0.4\"\n+\n+# Great, we are done.\n+echo \"Script completed successfully!\"\n\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"11064","messageId":"20051103103637.GI1431@pasky.or.cz","threadId":"2332","inReplyTo":"1130980582.20017.14.camel@dv","subject":"Re: [PATCH] cogito: make tutorial-script a testsuite","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-11-03T10:36:37Z","receivedAt":"2005-11-03T10:36:37Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Thu, Nov 03, 2005 at 02:16:22AM CET, I got a letter\nwhere Pavel Roskin <proski@gnu.org> told me that...\n> Documentation/tutorial-script/script.sh can be used as a testsuite.\n> Errors should cause the script to exit.  Unexpected success should be\n> treated like an error.  Successful completion should be reported.\n\nThanks, applied. Perhaps we could invoke it during make test as well...\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"}]}