summaryrefslogtreecommitdiff
path: root/regress/sys/ffs/run
blob: 9a1cc244d3b98c2bc247a74784259dcd925d499a (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
64
#!/bin/sh
# $OpenBSD: run,v 1.6 2022/04/28 22:11:59 jca 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=$((nfail + 1))
    echo "failed:"
    echo " test\t$*"
    echo " expect\t$e"
    echo " result\t$r"
  fi
  ntest=$((ntest + 1))
}

test_check()
{
  echo -n "Running test #${ntest}... "
  if [ $* ]; then
    echo "okay."
  else
    nfail=$((nfail + 1))
    echo "failed:"
    echo " test\t$*"
  fi
  ntest=$((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:
  sed -n 's/^desc=//p' $arg
  . $arg
  totntest=$((totntest + ntest))
  totnfail=$((totnfail + nfail))
done

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