ZTS: Fix zpool_reguid Makefile.am and tests

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 <milky-zfs@mcmilk.de>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #16559
This commit is contained in:
Brian Behlendorf 2024-09-25 07:50:04 -07:00 committed by GitHub
parent 05a7a9594e
commit b2ca5105b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 9 deletions

View File

@ -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 \

View File

@ -1,6 +0,0 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cli_root/zpool_reguid
dist_pkgdata_SCRIPTS = \
setup.ksh \
cleanup.ksh \
zpool_reguid_001_pos.ksh \
zpool_reguid_002_neg.ksh

View File

@ -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."

View File

@ -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