Debian Codegraph @

tests/scripts/all

raw
1 #! /bin/sh
2 # $OpenLDAP$
3 ## This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 ##
5 ## Copyright 1998-2024 The OpenLDAP Foundation.
6 ## All rights reserved.
7 ##
8 ## Redistribution and use in source and binary forms, with or without
9 ## modification, are permitted only as authorized by the OpenLDAP
10 ## Public License.
11 ##
12 ## A copy of this license is available in the file LICENSE in the
13 ## top-level directory of the distribution or, alternatively, at
14 ## <http://www.OpenLDAP.org/license.html>.
15
16 . $SRCDIR/scripts/defines.sh
17
18 TB="" TN=""
19 if test -t 1 ; then
20 TB=`$SHTOOL echo -e "%B" 2>/dev/null`
21 TN=`$SHTOOL echo -e "%b" 2>/dev/null`
22 fi
23
24 FAILCOUNT=0
25 SKIPCOUNT=0
26 SLEEPTIME=10
27
28 # check for BSD vs GNU date
29 date -j >/dev/null 2>&1
30 RC=$?
31 if [ $RC -ne 0 ]; then
32 DATEOPT="-d @"
33 else
34 DATEOPT="-r "
35 fi
36
37 echo ">>>>> $(timer) Executing all LDAP tests for $BACKEND"
38
39 if [ -n "$NOEXIT" ]; then
40 echo "Result Test" > $TESTWD/results
41 fi
42
43 for CMD in $SRCDIR/scripts/test*; do
44 case "$CMD" in
45 *~) continue;;
46 *.bak) continue;;
47 *.orig) continue;;
48 *.sav) continue;;
49 *.py) continue;;
50 *) test -f "$CMD" || continue;;
51 esac
52
53 # remove cruft from prior test
54 if test $PRESERVE = yes ; then
55 /bin/rm -rf $TESTDIR/db.*
56 else
57 /bin/rm -rf $TESTDIR
58 fi
59
60 BCMD=`basename $CMD`
61 if [ -x "$CMD" ]; then
62 MSG=">>>>> $(timer) Starting ${TB}$BCMD${TN} for $BACKEND..."
63 [ -n "$TESTINST" ] && echo "$MSG" >&2
64 echo "$MSG"
65 START=`date +%s`
66 if [ -n "$TESTINST" ]; then
67 $CMD 2>&1
68 else
69 $CMD
70 fi
71 RC=$?
72 END=`date +%s`
73
74 if test $RC -eq 0 ; then
75 MSG=">>>>> $(timer) Finished $BCMD for $BACKEND after $(( $END - $START )) seconds."
76 [ -n "$TESTINST" ] && echo "$MSG" >&2
77 echo "$MSG"
78 else
79 MSG=">>>>> $(timer) Failed $BCMD for $BACKEND after $(( $END - $START )) seconds"
80 [ -n "$TESTINST" ] && echo "$MSG" >&2
81 echo "$MSG"
82 FAILCOUNT=`expr $FAILCOUNT + 1`
83
84 if [ -n "$NOEXIT" ]; then
85 echo "Continuing."
86 else
87 echo "(exit $RC)"
88 exit $RC
89 fi
90 fi
91 else
92 MSG=">>>>> $(timer) Skipping ${TB}$BCMD${TN} for $BACKEND."
93 [ -n "$TESTINST" ] && echo "$MSG" >&2
94 echo "$MSG"
95 SKIPCOUNT=`expr $SKIPCOUNT + 1`
96 RC="-"
97 fi
98
99 if [ -n "$NOEXIT" ]; then
100 echo "$RC $BCMD" >> $TESTWD/results
101 fi
102
103 # echo ">>>>> waiting $SLEEPTIME seconds for things to exit"
104 # sleep $SLEEPTIME
105 echo ""
106 done
107
108 if [ -n "$NOEXIT" ]; then
109 if [ "$FAILCOUNT" -gt 0 ]; then
110 cat $TESTWD/results
111 echo "$FAILCOUNT tests for $BACKEND ${TB}failed${TN}. Please review the test log."
112 else
113 echo "All executed tests for $BACKEND ${TB}succeeded${TN}."
114 fi
115 fi
116
117 echo "$SKIPCOUNT tests for $BACKEND were ${TB}skipped${TN}."