freebsd-dev/tools/regression/fstest/tests/misc.sh
Pawel Jakub Dawidek 092513dad4 Be more Solaris-friendly.
Submitted by:	Milan Cermak <Milan.Cermak@Sun.COM>
2009-01-16 18:09:49 +00:00

137 lines
2.4 KiB
Bash

# $FreeBSD$
ntest=1
name253="_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789_12"
name255="${name253}34"
name256="${name255}5"
path1021="${name255}/${name255}/${name255}/${name253}"
path1023="${path1021}/x"
path1024="${path1023}x"
echo ${dir} | egrep '^/' >/dev/null 2>&1
if [ $? -eq 0 ]; then
maindir="${dir}/../.."
else
maindir="`pwd`/${dir}/../.."
fi
fstest="${maindir}/fstest"
. ${maindir}/tests/conf
expect()
{
e="${1}"
shift
r=`${fstest} $* 2>/dev/null | tail -1`
echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1
if [ $? -eq 0 ]; then
if [ -z "${todomsg}" ]; then
echo "ok ${ntest}"
else
echo "ok ${ntest} # TODO ${todomsg}"
fi
else
if [ -z "${todomsg}" ]; then
echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}"
else
echo "not ok ${ntest} # TODO ${todomsg}"
fi
fi
todomsg=""
ntest=`expr $ntest + 1`
}
jexpect()
{
s="${1}"
d="${2}"
e="${3}"
shift 3
r=`jail -s ${s} / fstest 127.0.0.1 /bin/sh -c "cd ${d} && ${fstest} $* 2>/dev/null" | tail -1`
echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1
if [ $? -eq 0 ]; then
if [ -z "${todomsg}" ]; then
echo "ok ${ntest}"
else
echo "ok ${ntest} # TODO ${todomsg}"
fi
else
if [ -z "${todomsg}" ]; then
echo "not ok ${ntest} - tried '$*', expected ${e}, got ${r}"
else
echo "not ok ${ntest} # TODO ${todomsg}"
fi
fi
todomsg=""
ntest=`expr $ntest + 1`
}
test_check()
{
if [ $* ]; then
if [ -z "${todomsg}" ]; then
echo "ok ${ntest}"
else
echo "ok ${ntest} # TODO ${todomsg}"
fi
else
if [ -z "${todomsg}" ]; then
echo "not ok ${ntest}"
else
echo "not ok ${ntest} # TODO ${todomsg}"
fi
fi
todomsg=""
ntest=`expr $ntest + 1`
}
todo()
{
echo "${os}" | $GREP -iq "${1}"
if [ $? -eq 0 ]; then
todomsg="${2}"
fi
}
namegen()
{
echo "fstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5`"
}
quick_exit()
{
echo "1..1"
echo "ok 1"
exit 0
}
supported()
{
case "${1}" in
lchmod)
if [ "${os}" != "FreeBSD" ]; then
return 1
fi
;;
chflags)
if [ "${os}" != "FreeBSD" ]; then
return 1
fi
;;
chflags_SF_SNAPSHOT)
if [ "${os}" != "FreeBSD" -o "${fs}" != "UFS" ]; then
return 1
fi
;;
esac
return 0
}
require()
{
if supported ${1}; then
return
fi
quick_exit
}