Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZTS: Use correct signal numbers for status checks #10121

Merged
merged 1 commit into from
Mar 12, 2020

Conversation

ghost
Copy link

@ghost ghost commented Mar 11, 2020

Motivation and Context

Different operating systems encode exit status in different ways.
The logapi shell library assumes the Solaris meaning of exit codes,
which is not correct on other platforms.

Description

Define the needed constants according to the platform we are running
on and use those to decode process exit status.

How Has This Been Tested?

ZTS on FreeBSD

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the ZFS on Linux code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes.
  • I have run the ZFS Test Suite with this change applied.
  • All commit messages are properly formatted and contain Signed-off-by.

Different operating systems encode exit status in different ways.
The logapi shell library assumes the Solaris meaning of exit codes,
which is not correct on other platforms.

Define the needed constants according to the platform we are running
on and use those to decode process exit status.

Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
@ghost ghost added Component: Test Suite Indicates an issue with the test framework or a test case Status: Code Review Needed Ready for review and testing labels Mar 11, 2020
@codecov-io
Copy link

codecov-io commented Mar 12, 2020

Codecov Report

Merging #10121 into master will increase coverage by 26.32%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff             @@
##           master   #10121       +/-   ##
===========================================
+ Coverage   49.72%   76.04%   +26.32%     
===========================================
  Files         324      385       +61     
  Lines       97160   122389    +25229     
===========================================
+ Hits        48309    93070    +44761     
+ Misses      48851    29319    -19532     
Flag Coverage Δ
#kernel 79.76% <ø> (+73.44%) ⬆️
#user 47.49% <ø> (-10.42%) ⬇️
Impacted Files Coverage Δ
module/icp/asm-x86_64/aes/aeskey.c 0.00% <0.00%> (-100.00%) ⬇️
module/icp/algs/modes/gcm_generic.c 10.52% <0.00%> (-89.48%) ⬇️
cmd/ztest/ztest.c 6.85% <0.00%> (-73.71%) ⬇️
module/icp/algs/aes/aes_impl_generic.c 0.82% <0.00%> (-69.55%) ⬇️
module/icp/algs/aes/aes_impl_x86-64.c 40.00% <0.00%> (-60.00%) ⬇️
lib/libspl/include/os/linux/sys/byteorder.h 50.00% <0.00%> (-50.00%) ⬇️
module/icp/algs/aes/aes_impl.c 33.59% <0.00%> (-30.47%) ⬇️
module/zfs/lzjb.c 83.33% <0.00%> (-14.82%) ⬇️
lib/libspl/list.c 70.58% <0.00%> (-12.95%) ⬇️
module/zfs/zcp_global.c 87.50% <0.00%> (-12.50%) ⬇️
... and 303 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6187151...d1e649f. Read the comment docs.

@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Mar 12, 2020
@behlendorf behlendorf merged commit 94eb65b into openzfs:master Mar 12, 2020
@ghost ghost deleted the zts-logapi-status branch March 12, 2020 18:44
ghost pushed a commit to zfsonfreebsd/ZoF that referenced this pull request Mar 16, 2020
While openzfs#10121 did fix the signal numbers for FreeBSD/Darwin, it
incorrectly changed the expected encoding of exit status for commands
that exited on a signal.  The encoding 256+signum is a feature of the
shell.  Only the signal numbers themselves are platform-dependent.

Always use the encoding 256+signum when checking exit status for
signal exits.

Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
behlendorf pushed a commit that referenced this pull request Mar 17, 2020
While #10121 did fix the signal numbers for FreeBSD/Darwin, it
incorrectly changed the expected encoding of exit status for commands
that exited on a signal.  The encoding 256+signum is a feature of the
shell.  Only the signal numbers themselves are platform-dependent.

Always use the encoding 256+signum when checking exit status for
signal exits.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10137
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
Different operating systems encode exit status in different ways.
The logapi shell library assumes the Solaris meaning of exit codes,
which is not correct on other platforms.

Define the needed constants according to the platform we are running
on and use those to decode process exit status.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#10121
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
While openzfs#10121 did fix the signal numbers for FreeBSD/Darwin, it
incorrectly changed the expected encoding of exit status for commands
that exited on a signal.  The encoding 256+signum is a feature of the
shell.  Only the signal numbers themselves are platform-dependent.

Always use the encoding 256+signum when checking exit status for
signal exits.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes openzfs#10137
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Test Suite Indicates an issue with the test framework or a test case Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants