[PATCH blktests 0/2] check: support "set -e" strict error-checking

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

 



In bash script development, it is a good practices to handle errors
strictly using "set -e" or "set -o errexit". When this option is
enabled, bash exits immediately upon encountering an error. There have
been discussions about implementing this strict error-checking mechanism
in blktests test cases [1]. Recently, these discussions were revisited,
and it has been proposed to enable this strict error-checking for a
limited subset of test cases [2].

This series supports the "set -e" strict error-checking based on the
discussion. The first patch modifies the check script to allow "set -e"
in test cases. The second patch introduces the new flag ERR_EXIT to
enable the error-checking for test cases selectively.

[1] https://github.com/linux-blktests/blktests/issues/89
[2] https://lore.kernel.org/linux-block/ckctv7ioomqpxe2iwcg6eh6fvtzamoihnmwxvavd7lanr4y2y6@fbznem3nvw3w/

Changes from RFC:
* 1st patch: added comments to explain why 'if' and '!' are avoided
* 2nd patch: introduced ERR_EXIT flag instead for grepping "set -e"

Shin'ichiro Kawasaki (2):
  check: allow strict error-checking by "set -e" in test cases
  check: introduce ERR_EXIT flag

 check             | 48 ++++++++++++++++++++++++++++++++++-------------
 common/shellcheck |  4 +++-
 new               |  6 ++++++
 3 files changed, 44 insertions(+), 14 deletions(-)

-- 
2.49.0





[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