summaryrefslogtreecommitdiff
path: root/regress/sys/ffs/run
blob: a1a967a5306f7a7481362c22bf2e828a3db3f3f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/sh
# $OpenBSD: run,v 1.1 2007/03/30 19:02:51 pedro Exp $
# Heavily inspired on FreeBSD's misc.sh.

totntest=0
totnfail=0

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"

# Run a single test, calling fstest to do the job.
expect()
{
  e="${1}"
  shift
  echo -n "Running test #${ntest}... "
#  echo ${FSTEST} $*
  r=`${FSTEST} $* 2>/dev/null | tail -1`
  echo "${r}" | egrep '^'${e}'$' >/dev/null 2>&1
  if [ $? -eq 0 ]; then
    echo "okay."
  else
    nfail=`expr $nfail + 1`
    echo "failed."
  fi
  ntest=`expr $ntest + 1`
}

test_check()
{
  echo -n "Running test #${ntest}... "
  if [ $* ]; then
    echo "okay."
  else
    nfail=`expr $nfail + 1`
    echo "failed."
  fi
  ntest=`expr $ntest + 1`
}

# Generate a random file/directory name.
namegen()
{
  echo "fstest_`dd if=/dev/urandom bs=1k count=1 2>/dev/null | openssl md5`"
}

for arg in $*; do
  ntest=0
  nfail=0
  echo $arg:
  . $arg
  totntest=`expr $totntest + $ntest`
  totnfail=`expr $totnfail + $nfail`
done

echo "${totntest} tests completed, ${totnfail} failed."