Re: [PATCH v2 2/2] test: replace use of gdb with LD_PRELOAD shims in T070-insert.sh
On Sun 2019-06-16 14:35:53 +0300, Tomi Ollila wrote: > On Mon, Jun 10 2019, Daniel Kahn Gillmor wrote: >> +test_expect_code 1 "$(printf "notmuch_with_shim shim-%q insert < %q" >> "$code" "$gen_msg_filename")" > > does test_expect_code 1 'notmuch_with_shim shim-$code insert < > "$gen_msg_filename"' hm, i think your proposal would do the right thing, but if someone was to "clobber those variables in the call path" as you put it -- or if it ended up getting evaluated by a subshell that didn't have those variables exported, it would fail. Furthermore, when test_expect_code fails, at least one of the failure paths prints out the literal string that it received as the "$2" argument, so it's nice to have the literal string fully-expanded before it gets passed to test_expect_code. So for both of those reasons (fragility of variables in the callpath; and clearer test failure reporting) i prefer the way i've done it even if it is a bit harder to read. I won't fight too hard about this though, i've got other things on my plate with a higher priority. So if you want to offer a third variant of bremner's patches with your preferred approach, i'll probably be ok with it. --dkg signature.asc Description: PGP signature ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch
Re: [PATCH v2 2/2] test: replace use of gdb with LD_PRELOAD shims in T070-insert.sh
On Mon, Jun 10 2019, Daniel Kahn Gillmor wrote: > diff --git a/test/T070-insert.sh b/test/T070-insert.sh > index 48165caa..017124fc 100755 > --- a/test/T070-insert.sh > +++ b/test/T070-insert.sh > @@ -266,30 +264,18 @@ gen_insert_msg > > for code in FILE_NOT_EMAIL READ_ONLY_DATABASE UPGRADE_REQUIRED PATH_ERROR; > do > test_begin_subtest "EXIT_FAILURE when index_file returns $code" > -test_expect_code 1 \ > - "${TEST_GDB} --batch-silent --return-child-result \ > - -ex 'set args insert < $gen_msg_filename' \ > - -x index-file-$code.gdb notmuch" > +test_expect_code 1 "$(printf "notmuch_with_shim shim-%q insert < %q" > "$code" "$gen_msg_filename")" does test_expect_code 1 'notmuch_with_shim shim-$code insert < "$gen_msg_filename"' i.e $code and "$gen_msg_filename" are evaluated by eval instead when given as an argument to test_expect_code to me it look like is what get executed in test_run_ (called by test_expect_code) and neither of the 2 variables are clobbered in the call path :D eval >&3 2>&4 'notmuch_with_shim shim-$code insert < "$gen_msg_filename"' Tomi ___ notmuch mailing list notmuch@notmuchmail.org https://notmuchmail.org/mailman/listinfo/notmuch