On 6/10/25 10:29 PM, Shinichiro Kawasaki wrote:
On Jun 10, 2025 / 08:49, Bart Van Assche wrote:
Here is an example that shows how a subshell can be used to halt a test
with "set -e" if a failure occurs in such a way that error handling is
still executed:
$ bash -c '(set -e; false; echo "Skipped because the previous command
failed"); echo "Error handling commands outside the subshell are still
executed"'
Error handling commands outside the subshell are still executed
Yes, I understand it. I assume that your idea is to ask test case authors to add
the subshells in test cases when they want to do "set -e", right? My question is
how to ensure that the "set -e" is done only in the subshells. I think we need
to rely one code reviews. If "set -e" out of subshells are overlooked in the
reviews, the impact for the following test cases are left. Maybe this is not a
big risk and we can take it, but I wanted to know what you think about it.
Can this concern be addressed by adding an unconditional set +e in
_call_test after the $test_func call and before the _cleanup call?
Thanks,
Bart.