Skip to content

Commit

Permalink
Add testing checking copying of many small files
Browse files Browse the repository at this point in the history
Issue openzfs#7401 identified data loss when many small files
are being copied. Add a test to check for this condition.

Signed-off-by: Antonio Russo <[email protected]>
  • Loading branch information
aerusso committed Apr 8, 2018
1 parent 6c9af9e commit efd91aa
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 0 deletions.
1 change: 1 addition & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ AC_CONFIG_FILES([
tests/zfs-tests/tests/functional/cli_user/zpool_iostat/Makefile
tests/zfs-tests/tests/functional/cli_user/zpool_list/Makefile
tests/zfs-tests/tests/functional/compression/Makefile
tests/zfs-tests/tests/functional/cp_many_files/Makefile
tests/zfs-tests/tests/functional/ctime/Makefile
tests/zfs-tests/tests/functional/deadman/Makefile
tests/zfs-tests/tests/functional/delegate/Makefile
Expand Down
4 changes: 4 additions & 0 deletions tests/runfiles/linux.run
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,10 @@ tests = ['compress_001_pos', 'compress_002_pos', 'compress_003_pos',
'compress_004_pos']
tags = ['functional', 'compression']

[tests/functional/cp_many_files]
tests = ['cp_001']
tags = ['functional','cp_many_files']

[tests/functional/ctime]
tests = ['ctime_001_pos' ]
tags = ['functional', 'ctime']
Expand Down
1 change: 1 addition & 0 deletions tests/zfs-tests/tests/functional/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ SUBDIRS = \
cli_root \
cli_user \
compression \
cp_many_files \
ctime \
deadman \
delegate \
Expand Down
9 changes: 9 additions & 0 deletions tests/zfs-tests/tests/functional/cp_many_files/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/cp_many_files

dist_pkgdata_SCRIPTS = \
cleanup.ksh \
setup.ksh \
cp_001.ksh

dist_pkgdata_DATA = \
cp_many_files.cfg
5 changes: 5 additions & 0 deletions tests/zfs-tests/tests/functional/cp_many_files/cleanup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/ksh -p

source "${STF_SUITE}/include/libtest.shlib"

default_container_cleanup
24 changes: 24 additions & 0 deletions tests/zfs-tests/tests/functional/cp_many_files/cp_001.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/ksh -p

source "${STF_SUITE}/include/libtest.shlib"
source "${STF_SUITE}/tests/functional/cp_many_files/cp_many_files.cfg"

log_assert "Check that copying many small files is safe"

log_must mkdir $TESTDIR/SRC

for i in $(seq 1 ${CP_FILE_COUNT}) ; do
echo $i > $TESTDIR/SRC
done

log_note "Ensure we produced the correct number of files"
log_must [[ $(find SRC -type f|wc -l) -eq ${CP_FILE_COUNT} ]]

log_note "Ensure we copy the files"
log_must cp -r $TESTDIR/SRC $TESTDIR/DST

if [[ $(find DST -type f|wc -l) -eq ${CP_FILE_COUNT} ]] ; then
log_pass "Copied all ${CP_FILE_COUNT} files"
else
log_fail "$(find SRC -type f|wc -l) is not ${CP_FILE_COUNT}"
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export CP_FILE_COUNT=300000
5 changes: 5 additions & 0 deletions tests/zfs-tests/tests/functional/cp_many_files/setup.ksh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/ksh -p

source "${STF_SUITE}/include/libtest.shlib"

default_container_setup ${DISKS%% *}

0 comments on commit efd91aa

Please sign in to comment.