10 maindir="`pwd`/${dir}/../.."
13 fstest="${maindir}/pjdfstest"
14 . ${maindir}/tests/conf
20 r=`${fstest} $* 2>/dev/null | tail -1`
21 echo "${r}" | ${GREP} -Eq '^'${e}'$'
23 if [ -z "${todomsg}" ]; then
26 echo "ok ${ntest} # TODO ${todomsg}"
29 if [ -z "${todomsg}" ]; then
30 echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}"
32 echo "not ok ${ntest} # TODO ${todomsg}"
45 r=`jail -s ${s} / pjdfstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1`
46 echo "${r}" | ${GREP} -Eq '^'${e}'$'
48 if [ -z "${todomsg}" ]; then
51 echo "ok ${ntest} # TODO ${todomsg}"
54 if [ -z "${todomsg}" ]; then
55 echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}"
57 echo "not ok ${ntest} # TODO ${todomsg}"
67 if [ -z "${todomsg}" ]; then
70 echo "ok ${ntest} # TODO ${todomsg}"
73 if [ -z "${todomsg}" ]; then
74 echo "not ok ${ntest}"
76 echo "not ok ${ntest} # TODO ${todomsg}"
85 if [ "${os}" = "${1}" -o "${os}:${fs}" = "${1}" ]; then
92 echo "pjdfstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5 | awk '{print $NF}'`"
101 namepart="`dd if=/dev/urandom bs=64 count=1 2>/dev/null | openssl md5 | awk '{print $NF}'`"
102 name="${name}${namepart}"
103 curlen=`printf "%s" "${name}" | wc -c`
104 [ ${curlen} -lt ${len} ] || break
106 name=`echo "${name}" | cut -b -${len}`
107 printf "%s" "${name}"
112 # Maximum number of bytes in a filename (not including terminating null).
115 name_max=`${fstest} pathconf . _PC_NAME_MAX`
116 namegen_len ${name_max}
121 # Maximum number of bytes in a pathname, including the terminating null character.
124 name_max=`${fstest} pathconf . _PC_NAME_MAX`
125 complen=$((name_max/2))
126 path_max=`${fstest} pathconf . _PC_PATH_MAX`
127 # "...including the terminating null character."
128 path_max=$((path_max-1))
132 name="${name}`namegen_len ${complen}`/"
133 curlen=`printf "%s" "${name}" | wc -c`
134 [ ${curlen} -lt ${path_max} ] || break
136 name=`echo "${name}" | cut -b -${path_max}`
137 name=`echo "${name}" | sed -E 's@/$@x@'`
138 printf "%s" "${name}"
152 if [ "${os}" != "FreeBSD" ]; then
157 if [ "${os}" != "FreeBSD" ]; then
162 if [ "${os}" != "FreeBSD" -o "${fs}" != "UFS" ]; then
172 if supported ${1}; then
179 # create_file <type> <name>
180 # create_file <type> <name> <mode>
181 # create_file <type> <name> <uid> <gid>
182 # create_file <type> <name> <mode> <uid> <gid>
192 expect 0 create ${name} 0644
195 expect 0 mkdir ${name} 0755
198 expect 0 mkfifo ${name} 0644
201 expect 0 mknod ${name} b 0644 1 2
204 expect 0 mknod ${name} c 0644 1 2
207 expect 0 bind ${name}
210 expect 0 symlink test ${name}
213 if [ -n "${3}" -a -n "${4}" -a -n "${5}" ]; then
214 expect 0 lchmod ${name} ${3}
215 expect 0 lchown ${name} ${4} ${5}
216 elif [ -n "${3}" -a -n "${4}" ]; then
217 expect 0 lchown ${name} ${3} ${4}
218 elif [ -n "${3}" ]; then
219 expect 0 lchmod ${name} ${3}