git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Skip unwritable tests for root
@ 2008-06-30  7:05 Fernando J. Pereda
  2008-06-30  7:39 ` Jakub Narebski
  2008-06-30  9:08 ` Junio C Hamano
  0 siblings, 2 replies; 5+ messages in thread
From: Fernando J. Pereda @ 2008-06-30  7:05 UTC (permalink / raw)
  To: git; +Cc: Junio C Hamano

Signed-off-by: Fernando J. Pereda <ferdy@ferdyx.org>
---
 t/t0004-unwritable.sh |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/t/t0004-unwritable.sh b/t/t0004-unwritable.sh
index 9255c63..728ec22 100755
--- a/t/t0004-unwritable.sh
+++ b/t/t0004-unwritable.sh
@@ -4,6 +4,13 @@ test_description='detect unwritable repository and fail correctly'
 
 . ./test-lib.sh
 
+if test "$(id -u)" -eq 0
+then
+	test_expect_success 'root writes to unwritable places, skipping test' :
+	test_done
+	exit
+fi
+
 test_expect_success setup '
 
 	>file &&
-- 
1.5.6.1

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

* Re: [PATCH] Skip unwritable tests for root
  2008-06-30  7:05 [PATCH] Skip unwritable tests for root Fernando J. Pereda
@ 2008-06-30  7:39 ` Jakub Narebski
  2008-06-30  9:08 ` Junio C Hamano
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2008-06-30  7:39 UTC (permalink / raw)
  To: Fernando J. Pereda; +Cc: git, Junio C Hamano

"Fernando J. Pereda" <ferdy@ferdyx.org> writes:

> +if test "$(id -u)" -eq 0
> +then
> +	test_expect_success 'root writes to unwritable places, skipping test' :
> +	test_done
> +	exit
> +fi

Yet another place that would profit from test_skip in test-lib.sh...
(Junio uses "say skip" instead of "test_expect_success" in the place
like above here).
-- 
Jakub Narebski
Poland
ShadeHawk on #git

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

* Re: [PATCH] Skip unwritable tests for root
  2008-06-30  7:05 [PATCH] Skip unwritable tests for root Fernando J. Pereda
  2008-06-30  7:39 ` Jakub Narebski
@ 2008-06-30  9:08 ` Junio C Hamano
  2008-06-30  9:27   ` Fernando J. Pereda
  2008-07-07 19:14   ` Lea Wiemann
  1 sibling, 2 replies; 5+ messages in thread
From: Junio C Hamano @ 2008-06-30  9:08 UTC (permalink / raw)
  To: Fernando J. Pereda; +Cc: git

"Fernando J. Pereda" <ferdy@ferdyx.org> writes:

> Signed-off-by: Fernando J. Pereda <ferdy@ferdyx.org>

Hmm.  Actually we've deliberately ignored this so far.  If we were to do
anything, don't we rather want to fail everything upfront when the tests
are run by root?

Running "make" and "make test" before "make install" is so that you have
less chance hurting your running system, and I find it simply crazy to
build (i.e. "make all") as root, let alone running tests.

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

* Re: [PATCH] Skip unwritable tests for root
  2008-06-30  9:08 ` Junio C Hamano
@ 2008-06-30  9:27   ` Fernando J. Pereda
  2008-07-07 19:14   ` Lea Wiemann
  1 sibling, 0 replies; 5+ messages in thread
From: Fernando J. Pereda @ 2008-06-30  9:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

[-- Attachment #1: Type: text/plain, Size: 830 bytes --]

On Mon, Jun 30, 2008 at 02:08:18AM -0700, Junio C Hamano wrote:
> "Fernando J. Pereda" <ferdy@ferdyx.org> writes:
> 
> > Signed-off-by: Fernando J. Pereda <ferdy@ferdyx.org>
> 
> Hmm.  Actually we've deliberately ignored this so far.  If we were to do
> anything, don't we rather want to fail everything upfront when the tests
> are run by root?
> 
> Running "make" and "make test" before "make install" is so that you have
> less chance hurting your running system, and I find it simply crazy to
> build (i.e. "make all") as root, let alone running tests.

*nod*

This originated because Gentoo can be told to build stuff as root (and
run test as root) under a sandbox. Since I already had the patch
locally, I guessed you might be interested in it and just sent it.

I'll just apply it locally.

- ferdy


[-- Attachment #2: Type: application/pgp-signature, Size: 194 bytes --]

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

* Re: [PATCH] Skip unwritable tests for root
  2008-06-30  9:08 ` Junio C Hamano
  2008-06-30  9:27   ` Fernando J. Pereda
@ 2008-07-07 19:14   ` Lea Wiemann
  1 sibling, 0 replies; 5+ messages in thread
From: Lea Wiemann @ 2008-07-07 19:14 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Fernando J. Pereda, git, Jakub Narebski

Junio C Hamano wrote:
> If we were to do anything, don't we rather want to fail everything upfront
> when the tests are run by root [because it's crazy]?

I think that unless/until someone wants to submit a patch that makes the
tests fail upfront, we should use Fernando's patch; it's an improvement
over the current situation.

I'm actually not entirely sure if skipping or failing everything if the
tests are run as root is a good idea -- for instance, neither skipping
nor failing seems appropriate for Gentoo's root-in-a-sandbox situation.

Jakub Narebski wrote:
> "Fernando J. Pereda" <ferdy@ferdyx.org> writes:
>> +	test_expect_success '[...], skipping test' :
>> +	test_done
>> +	exit
>
> Yet another place that would profit from test_skip in test-lib.sh...

*nods*  I'd rather name it 'test_skip_all' for clarity though, at least
if it contains "test_done; exit".  (I'm not volunteering to send a
patch, FTR...)

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

end of thread, other threads:[~2008-07-07 22:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-30  7:05 [PATCH] Skip unwritable tests for root Fernando J. Pereda
2008-06-30  7:39 ` Jakub Narebski
2008-06-30  9:08 ` Junio C Hamano
2008-06-30  9:27   ` Fernando J. Pereda
2008-07-07 19:14   ` Lea Wiemann

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