summaryrefslogtreecommitdiff
path: root/regress/sys/ffs/run
blob: 1e3d458bb0b10ed1c1deb2ddf297067a42666095 (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
61
62
63
#!/bin/sh
# $OpenBSD: run,v 1.4 2017/01/12 01:04:50 bluhm 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}... "
  r=`${FSTEST} $* | tail -1`
  echo "${r}" | egrep -q '^'${e}'$'
  if [ $? -eq 0 ]; then
    echo "okay."
  else
    nfail=`expr $nfail + 1`
    echo "failed:"
    echo " test\t$*"
    echo " expect\t$e"
    echo " result\t$r"
  fi
  ntest=`expr $ntest + 1`
}

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

# Generate a random file/directory name.
namegen()
{
  echo "fstest_`dd if=/dev/urandom bs=1k count=1 status=none | 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."