heimdal_build: Improve error and warning handling on old and new compilers
[samba.git] / source4 / setup / tests / blackbox_supported_features.sh
1 #!/bin/sh
2
3 if [ $# -lt 1 ]; then
4 cat <<EOF
5 Usage: blackbox_supported_features.sh PREFIX
6 EOF
7 exit 1;
8 fi
9
10 PREFIX="$1"
11 shift 1
12
13 DBPATH=$PREFIX/supported-features
14
15 mkdir -p $DBPATH
16
17 . `dirname $0`/../../../testprogs/blackbox/subunit.sh
18
19 ldbmodify="ldbmodify"
20 if [ -x "$BINDIR/ldbmodify" ]; then
21     ldbmodify="$BINDIR/ldbmodify"
22 fi
23
24 ldbdel="ldbdel"
25 if [ -x "$BINDIR/ldbdel" ]; then
26     ldbdel="$BINDIR/ldbdel"
27 fi
28
29 ldbsearch="ldbsearch"
30 if [ -x "$BINDIR/ldbsearch" ]; then
31     ldbsearch="$BINDIR/ldbsearch"
32 fi
33
34 testit "provision" $PYTHON $BINDIR/samba-tool domain provision \
35        --domain=FOO --realm=foo.example.com \
36        --targetdir=$DBPATH --use-ntvfs
37
38 testit "add-compatible-feature" $ldbmodify \
39        -H tdb://$DBPATH/private/sam.ldb <<EOF
40 dn: @SAMBA_DSDB
41 changetype: modify
42 add: compatibleFeatures
43 compatibleFeatures: non-existent-feature
44 -
45
46 EOF
47
48 # The non-existent feature is not compatible with this version, so it
49 # should not be listed in compatibleFeatures even though we tried to
50 # put it there.
51
52 ldb_search_fail() {
53     $ldbsearch -H tdb://$DBPATH/private/sam.ldb \
54                -s base -b "$1" "$2" \
55         |   grep -q "$3"
56 }
57
58
59 testit_expect_failure "find-compatible-feature" \
60                       ldb_search_fail '@SAMBA_DSDB' 'compatibleFeatures' non-existent-feature
61
62
63 # just make sure the thing we're using is normally findable
64 testit "find-test-feature" \
65        $ldbsearch -H tdb://$DBPATH/private/sam.ldb \
66        -b 'CN=LostAndFound,DC=foo,DC=example,DC=com'
67
68
69 testit "add-required-feature" $ldbmodify \
70        -H tdb://$DBPATH/private/sam.ldb <<EOF
71 dn: @SAMBA_DSDB
72 changetype: modify
73 add: requiredFeatures
74 requiredFeatures: futuristic-feature
75 -
76
77 EOF
78
79 # The futuristic-feature is not implemented in this version, but it is
80 # required by this database. A search for anything should fail.
81
82 testit_expect_failure "find-required-feature" \
83                       $ldbsearch -H tdb://$DBPATH/private/sam.ldb \
84                       -b 'CN=LostAndFound,DC=foo,DC=example,DC=com'
85
86 rm -rf $DBPATH
87
88 exit $failed