Skip to content

Commit

Permalink
ZTS: Fix zpool_reguid Makefile.am and tests
Browse files Browse the repository at this point in the history
The zpool_reguid tests were not being included the dist tarball
resulting in them not running.  This is reported as a "failed
verification" warning by the CI.  Add the tests to the correct
Makefile.am.

Additionally, remove the usage of 'bc -e <expr>' from the tests.
This option is only supported by the FreeBSD version of bc.

Update the test case to reflect the 0 is not a valid GUID.

Reviewed-by: Tino Reichardt <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#16559
  • Loading branch information
behlendorf authored Sep 25, 2024
1 parent 05a7a95 commit b2ca510
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
4 changes: 4 additions & 0 deletions tests/zfs-tests/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,10 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/cli_root/zpool_prefetch/cleanup.ksh \
functional/cli_root/zpool_prefetch/setup.ksh \
functional/cli_root/zpool_prefetch/zpool_prefetch_001_pos.ksh \
functional/cli_root/zpool_reguid/cleanup.ksh \
functional/cli_root/zpool_reguid/setup.ksh \
functional/cli_root/zpool_reguid/zpool_reguid_001_pos.ksh \
functional/cli_root/zpool_reguid/zpool_reguid_002_neg.ksh \
functional/cli_root/zpool_remove/cleanup.ksh \
functional/cli_root/zpool_remove/setup.ksh \
functional/cli_root/zpool_remove/zpool_remove_001_neg.ksh \
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ if [[ "$initial_guid" == "$new_guid" ]]; then
log_fail "GUID change failed; GUID has not changed: $initial_guid"
fi

for g in "$(bc -e '2^64 - 1')" 0; do
for g in "$(echo '2^64 - 1' | bc)" "314"; do
set_guid "$g"
done
# zpool-reguid(8) will strip the leading 0.
set_guid 0123 "123"
# GUID "-1" is effectively 2^64 - 1 in value.
set_guid -1 "$(bc -e '2^64 - 1')"
set_guid -1 "$(echo '2^64 - 1' | bc)"

log_pass "'zpool reguid' changes GUID as expected."
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ check_guid() {

log_assert "Verify 'zpool reguid' does not accept invalid GUIDs"

for ig in "$(bc -e '2^64')" 0xA 0xa; do
for ig in "$(echo '2^64' | bc)" 0xA 0xa 0; do
check_guid "$ig"
done

Expand Down

0 comments on commit b2ca510

Please sign in to comment.