Skip to content

Commit

Permalink
WIP: initial testing
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Lee <jasonlee@lanl.gov>
  • Loading branch information
calccrypto committed Jul 7, 2023
1 parent 4b7feed commit 102c60f
Show file tree
Hide file tree
Showing 10 changed files with 414 additions and 2 deletions.
4 changes: 4 additions & 0 deletions tests/runfiles/linux.run
Original file line number Diff line number Diff line change
Expand Up @@ -208,3 +208,7 @@ tags = ['functional', 'zvol', 'zvol_misc']
tests = ['idmap_mount_001', 'idmap_mount_002', 'idmap_mount_003',
'idmap_mount_004', 'idmap_mount_005']
tags = ['functional', 'idmap_mount']

[tests/functional/zia:Linux]
tests = ['zia_props', 'zia_write_pipeline', 'zia_resilver']
tags = ['functional', 'zia']
4 changes: 3 additions & 1 deletion tests/zfs-tests/include/commands.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export SYSTEM_FILES_LINUX='attr
groupdel
groupmod
hostid
insmod
losetup
lsattr
lsblk
Expand All @@ -159,7 +160,8 @@ export SYSTEM_FILES_LINUX='attr
setpriv
mountpoint
flock
logger'
logger
rmmod'

export ZFS_FILES='zdb
zfs
Expand Down
7 changes: 6 additions & 1 deletion tests/zfs-tests/tests/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2049,4 +2049,9 @@ nobase_dist_datadir_zfs_tests_tests_SCRIPTS += \
functional/idmap_mount/idmap_mount_002.ksh \
functional/idmap_mount/idmap_mount_003.ksh \
functional/idmap_mount/idmap_mount_004.ksh \
functional/idmap_mount/idmap_mount_005.ksh
functional/idmap_mount/idmap_mount_005.ksh \
functional/zia/cleanup.ksh \
functional/zia/setup.ksh \
functional/zia/zia_props.ksh \
functional/zia/zia_write_pipeline.ksh \
functional/zia/zia_resilver.ksh
31 changes: 31 additions & 0 deletions tests/zfs-tests/tests/functional/zia/cleanup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
#

. $STF_SUITE/include/libtest.shlib

verify_runnable "global"

default_cleanup
41 changes: 41 additions & 0 deletions tests/zfs-tests/tests/functional/zia/setup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.cfg
verify_runnable "global"

# dpusm needs to be loaded before ZFS
lsmod | grep dpusm > /dev/null
ret="$?"
(( "${ret}" != "0" )) && log_fail "dpusm not loaded"

# unload the software provider if the test starts with it loaded
lsmod | grep "${PROVIDER_MODULE}" > /dev/null
ret="$?"
(( "${ret}" == "0" )) && log_must rmmod "${PROVIDER_MODULE}"

log_pass
43 changes: 43 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#

#
# Copyright (c) 2013 by Delphix. All rights reserved.
#

export PROVIDER_MODULE="zia_software_provider"
export PROVIDER="zia-software-provider"
export BLOCKSZ=8192
export NUM_WRITES=65536
export DATA="R"
export FILENAME="${TESTDIR}/${TESTFILE0}"

export RESILVER_VDEV1="${TEST_BASE_DIR}/file1"
export RESILVER_VDEV2="${TEST_BASE_DIR}/file2"
export RESILVER_VDEV3="${TEST_BASE_DIR}/file3"
export RESILVER_VDEVS="${TEST_BASE_DIR}/file1 ${TEST_BASE_DIR}/file2 ${TEST_BASE_DIR}/file3"

export RESILVER_REPLACEMENT="${TEST_BASE_DIR}/replacement"
101 changes: 101 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia.kshlib
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.cfg

# providers can be loaded at any time after the dpusm
#
# the software provider must be loaded after ZFS since
# it uses ZFS symbols
function load_provider
{
log_must insmod "${SBIN_DIR}/module/${PROVIDER}.ko"
log_must zpool set zia_provider="${PROVIDER}" "${TESTPOOL}"
}

function unload_provider
{
log_must zpool set zia_provider="" "${TESTPOOL}"
log_must rmmod "${PROVIDER_MODULE}"
}

function default_zpool
{
default_raidz_setup_noexit "${DISKS}"
log_must zfs set compression=on "${TESTPOOL}"
log_must zfs set checksum=on "${TESTPOOL}"
}

function offload_all
{
log_must zpool set zia_compress="on" "${TESTPOOL}"
log_must zpool set zia_checksum="on" "${TESTPOOL}"
log_must zpool set zia_raidz1_gen="on" "${TESTPOOL}"
log_must zpool set zia_raidz2_gen="on" "${TESTPOOL}"
log_must zpool set zia_raidz3_gen="on" "${TESTPOOL}"
log_must zpool set zia_raidz1_rec="on" "${TESTPOOL}"
log_must zpool set zia_raidz2_rec="on" "${TESTPOOL}"
log_must zpool set zia_raidz3_rec="on" "${TESTPOOL}"
log_must zpool set zia_disk_write="on" "${TESTPOOL}"
log_must zpool set zia_file_write="on" "${TESTPOOL}"
}

