On Jun 11, 2025 / 08:51, Bart Van Assche wrote: > 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? I'm afraid, no. I'm thinking about this kind of test cases: - it uses "set -e" - it does not use subshell - it has clean up code in test() or test_device() ('IOW, it does not register cleanup handler by _register_test_cleanup()) For such test cases, the clean up code in test() or test_device() can be skipped by error exit by "set -e" regardless of the "set +e" in _call_test().