aboutsummaryrefslogtreecommitdiffstats
path: root/tests/smb.sh
blob: 450235420692691217010ed3ebc05696dc1bc9f1 (plain) (blame)
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
#!/bin/sh

srcdir=${1-..}
: echo smb.sh using ${srcdir} from `pwd`

testdir=${srcdir}/tests

exitcode=0
passedfile=tests/.passed
failedfile=tests/.failed
passed=`cat ${passedfile}`
failed=`cat ${failedfile}`

# Only attempt OpenSSL-specific tests when compiled with the library.

if grep '^#define ENABLE_SMB 1$' config.h >/dev/null
then
    cat ${srcdir}/tests/SMBLIST | while read name input output options
    do
        case $name in
            \#*) continue;;
            '') continue;;
        esac
        rm -f core
        [ "$only" != "" -a "$name" != "$only" ] && continue
        SRCDIR=${srcdir}
        export SRCDIR
        # I hate shells with their stupid, useless subshells.
        passed=`cat ${passedfile}`
        failed=`cat ${failedfile}`
        (cd tests  # run TESTonce in tests directory
         if ${srcdir}/tests/TESTonce $name ${srcdir}/tests/$input ${srcdir}/tests/$output "$options"
         then
             passed=`expr $passed + 1`
             echo $passed >${passedfile}
         else
             failed=`expr $failed + 1`
             echo $failed >${failedfile}
         fi
         if [ -d COREFILES ]; then
             if [ -f core ]; then mv core COREFILES/$name.core; fi
         fi)
    done
    # I hate shells with their stupid, useless subshells.
    passed=`cat ${passedfile}`
    failed=`cat ${failedfile}`
fi

exit $exitcode