#
# loop through each combination of Z.I.A. offloads
# and make sure writing works
#
function loop_offloads_and_write
{
for comp in on off
do
log_must zpool set zia_compress="${comp}" "${TESTPOOL}"

for cksum in on off
do
log_must zpool set zia_checksum="${cksum}" "${TESTPOOL}"

for raidz in on off
do
log_must zpool set zia_raidz1_gen="${raidz}" "${TESTPOOL}"
log_must zpool set zia_raidz2_gen="${raidz}" "${TESTPOOL}"
log_must zpool set zia_raidz3_gen="${raidz}" "${TESTPOOL}"

for diskfile in on off
do
log_must zpool set zia_disk_write="${diskfile}" "${TESTPOOL}"
log_must zpool set zia_file_write="${diskfile}" "${TESTPOOL}"

log_must file_write -o create -f "${FILENAME}" -b "${BLOCKSZ}" -c "${NUM_WRITES}" -d "${DATA}"
log_must ls -l "${FILENAME}"
log_must verify_pool "${TESTPOOL}"
log_must check_pool_status "${TESTPOOL}" "errors" "No known data errors"
log_must rm "${FILENAME}"
done
done
done
done
}
58 changes: 58 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia_props.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zia/zia.kshlib

#
# DESCRIPTION:
# Z.I.A. zpool settings work
#
# STRATEGY:
# 1. Load the example software provider and enable it for the zpool
# 2. Turn on all offloads
# 3. Run zpool get on each property
#

load_provider

default_zpool
offload_all

log_must zpool get zia_provider "${TESTPOOL}"
log_must zpool get zia_compress "${TESTPOOL}"
log_must zpool get zia_checksum "${TESTPOOL}"
log_must zpool get zia_raidz1_gen "${TESTPOOL}"
log_must zpool get zia_raidz2_gen "${TESTPOOL}"
log_must zpool get zia_raidz3_gen "${TESTPOOL}"
log_must zpool get zia_raidz1_rec "${TESTPOOL}"
log_must zpool get zia_raidz2_rec "${TESTPOOL}"
log_must zpool get zia_raidz3_rec "${TESTPOOL}"
log_must zpool get zia_disk_write "${TESTPOOL}"
log_must zpool get zia_file_write "${TESTPOOL}"

unload_provider
log_pass
79 changes: 79 additions & 0 deletions tests/zfs-tests/tests/functional/zia/zia_resilver.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/ksh -p
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or https://opensource.org/licenses/CDDL-1.0.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#

#
# Copyright (c) 2021 by Lawrence Livermore National Security, LLC.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/redundancy/redundancy.kshlib
. $STF_SUITE/tests/functional/zia/zia.kshlib

#
# DESCRIPTION:
# Z.I.A. Resilver works
#
# STRATEGY:
# 1. Load the example software provider and enable it for the zpool
# 2. Turn on all offloads
# 3. Write data to the zpool
# 4. Replace some drives
# 5. Resilver the zpool with Z.I.A.
#

for backing in ${RESILVER_VDEVS[@]} ${RESILVER_REPLACEMENT}
do
log_must truncate -s 4G "${backing}"
done

function cleanup
{
log_must rm ${RESILVER_VDEVS[@]} ${RESILVER_REPLACEMENT}
}
log_onexit cleanup

# create zpool with files instead of (loopback) devices
[[ -d "/${TESTPOOL}" ]] && rm -rf "/${TESTPOOL}"
log_must zpool create -f "${TESTPOOL}" raidz ${RESILVER_VDEVS[@]}
log_must zfs create "${TESTPOOL}/${TESTFS}"
log_must zfs set mountpoint="${TESTDIR}" "${TESTPOOL}/${TESTFS}"

# set up Z.I.A.
load_provider
offload_all

# write a file
log_must file_write -o create -f "${FILENAME}" -b "${BLOCKSZ}" -c "${NUM_WRITES}" -d "${DATA}"
log_must ls -l "${FILENAME}"

# pick a random backing file to offline and replace it
nameref offline="RESILVER_VDEV$(random 1 3)"
log_must zpool offline "${TESTPOOL}" "${offline}"
log_must zpool replace "${TESTPOOL}" "${offline}" "${RESILVER_REPLACEMENT}"

log_must wait_replacing "${TESTPOOL}"
log_must wait_scrubbed "${TESTPOOL}"

log_must verify_pool "${TESTPOOL}"
log_must check_pool_status "${TESTPOOL}" "errors" "No known data errors"

log_pass
Loading

0 comments on commit 102c60f

Please sign in to comment.