1#!/bin/ksh -p 2 3source "${STF_SUITE}/include/libtest.shlib" 4source "${STF_SUITE}/tests/functional/mv_files/mv_files.cfg" 5 6# This will test the #7401 regression. 7log_assert "Check that creating many files quickly is safe" 8 9DIR="${TESTDIR}/RANDOM_SMALL" 10 11log_must mkdir "${DIR}" 12 13count=0 14for i in $(range_shuffle 1 "${RC_PASS1}") ; do 15 if ! touch "${DIR}/${i}" ; then 16 log_fail "error creating ${i} after ${count} files" 17 fi 18 count=$((count+1)) 19done 20 21visible="$(find "${DIR}" -type f|wc -l)" 22 23log_must [ "${visible}" -eq "${RC_PASS1}" ] 24 25log_assert "Check that creating them in another order is safe" 26 27DIR1="${TESTDIR}/RANDOM2" 28 29log_must mv "${DIR}" "${DIR1}" 30 31log_must mkdir "${DIR}" 32 33count=0 34for i in $(cd "${DIR1}" ; ls -U . ) ; do 35 if ! touch "${DIR}/${i}" ; then 36 log_fail "error creating ${i} after ${count} files" 37 fi 38 count=$((count+1)) 39 [ "${count}" -eq "${RC_PASS2}" ] && break 40done 41 42visible="$(find "${DIR}" -type f|wc -l)" 43 44if [ "${visible}" -eq "${RC_PASS2}" ] ; then 45 log_pass "Created all ${RC_PASS2} files" 46else 47 log_fail "Number of created files ${visible} is not ${RC_PASS2}" 48fi 49