[PATCH 1/2] t0109: refactor test code into a function

John Keeping john at keeping.me.uk
Mon Apr 15 16:56:11 CEST 2013


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.

?




More information about the CGit mailing list