summaryrefslogtreecommitdiffstats
path: root/testsuite/runsuite.sh
blob: 03099b7fc76a37394fc5e44b78d164c2e065f294 (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
#!/bin/bash

FAILED=""

PASSWD_BAK="./passwd.backup"


if [ "$(id -u)" != "0" ]; then
  echo "root needed"
  exit 1
fi

cp /etc/passwd $PASSWD_BAK

for a in off on; do
  for i in ./test*.pl ; do
    if ! shadowconfig $a > /dev/null; then
      echo "shadowconfig $a failed"
      exit 1
    fi
    echo
    echo "Starting $i (shadow $a)"
    /usr/bin/perl -I. $i
    if [ "$?" != "0" ]; then
      FAILED="$FAILED $i($a)"
    fi
  done
done

if [ -z "$FAILED" ]; then
  echo "All tests passed successfully"
  rm $PASSWD_BAK
  exit 0
else
  echo "tests $FAILED failed"
  echo "see $PASSWD_BAK for a copy of /etc/passwd before starting"
  exit 1
fi