{"thread":{"id":"8124","subject":"[PATCH/RFC] cvsserver: Add test cases for config file handling","startedAt":"2007-05-13T00:17:50Z","lastAt":"2007-05-19T20:32:12Z","messageCount":7,"participants":["Frank Lichtenheld","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"41990","messageId":"11790154701376-git-send-email-frank@lichtenheld.de","threadId":"8124","inReplyTo":null,"subject":"[PATCH/RFC] cvsserver: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-13T00:17:50Z","receivedAt":"2007-05-13T00:17:50Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Add a few test cases for the config file parsing\ndone by git-cvsserver.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n t/t9420-git-cvsserver-config.sh |  108 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 108 insertions(+), 0 deletions(-)\n create mode 100755 t/t9420-git-cvsserver-config.sh\n\n The RFC part is test 4 (gitcvs.ext.enabled = false).\n With the current code it fails, with my GITCVS::config\n patch it succeeds. I think the documentation currently\n states ('method specific options \"override\" general options')\n it should succeed and I guess that would be the more\n intuitive behaviour. Anyone disagree?\n\ndiff --git a/t/t9420-git-cvsserver-config.sh b/t/t9420-git-cvsserver-config.sh\nnew file mode 100755\nindex 0000000..53550e8\n--- /dev/null\n+++ b/t/t9420-git-cvsserver-config.sh\n@@ -0,0 +1,108 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Frank Lichtenheld\n+#\n+\n+test_description='git-cvsserver configuration handling\n+\n+tests the parsing and handling of the git configuration\n+by git-cvsserver'\n+\n+. ./test-lib.sh\n+\n+cvs >/dev/null 2>&1\n+if test $? -ne 1\n+then\n+    test_expect_success 'skipping git-cvsserver tests, cvs not found' :\n+    test_done\n+    exit\n+fi\n+perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {\n+    test_expect_success 'skipping git-cvsserver tests, Perl SQLite interface unavailable' :\n+    test_done\n+    exit\n+}\n+\n+unset GIT_DIR GIT_CONFIG\n+WORKDIR=$(pwd)\n+SERVERDIR=$(pwd)/gitcvs.git\n+CVSROOT=\":fork:$SERVERDIR\"\n+CVSWORK=$(pwd)/cvswork\n+CVS_SERVER=git-cvsserver\n+export CVSROOT CVS_SERVER\n+\n+rm -rf \"$CVSWORK\" \"$SERVERDIR\"\n+echo >empty &&\n+  git add empty &&\n+  git commit -q -m \"First Commit\" &&\n+  git clone -q --local --bare \"$WORKDIR/.git\" \"$SERVERDIR\" >/dev/null 2>&1 &&\n+  GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+  GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.logfile \"$SERVERDIR/gitcvs.log\" ||\n+  exit 1\n+\n+# note that cvs doesn't accept absolute pathnames\n+# as argument to co -d\n+test_expect_success 'basic checkout' \\\n+  'cvs -Q co -d cvswork master &&\n+   test \"$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))\" = \"empty/1.1/\"'\n+\n+test_expect_success 'gitcvs.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n+   if cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n+rm -fr cvswork2\n+\n+test_expect_success 'gitcvs.ext.enabled = true' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n+   cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2'\n+\n+rm -fr cvswork2\n+\n+test_expect_success 'gitcvs.ext.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled false &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+   if cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n+rm -fr cvswork2\n+\n+test_expect_success 'gitcvs.dbname' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&\n+   cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2 &&\n+   test -f \"$SERVERDIR/gitcvs.ext.master.sqlite\" &&\n+   cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs.ext.master.sqlite\"'\n+\n+rm -fr cvswork2\n+\n+# currently fails due to a git-config bug\n+#test_expect_success 'gitcvs.ext.dbname' \\\n+#  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+#   GIT_DIR=\"$SERVERDIR\" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&\n+#   GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&\n+#   cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+#   diff -q cvswork cvswork2 &&\n+#   test -f \"$SERVERDIR/gitcvs1.ext.master.sqlite\" &&\n+#   test ! -f \"$SERVERDIR/gitcvs2.ext.master.sqlite\" &&\n+#   cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs1.ext.master.sqlite\"'\n+\n+\n+test_done\n-- \n1.5.1.4\n"},{"id":"41993","messageId":"117901685018-git-send-email-frank@lichtenheld.de","threadId":"8124","inReplyTo":"11790154701376-git-send-email-frank@lichtenheld.de","subject":"[PATCH (amend)] cvsserver: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-13T00:40:50Z","receivedAt":"2007-05-13T00:40:50Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"Add a few test cases for the config file parsing\ndone by git-cvsserver.\n\nSigned-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n---\n t/t9420-git-cvsserver-config.sh |  109 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 109 insertions(+), 0 deletions(-)\n create mode 100755 t/t9420-git-cvsserver-config.sh\n \n Forgot to copy the changes from Junio's GIT_CONFIG fix.\n\ndiff --git a/t/t9420-git-cvsserver-config.sh b/t/t9420-git-cvsserver-config.sh\nnew file mode 100755\nindex 0000000..e65d093\n--- /dev/null\n+++ b/t/t9420-git-cvsserver-config.sh\n@@ -0,0 +1,109 @@\n+#!/bin/sh\n+#\n+# Copyright (c) 2007 Frank Lichtenheld\n+#\n+\n+test_description='git-cvsserver configuration handling\n+\n+tests the parsing and handling of the git configuration\n+by git-cvsserver'\n+\n+. ./test-lib.sh\n+\n+cvs >/dev/null 2>&1\n+if test $? -ne 1\n+then\n+    test_expect_success 'skipping git-cvsserver tests, cvs not found' :\n+    test_done\n+    exit\n+fi\n+perl -e 'use DBI; use DBD::SQLite' >/dev/null 2>&1 || {\n+    test_expect_success 'skipping git-cvsserver tests, Perl SQLite interface unavailable' :\n+    test_done\n+    exit\n+}\n+\n+unset GIT_DIR GIT_CONFIG\n+WORKDIR=$(pwd)\n+SERVERDIR=$(pwd)/gitcvs.git\n+git_config=\"$SERVERDIR/config\"\n+CVSROOT=\":fork:$SERVERDIR\"\n+CVSWORK=$(pwd)/cvswork\n+CVS_SERVER=git-cvsserver\n+export CVSROOT CVS_SERVER\n+\n+rm -rf \"$CVSWORK\" \"$SERVERDIR\"\n+echo >empty &&\n+  git add empty &&\n+  git commit -q -m \"First Commit\" &&\n+  git clone -q --local --bare \"$WORKDIR/.git\" \"$SERVERDIR\" >/dev/null 2>&1 &&\n+  GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+  GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.logfile \"$SERVERDIR/gitcvs.log\" ||\n+  exit 1\n+\n+# note that cvs doesn't accept absolute pathnames\n+# as argument to co -d\n+test_expect_success 'basic checkout' \\\n+  'GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork master &&\n+   test \"$(echo $(grep -v ^D cvswork/CVS/Entries|cut -d/ -f2,3,5))\" = \"empty/1.1/\"'\n+\n+test_expect_success 'gitcvs.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n+   if GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n+rm -fr cvswork2\n+\n+test_expect_success 'gitcvs.ext.enabled = true' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled false &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2'\n+\n+rm -fr cvswork2\n+\n+test_expect_success 'gitcvs.ext.enabled = false' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled false &&\n+   GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.enabled true &&\n+   if GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1\n+   then\n+     echo unexpected cvs success\n+     false\n+   else\n+     true\n+   fi &&\n+   cat cvs.log | grep -q \"GITCVS emulation disabled\" &&\n+   test ! -d cvswork2'\n+\n+rm -fr cvswork2\n+\n+test_expect_success 'gitcvs.dbname' \\\n+  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+   GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs.%a.%m.sqlite &&\n+   GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+   diff -q cvswork cvswork2 &&\n+   test -f \"$SERVERDIR/gitcvs.ext.master.sqlite\" &&\n+   cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs.ext.master.sqlite\"'\n+\n+rm -fr cvswork2\n+\n+# currently fails due to a git-config bug\n+#test_expect_success 'gitcvs.ext.dbname' \\\n+#  'GIT_DIR=\"$SERVERDIR\" git config --bool gitcvs.ext.enabled true &&\n+#   GIT_DIR=\"$SERVERDIR\" git config gitcvs.ext.dbname %Ggitcvs1.%a.%m.sqlite &&\n+#   GIT_DIR=\"$SERVERDIR\" git config gitcvs.dbname %Ggitcvs2.%a.%m.sqlite &&\n+#   GIT_CONFIG=\"$git_config\" cvs -Q co -d cvswork2 master >cvs.log 2>&1 &&\n+#   diff -q cvswork cvswork2 &&\n+#   test -f \"$SERVERDIR/gitcvs1.ext.master.sqlite\" &&\n+#   test ! -f \"$SERVERDIR/gitcvs2.ext.master.sqlite\" &&\n+#   cmp \"$SERVERDIR/gitcvs.master.sqlite\" \"$SERVERDIR/gitcvs1.ext.master.sqlite\"'\n+\n+\n+test_done\n-- \n1.5.1.4\n"},{"id":"42052","messageId":"7vtzugqym8.fsf@assigned-by-dhcp.cox.net","threadId":"8124","inReplyTo":"117901685018-git-send-email-frank@lichtenheld.de","subject":"Re: [PATCH (amend)] cvsserver: Add test cases for config file handling","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-13T20:04:15Z","receivedAt":"2007-05-13T20:04:15Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Frank Lichtenheld <frank@lichtenheld.de> writes:\n\n> Add a few test cases for the config file parsing\n> done by git-cvsserver.\n>\n> Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n> ---\n>  t/t9420-git-cvsserver-config.sh |  109 +++++++++++++++++++++++++++++++++++++++\n>  1 files changed, 109 insertions(+), 0 deletions(-)\n>  create mode 100755 t/t9420-git-cvsserver-config.sh\n\nDo we really need a separate test script that does quite similar setup?\n"},{"id":"42111","messageId":"20070514125915.GB5272@planck.djpig.de","threadId":"8124","inReplyTo":"7vtzugqym8.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH (amend)] cvsserver: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-14T12:59:16Z","receivedAt":"2007-05-14T12:59:16Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sun, May 13, 2007 at 01:04:15PM -0700, Junio C Hamano wrote:\n> Frank Lichtenheld <frank@lichtenheld.de> writes:\n> \n> > Add a few test cases for the config file parsing\n> > done by git-cvsserver.\n> >\n> > Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n> > ---\n> >  t/t9420-git-cvsserver-config.sh |  109 +++++++++++++++++++++++++++++++++++++++\n> >  1 files changed, 109 insertions(+), 0 deletions(-)\n> >  create mode 100755 t/t9420-git-cvsserver-config.sh\n> \n> Do we really need a separate test script that does quite similar setup?\n\nRight now, probably not.\n\nBut I certainly don't intend to do all the tests in one big file which\nwill become rather large over time. If you're concerned with code\nduplication, maybe I should move the code to a separate file and source\nit from there?\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"42625","messageId":"20070519140521.GA4085@planck.djpig.de","threadId":"8124","inReplyTo":"20070514125915.GB5272@planck.djpig.de","subject":"Re: [PATCH (amend)] cvsserver: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-19T14:05:21Z","receivedAt":"2007-05-19T14:05:21Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Mon, May 14, 2007 at 02:59:16PM +0200, Frank Lichtenheld wrote:\n> On Sun, May 13, 2007 at 01:04:15PM -0700, Junio C Hamano wrote:\n> > Frank Lichtenheld <frank@lichtenheld.de> writes:\n> > \n> > > Add a few test cases for the config file parsing\n> > > done by git-cvsserver.\n> > >\n> > > Signed-off-by: Frank Lichtenheld <frank@lichtenheld.de>\n> > > ---\n> > >  t/t9420-git-cvsserver-config.sh |  109 +++++++++++++++++++++++++++++++++++++++\n> > >  1 files changed, 109 insertions(+), 0 deletions(-)\n> > >  create mode 100755 t/t9420-git-cvsserver-config.sh\n> > \n> > Do we really need a separate test script that does quite similar setup?\n> \n> Right now, probably not.\n> \n> But I certainly don't intend to do all the tests in one big file which\n> will become rather large over time. If you're concerned with code\n> duplication, maybe I should move the code to a separate file and source\n> it from there?\n\nStill waiting on a comment here...\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"},{"id":"42643","messageId":"7v8xbkwpl2.fsf@assigned-by-dhcp.cox.net","threadId":"8124","inReplyTo":"20070519140521.GA4085@planck.djpig.de","subject":"Re: [PATCH (amend)] cvsserver: Add test cases for config file handling","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-05-19T20:00:57Z","receivedAt":"2007-05-19T20:00:57Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Frank Lichtenheld <frank@lichtenheld.de> writes:\n\n>> But I certainly don't intend to do all the tests in one big file which\n>> will become rather large over time. If you're concerned with code\n>> duplication, maybe I should move the code to a separate file and source\n>> it from there?\n>\n> Still waiting on a comment here...\n\nWell, It seems that all of our foreign SCM tests tends to be\nslower than other tests, so I would be happier if a single run\nof one test covers everything we would want to cover, when I run\n\"make test\", rather than having multiple set-up steps that are\nidentical in two different tests.  So in that sense, I was not\ntalking about code duplication which can be solved by splitting\nthe duplicated part into a separate file and sourcing it from\ntwo scripts -- that is not a solution.\n\nAnother thing we would need to decide (with Eric who has the\nsame issue) is how to structure the tests that try daemons.  We\nworked it around by using :fork: for the first cvsserver test,\nbut we would eventually want the real pserver test as well.\n"},{"id":"42648","messageId":"20070519203212.GB4085@planck.djpig.de","threadId":"8124","inReplyTo":"7v8xbkwpl2.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH (amend)] cvsserver: Add test cases for config file handling","fromName":"Frank Lichtenheld","fromEmail":"frank@lichtenheld.de","sentAt":"2007-05-19T20:32:12Z","receivedAt":"2007-05-19T20:32:12Z","isPatch":true,"sender":{"key":"frank@lichtenheld.de","avatar":"https://gravatar.com/avatar/b9f1d4b120e138f157c9e480d0818197c474628923786adb98f30017cdb99c3c?d=mp&s=160"},"body":"On Sat, May 19, 2007 at 01:00:57PM -0700, Junio C Hamano wrote:\n> Well, It seems that all of our foreign SCM tests tends to be\n> slower than other tests, so I would be happier if a single run\n\nWhich only shows that git is so much faster than anything else ;)\n\n> of one test covers everything we would want to cover, when I run\n> \"make test\", rather than having multiple set-up steps that are\n> identical in two different tests.  So in that sense, I was not\n> talking about code duplication which can be solved by splitting\n> the duplicated part into a separate file and sourcing it from\n> two scripts -- that is not a solution.\n\nOk, thanks for the clarification. I will merge the two test files\nfor now and resubmit.\n\nGruesse,\n-- \nFrank Lichtenheld <frank@lichtenheld.de>\nwww: http://www.djpig.de/\n"}]}