diff options
author | Dan McDonald <danmcd@mnx.io> | 2022-10-12 10:49:40 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-12 10:49:40 -0400 |
commit | 5e9232afcd2578bbade4d6c285ab7f62474a5a30 (patch) | |
tree | 3cab2b9d7ec3c5d375d9c9ffa7e78c2602cff8ad /usr/src/test | |
parent | 3c0d2531d832d7e3af27b37d394ce635bc904754 (diff) | |
download | illumos-joyent-5e9232afcd2578bbade4d6c285ab7f62474a5a30.tar.gz |
OS-8415 smartos-test execution should run ZFS test suite if DISKS and KEEP are set
Reviewed by: Travis Paul <Tr@visPaul.me>
Approved by: Brian Bennett <brian.bennett@mnx.io>
Diffstat (limited to 'usr/src/test')
-rwxr-xr-x | usr/src/test/smartos-test/smartos-test.sh | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/usr/src/test/smartos-test/smartos-test.sh b/usr/src/test/smartos-test/smartos-test.sh index 8bb28887a6..cc2055dc8f 100755 --- a/usr/src/test/smartos-test/smartos-test.sh +++ b/usr/src/test/smartos-test/smartos-test.sh @@ -263,10 +263,12 @@ export KEEP EOF if [[ -n "$DISKS" ]]; then + # NOTE: This will be enough to make this script's execute-tests + # invocation run the ZFS test suite. echo "DISKS=\"$DISKS\"" >> $zprofile echo "export DISKS" >> $zprofile else - msg="echo Please set \$DISKS appropriate before running zfstest" + msg='echo Please set \$DISKS appropriate before running zfstest' echo $msg >> $zprofile fi @@ -279,6 +281,37 @@ EOF fi } +function zfs_test_check { + # DISKS is set either in our environment, or in the .profile of ~ztest. + zprofile=/zones/global/ztest/.profile + zdisksvar=$(su - ztest -c 'echo $DISKS' | tail -1) + + # Check for KEEP too. + grep -q ^KEEP= $zprofile || \ + fatal "Cannot run ZFS test, you need KEEP set in your ztest's environment" + + # If neither are set DO NOT RUN the ztests. + if [[ -z $DISKS && -z $zdisksvar ]]; then + fatal "Cannot run ZFS test, you need DISKS set in your or ztest's environment" + fi + + # Check if they are both non-zero and different. + if [[ -n "$DISKS" && -n "$zdisksvar" && "$DISKS" != "$zdisksvar" ]]; then + log "DISKS in current root environment: $DISKS" + log "DISKS in user ztest's environment: $zdisksvar" + fatal "Pleast reconcile these two before running the ZFS tests." + fi + + if [[ -z "$zdisksvar" ]]; then + # put DISKS into ztest's .profile. + echo "DISKS=\"$DISKS\"" >> $zprofile + echo "export DISKS" >> $zprofile + fi + + # OKAY, now we can run it! + log_test zfstest su - ztest -c /opt/zfs-tests/bin/zfstest +} + # # By using log_test or log_testrunner, we accumulate the exit codes from each # test run to $RESULT. @@ -296,6 +329,7 @@ function execute_tests { log_test vndtest /opt/vndtest/bin/vndtest -a log_testrunner util-tests /opt/util-tests/runfiles/default.run log_testrunner os-tests /opt/os-tests/runfiles/default.run + zfs_test_check if [[ -n "$FAILED_TESTS" ]]; then echo "" |