List for cgit developers and users
 help / color / mirror / Atom feed
* [PATCH 1/2] t0109: refactor test code into a function
@ 2013-04-14 16:07 john
  2013-04-14 16:07 ` [PATCH 2/2] t0109: test using multiple URLs john
  2013-04-15 14:48 ` [PATCH 1/2] t0109: refactor test code into a function Jason
  0 siblings, 2 replies; 5+ messages in thread
From: john @ 2013-04-14 16:07 UTC (permalink / raw)


This will allow us to run this test for multiple URLs.

While doing this, also specify CGIT_CONFIG and QUERY_STRING when
invoking cgit under strace.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 tests/t0109-gitconfig.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/t0109-gitconfig.sh b/tests/t0109-gitconfig.sh
index f64e691..31d18b5 100755
--- a/tests/t0109-gitconfig.sh
+++ b/tests/t0109-gitconfig.sh
@@ -9,17 +9,22 @@ test -n "$(which strace 2>/dev/null)" || {
 	exit
 }
 
-test_expect_success 'no access to $HOME' '
+test_no_home_access () {
 	non_existant_path="/path/to/some/place/that/does/not/possibly/exist"
 	while test -d "$non_existant_path"; do
 		non_existant_path="$non_existant_path/$(date +%N)"
-	done
+	done &&
+	CGIT_CONFIG="$(pwd)/cgitrc" QUERY_STRING="url=$1" \
 	strace \
 		-E HOME="$non_existant_path" \
 		-E CGIT_CONFIG="$PWD/cgitrc" \
 		-E QUERY_STRING="url=foo/commit" \
 		-e access -f -o strace.out cgit &&
 	test_must_fail grep "$non_existant_path" strace.out
+}
+
+test_expect_success 'no access to $HOME' '
+	test_no_home_access ""
 '
 
 test_done
-- 
1.8.2.694.ga76e9c3.dirty





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

* [PATCH 2/2] t0109: test using multiple URLs
  2013-04-14 16:07 [PATCH 1/2] t0109: refactor test code into a function john
@ 2013-04-14 16:07 ` john
  2013-04-15 14:48 ` [PATCH 1/2] t0109: refactor test code into a function Jason
  1 sibling, 0 replies; 5+ messages in thread
From: john @ 2013-04-14 16:07 UTC (permalink / raw)


This ensures that we don't end up reading a configuration later for some
specific view.

Signed-off-by: John Keeping <john at keeping.me.uk>
---
 tests/t0109-gitconfig.sh | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/tests/t0109-gitconfig.sh b/tests/t0109-gitconfig.sh
index 31d18b5..154a595 100755
--- a/tests/t0109-gitconfig.sh
+++ b/tests/t0109-gitconfig.sh
@@ -27,4 +27,36 @@ test_expect_success 'no access to $HOME' '
 	test_no_home_access ""
 '
 
+test_expect_success 'foo' '
+	test_no_home_access foo
+'
+
+test_expect_success 'foo/refs' '
+	test_no_home_access foo/refs
+'
+
+test_expect_success 'foo/log' '
+	test_no_home_access foo/log
+'
+
+test_expect_success 'foo/tree' '
+	test_no_home_access foo/tree
+'
+
+test_expect_success 'foo/tree/file-1' '
+	test_no_home_access foo/tree/file-1
+'
+
+test_expect_success 'foo/commit' '
+	test_no_home_access foo/commit
+'
+
+test_expect_success 'foo/diff' '
+	test_no_home_access foo/diff
+'
+
+test_expect_success 'foo/patch' '
+	test_no_home_access foo/patch
+'
+
 test_done
-- 
1.8.2.694.ga76e9c3.dirty





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

* [PATCH 1/2] t0109: refactor test code into a function
  2013-04-14 16:07 [PATCH 1/2] t0109: refactor test code into a function john
  2013-04-14 16:07 ` [PATCH 2/2] t0109: test using multiple URLs john
@ 2013-04-15 14:48 ` Jason
  2013-04-15 14:56   ` john
  1 sibling, 1 reply; 5+ messages in thread
From: Jason @ 2013-04-15 14:48 UTC (permalink / raw)


On Sun, Apr 14, 2013 at 6:07 PM, John Keeping <john at keeping.me.uk> wrote:
> -test_expect_success 'no access to $HOME' '
> +test_no_home_access () {
>         non_existant_path="/path/to/some/place/that/does/not/possibly/exist"
>         while test -d "$non_existant_path"; do
>                 non_existant_path="$non_existant_path/$(date +%N)"
> -       done
> +       done &&
> +       CGIT_CONFIG="$(pwd)/cgitrc" QUERY_STRING="url=$1" \

Superfluous, as strace sets environment variables.


>         strace \
>                 -E HOME="$non_existant_path" \
>                 -E CGIT_CONFIG="$PWD/cgitrc" \
>                 -E QUERY_STRING="url=foo/commit" \

In fact, it still picks up this old one.

>                 -e access -f -o strace.out cgit &&
>         test_must_fail grep "$non_existant_path" strace.out
> +}
> +
> +test_expect_success 'no access to $HOME' '
> +       test_no_home_access ""
>  '
>

I refactored this commit and 2/2 here:

http://git.zx2c4.com/cgit/commit/?h=wip&id=a814ede7838c5d2be8d0e926e2dfe4a4c66d7dcc




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

* [PATCH 1/2] t0109: refactor test code into a function
  2013-04-15 14:48 ` [PATCH 1/2] t0109: refactor test code into a function Jason
@ 2013-04-15 14:56   ` john
  2013-04-15 15:00     ` Jason
  0 siblings, 1 reply; 5+ messages in thread
From: john @ 2013-04-15 14:56 UTC (permalink / raw)


On Mon, Apr 15, 2013 at 04:48:45PM +0200, Jason A. Donenfeld wrote:
> On Sun, Apr 14, 2013 at 6:07 PM, John Keeping <john at keeping.me.uk> wrote:
> > -test_expect_success 'no access to $HOME' '
> > +test_no_home_access () {
> >         non_existant_path="/path/to/some/place/that/does/not/possibly/exist"
> >         while test -d "$non_existant_path"; do
> >                 non_existant_path="$non_existant_path/$(date +%N)"
> > -       done
> > +       done &&
> > +       CGIT_CONFIG="$(pwd)/cgitrc" QUERY_STRING="url=$1" \
> 
> Superfluous, as strace sets environment variables.
> 
> 
> >         strace \
> >                 -E HOME="$non_existant_path" \
> >                 -E CGIT_CONFIG="$PWD/cgitrc" \
> >                 -E QUERY_STRING="url=foo/commit" \
> 
> In fact, it still picks up this old one.

Ah, so it does :-(

> >                 -e access -f -o strace.out cgit &&
> >         test_must_fail grep "$non_existant_path" strace.out
> > +}
> > +
> > +test_expect_success 'no access to $HOME' '
> > +       test_no_home_access ""
> >  '
> >
> 
> I refactored this commit and 2/2 here:
> 
> http://git.zx2c4.com/cgit/commit/?h=wip&id=a814ede7838c5d2be8d0e926e2dfe4a4c66d7dcc

Thanks.  The code looks good, but the commit message seems a little
confused now.  How about:

    t0109: test more URLs

    In order to ensure that we don't access $HOME at some point after
    initial startup when rendering a specific view, run the strace test
    on a range of different pages.

?




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

* [PATCH 1/2] t0109: refactor test code into a function
  2013-04-15 14:56   ` john
@ 2013-04-15 15:00     ` Jason
  0 siblings, 0 replies; 5+ messages in thread
From: Jason @ 2013-04-15 15:00 UTC (permalink / raw)


On Mon, Apr 15, 2013 at 4:56 PM, John Keeping <john at keeping.me.uk> wrote:
>     t0109: test more URLs

Ack.




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

end of thread, other threads:[~2013-04-15 15:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-14 16:07 [PATCH 1/2] t0109: refactor test code into a function john
2013-04-14 16:07 ` [PATCH 2/2] t0109: test using multiple URLs john
2013-04-15 14:48 ` [PATCH 1/2] t0109: refactor test code into a function Jason
2013-04-15 14:56   ` john
2013-04-15 15:00     ` Jason

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