Re: [PATCH] Several tests: cd inside subshell instead of around

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jonathan Nieder <jrnieder@xxxxxxxxx> writes:

> Junio C Hamano wrote:
>
>> If we were to insist that no matter how an individual test fail, the test
>> that follows it must start in a known location (namely, $TRASH), then we
>> might want to use something like the attached patch.
>
> I like it.  Affected test scripts:
> ... (many) ...
> and probably some others.

For the record, I _do not_ like it at all.  Is it worth being that
draconian and say each test must start at $TRASH?  What do we gain by it?

We certainly do _not_ want any test to wander around, escape out of the
$TRASH directory and running random "git" command, but as long as N+1th
test knows and expects Nth test might move to a subdirectory of $TRASH and
is prepared to start, I personally do not think it is such a big deal.  It
certainly makes it harder to insert a new test between such a pair of
tests, but like it or not, many of the tests already depend on the state
of the repository that earlier tests left behind.  I think we could just
declare that $cwd is just a small part of that initial state for
individual test that was left behind the earlier test.

After we vet and apply Jens and your "turn 'cd there && do this && cd ..'
into a subshell" series, and the "modernize indentation style" series,
perhaps we should stop and think?  In an ideal world, it would be really
nice if each "test_expect_success/failure" in a single script were
independent from each other (if we did so, GIT_SKIP_TESTS=4321.4 starts to
be more useful), but realistically, I don't think it is worth the effort.

So it may be worth it to check $(pwd) against $TRASH and make sure we
didn't escape $TRASH by mistake at the beginning of each test in test_run_
function, but to me, "must be at $TRASH" feels like a rule for the sake of
it, without really helping us very much.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]