Re: [PATCH blktests RFC 1/2] check: allow strict error-checking by "set -e" in each test case

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On May 30, 2025 / 08:56, Bart Van Assche wrote:
> On 5/30/25 12:54 AM, Shin'ichiro Kawasaki wrote:
> > diff --git a/check b/check
> > index dad5e70..3cf741a 100755
> > --- a/check
> > +++ b/check
> > @@ -502,9 +502,9 @@ _check_and_call_test_device() {
> >   			fi
> >   		fi
> >   		RESULTS_DIR="$OUTPUT/$(basename "$TEST_DEV")""$postfix"
> > -		if ! _call_test test_device; then
> > -			ret=1
> > -		fi
> > +		_call_test test_device
> > +		# shellcheck disable=SC2181
> > +		(($? != 0)) && ret=1
> 
> These alternatives may be easier to read than the above:
> 
> if _call_test test_device; then :; else ret=1; fi
> 
> if ! { _call_test test_device; }; then ret=1; fi

These do no work either, since the _call_test falls in the exceptional case that
bash errexit feature does not work: The bash man page notes about it

  "..., part of the test following the if or elif reserved words, ..."

> 
> Additionally, please add a comment that explains that ! should not be
> used directly because it causes set -e to be ignored in the called
> function.

Will do it in the next post.




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux