From: "Frans Klaver" <fransklaver@gmail.com>
To: "Jonathan Nieder" <jrnieder@gmail.com>
Cc: git@vger.kernel.org, "Junio C. Hamano" <gitster@pobox.com>,
"Johannes Sixt" <j6t@kdbg.org>
Subject: Re: [PATCH 2/5] t0061: Add tests
Date: Wed, 25 Jan 2012 07:47:37 +0100 [thread overview]
Message-ID: <op.v8mntno90aolir@keputer> (raw)
In-Reply-To: <20120124225636.GF8222@burratino>
On Tue, 24 Jan 2012 23:56:36 +0100, Jonathan Nieder <jrnieder@gmail.com>
wrote:
>> +>empty
>> +
>> +cat >incorrect-interpreter-script <<-EOF
>> +#!someinterpreter
>> +cat hello-script
>> +EOF
>> +>empty
>
> What is the point of repreatedly writing an empty file named "empty"?
There isn't. I copied it along with the hello-script lines and didn't pay
it much heed. I'll remove the excessive '>empty's.
> I think this would be easier to read and maintain if scripts not
> shared between multiple tests were written in the body of the relevant
> tests. For example, that way it is easier to remember to remove a
> helper script if the relevant test assertion changes to no longer need
> it.
Makes sense. I'll reorder.
>
> [...]
>> @@ -26,7 +44,7 @@ test_expect_success 'run_command can run a command' '
>> test_cmp empty err
>> '
>>
>> test_expect_success POSIXPERM 'run_command reports EACCES' '
>> cat hello-script >hello.sh &&
>> chmod -x hello.sh &&
>> test_must_fail test-run-command run-command ./hello.sh 2>err &&
> [...]
>> +test_expect_success POSIXPERM 'run_command reports EACCES, search path
>> perms' '
>> + mkdir -p inaccessible &&
>> + PATH=$(pwd)/inaccessible:$PATH &&
>> + export PATH &&
>> +
>> + cat hello-script >inaccessible/hello.sh &&
>> + chmod 400 inaccessible &&
>> + test_must_fail test-run-command run-command hello.sh 2>err &&
>> + chmod 755 inaccessible &&
>> +
>> + grep "fatal: cannot exec.*hello.sh" err
>> +'
>
> (*) These tests would be easier to understand if squashed with the
> relevant later patch in the series that changes the error message.
You mean "Elaborate execvp error checking"?
> Maybe they could be less repetitive that way, too.
>
> test_expect_success POSIXPERM 'diagnose command in inaccessible part of
> $PATH' '
> mkdir -p subdir &&
> cat hello-script >subdir/hello.sh &&
> chmod +x subdir/hello.sh &&
> chmod -x subdir &&
> (
> PATH=$(pwd)/inaccessible:$PATH &&
> test_must_fail test-run-command run-command hello.sh 2>err
> ) &&
> test_i18ngrep ...
> '
>
> [...]
>> +test_expect_success POSIXPERM 'run_command reports EACCES, interpreter
>> fails' '
>> + cat incorrect-interpreter-script >hello.sh &&
>> + chmod +x hello.sh &&
>> + chmod -x someinterpreter &&
>> + test_must_fail test-run-command run-command ./hello.sh 2>err &&
>> +
>> + grep "fatal: cannot exec.*hello.sh" err
>> +'
>
> Is this the common case? Why would my interpreter be in the designated
> spot but not marked executable? Is there some other motivating
> example? (I'm genuinely curious; it's ok if the answer is "no".)
I wouldn't think so. This particular one is addressing a concern raised by
Johannes Sixt in reaction to a patch from Junio.
http://article.gmane.org/gmane.comp.version-control.git/171848
>
> [...]
>> +
>> +test_expect_failure POSIXPERM 'run_command reports ENOENT,
>> interpreter' '
>> + cat non-existing-interpreter >hello.sh &&
>> + chmod +x hello.sh &&
>> + test_must_fail test-run-command start-command-ENOENT ./hello.sh 2>err
>> &&
>> +
>> + grep "error: cannot exec.*hello.sh" err
>> +'
>
> Maybe:
>
> test_expect_success POSIXPERM 'diagnose missing interpreter' '
> echo "#!/nonexistent/interpreter" >hello.sh &&
> chmod +x hello.sh &&
> test_must_fail test-run-command run-command hello.sh 2>err &&
> test_i18ngrep ...
> '
Will check.
> Hope that helps,
> Jonathan
next prev parent reply other threads:[~2012-01-25 6:48 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-24 22:32 [PATCH 0/6 v3] Add execvp failure diagnostics Frans Klaver
2012-01-24 22:32 ` [PATCH 1/5] t0061: Fix incorrect indentation Frans Klaver
2012-01-24 22:39 ` Junio C Hamano
2012-01-24 22:40 ` Jonathan Nieder
2012-01-25 6:27 ` Frans Klaver
2012-01-25 7:00 ` Junio C Hamano
2012-01-25 7:08 ` Frans Klaver
2012-01-25 8:08 ` Frans Klaver
2012-01-24 22:32 ` [PATCH 2/5] t0061: Add tests Frans Klaver
2012-01-24 22:56 ` Jonathan Nieder
2012-01-25 6:47 ` Frans Klaver [this message]
2012-01-24 22:32 ` [PATCH 3/5] run-command: Elaborate execvp error checking Frans Klaver
2012-01-24 23:22 ` Jonathan Nieder
2012-01-25 7:09 ` Frans Klaver
2012-01-25 19:22 ` Jonathan Nieder
2012-01-25 22:48 ` Frans Klaver
2012-01-25 19:03 ` Johannes Sixt
2012-01-25 22:59 ` Frans Klaver
2012-01-24 22:32 ` [PATCH 4/5] run-command: Warn if PATH entry cannot be searched Frans Klaver
2012-01-24 22:32 ` [PATCH 5/5] run-command: Error out if interpreter not found Frans Klaver
2012-01-24 23:24 ` Jonathan Nieder
2012-01-25 7:12 ` Frans Klaver
2012-01-25 18:55 ` Johannes Sixt
2012-01-25 23:09 ` Frans Klaver
2012-01-26 19:32 ` Junio C Hamano
2012-01-27 8:29 ` Frans Klaver
2012-01-27 8:48 ` Jonathan Nieder
2012-01-27 9:11 ` Frans Klaver
2012-01-27 9:41 ` Jonathan Nieder
2012-01-27 11:46 ` Frans Klaver
2012-02-04 21:31 ` Frans Klaver
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=op.v8mntno90aolir@keputer \
--to=fransklaver@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=j6t@kdbg.org \
--cc=jrnieder@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).