RE: [Test] t1901 - sparse checkout file when lock is taken fails (subtest 19)

From: Randall S. Becker <hidden>
Date: 2020-03-10 14:40:45

From: Randall S. Becker <redacted>
On March 5, 2020 10:45 AM, I wrote:
This one has me confused. It fails 100% of the time on NonStop. The test
looks reasonable, as do the messages. I am not certain that test_i18ngrep
works properly - it falls down to the return 1 statement which causes the
test
to fail. The error message generated is "File already exists" not "File
exists"
as is required in the test. We should not be testing for specific text
content
originating from strerror - I thought we had this decision in a different
thread. https://public-inbox.org/git/xmqq36intlpj.fsf@gitster-
ct.c.googlers.com/

Thoughts?

expecting success of 1091.19 'fail when lock is taken':
        test_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&
        touch repo/.git/info/sparse-checkout.lock &&
        test_must_fail git -C repo sparse-checkout set deep 2>err &&
        test_i18ngrep "File exists" err

error: 'grep File exists err' didn't find a match in:
fatal: Unable to create '/home/ituglib/randall/git/t/trash
directory.t1091-
sparse-checkout-builtin/repo/.git/info/sparse-checkout.lock': File already
exists.   <----- this is the test issue

Another git process seems to be running in this repository, e.g.
an editor opened by 'git commit'. Please make sure all processes are
terminated then try again. If it still fails, a git process may have
crashed in
this repository earlier:
remove the file manually to continue.
not ok 19 - fail when lock is taken
#
#               test_when_finished rm -rf
repo/.git/info/sparse-checkout.lock &&
#               touch repo/.git/info/sparse-checkout.lock &&
#               test_must_fail git -C repo sparse-checkout set deep 2>err
&&
#               test_i18ngrep "File exists" err
#
This situation still occurs at 2.26.0-rc0. As above, this results from a
text compare to a platform-specific message that should not be used. To hack
around it, a possible fix (which I don't like) could be as follows:

index b4c9c32a03..d1fd225dad 100755
--- a/t/t1091-sparse-checkout-builtin.sh
+++ b/t/t1091-sparse-checkout-builtin.sh
@@ -305,7 +305,7 @@ test_expect_success 'fail when lock is taken' '
        test_when_finished rm -rf repo/.git/info/sparse-checkout.lock &&
        touch repo/.git/info/sparse-checkout.lock &&
        test_must_fail git -C repo sparse-checkout set deep 2>err &&
-       test_i18ngrep "File exists" err
+       test_i18ngrep "File \(already \)*exists" err
 '
This does not remove the problem of platform error compares, but does allow
the test to temporarily pass.

Randall
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help