git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cvs tests: When root, skip tests that call "cvs commit"
@ 2017-02-27 11:26 Ævar Arnfjörð Bjarmason
  2017-02-27 19:35 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-02-27 11:26 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano, Robin Rosenberg,
	Ævar Arnfjörð Bjarmason

Change the tests that fail to when we run the test suite as root, due
to calling "cvs commit".

The GNU cvs package has an optional compile-time CVS_BADROOT
flag. When compiled with this flag "cvs commit" will refuse to commit
anything as root. On my Debian box this isn't compiled in[1] in, but
on CentOS it is.

I've run all the t/t*cvs*.sh tests, and these are the only two that
fail. For some reason e.g. t9402-git-cvsserver-refs.sh still works as
root despite doing "cvs commit", I haven't dug into why.

This commit is technically being overzealous, we could do better by
making a mock cvs commit as root and run the tests if that works, but
I don't see any compelling reason to bend over backwards to run these
tests in all cases, just skipping them as root seems good enough.

1. Per: strings /usr/bin/cvs|grep 'is not allowed to commit'
   Using cvs 1.11.23 on CentOS, 1.12.13-MirDebian-18 on Debian.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 t/t9200-git-cvsexportcommit.sh | 5 +++++
 t/t9600-cvsimport.sh           | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/t/t9200-git-cvsexportcommit.sh b/t/t9200-git-cvsexportcommit.sh
index bb879a527d..1319415ba8 100755
--- a/t/t9200-git-cvsexportcommit.sh
+++ b/t/t9200-git-cvsexportcommit.sh
@@ -18,6 +18,11 @@ then
     test_done
 fi
 
+if ! test_have_prereq NOT_ROOT; then
+	skip_all='When cvs is compiled with CVS_BADROOT commits as root fail'
+	test_done
+fi
+
 CVSROOT=$PWD/tmpcvsroot
 CVSWORK=$PWD/cvswork
 GIT_DIR=$PWD/.git
diff --git a/t/t9600-cvsimport.sh b/t/t9600-cvsimport.sh
index 4c384ff023..804ce3850f 100755
--- a/t/t9600-cvsimport.sh
+++ b/t/t9600-cvsimport.sh
@@ -3,6 +3,11 @@
 test_description='git cvsimport basic tests'
 . ./lib-cvs.sh
 
+if ! test_have_prereq NOT_ROOT; then
+	skip_all='When cvs is compiled with CVS_BADROOT commits as root fail'
+	test_done
+fi
+
 test_expect_success PERL 'setup cvsroot environment' '
 	CVSROOT=$(pwd)/cvsroot &&
 	export CVSROOT
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cvs tests: When root, skip tests that call "cvs commit"
  2017-02-27 11:26 [PATCH] cvs tests: When root, skip tests that call "cvs commit" Ævar Arnfjörð Bjarmason
@ 2017-02-27 19:35 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2017-02-27 19:35 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: git, Robin Rosenberg

Thanks, makes sense.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-27 19:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-27 11:26 [PATCH] cvs tests: When root, skip tests that call "cvs commit" Ævar Arnfjörð Bjarmason
2017-02-27 19:35 ` Junio C Hamano

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).