wafsamba: fix pidl dependencies to rebuild on pidl changes
[Samba.git] / ctdb / tests / cunit / conf_test_001.sh
blobd2ffa9887455872e59e18f42d0a815604aec2d3f
1 #!/bin/sh
3 . "${TEST_SCRIPTS_DIR}/unit.sh"
5 conffile="${TEST_VAR_DIR}/config.$$"
7 remove_files ()
9 rm -f "$conffile"
12 test_cleanup remove_files
14 ok_null
15 unit_test conf_test 1
17 ok <<EOF
18 conf: unknown section [section1]
19 EOF
20 unit_test conf_test 2
22 ok <<EOF
23 conf: option "key1" already exists
24 EOF
25 unit_test conf_test 3
27 ok <<EOF
28 conf: option "key1" already exists
29 EOF
30 unit_test conf_test 4
32 ok_null
33 unit_test conf_test 5
35 ok <<EOF
36 [section1]
37 key1 = foobar # temporary
38 key2 = 20 # temporary
39 key3 = false # temporary
40 EOF
41 unit_test conf_test 6
43 ok <<EOF
44 conf: validation for option "key1" failed
45 conf: validation for option "key2" failed
46 conf: validation for option "key3" failed
47 EOF
48 unit_test conf_test 7
50 cat > "$conffile" <<EOF
51 [section1]
52 EOF
54 required_result 22 <<EOF
55 conf: validation for section [section1] failed
56 [section1]
57 # key1 = default
58 EOF
59 unit_test conf_test 8 "$conffile"
61 cat > "$conffile" <<EOF
62 [section1]
63 key1 = unknown
64 EOF
66 required_result 22 <<EOF
67 conf: validation for section [section1] failed
68 [section1]
69 # key1 = default
70 EOF
71 unit_test conf_test 8 "$conffile"
73 cat > "$conffile" <<EOF
75 [section1]
76 key1 = value2
77 key2 = 20 # comment
78 key3 = false
79 EOF
81 ok <<EOF
82 [section1]
83 key1 = value2
84 key2 = 20
85 # key3 = true
86 EOF
87 unit_test conf_test 9 "$conffile"
89 cat > "$conffile" <<EOF
90 [section1]
91 key1 = value2
92 EOF
94 ok <<EOF
95 [section1]
96 key1 = value2
97 # key2 = 10
98 # key3 = true
99 EOF
100 unit_test conf_test 9 "$conffile"
102 cat > "$conffile" <<EOF
103 [section2]
104 foo = bar
107 required_result 22 <<EOF
108 conf: unknown section [section2]
109 conf: unknown section for option "foo"
110 [section1]
111 # key1 = value1
112 # key2 = 10
113 key3 = false # temporary
115 unit_test conf_test 10 "$conffile"
117 cat > "$conffile" <<EOF
118 [section1]
119 key1 = value2
120 foo = bar
121 key2 = 20
124 required_error EINVAL <<EOF
125 conf: unknown option [section1] -> "foo"
126 [section1]
127 # key1 = value1
128 # key2 = 10
129 key3 = false # temporary
131 unit_test conf_test 10 "$conffile"
133 cat > "$conffile" <<EOF
134 [section1]
135 key1 = value2
136 key2 = 20
137 key3 = false
140 touch "${conffile}.reload"
142 ok <<EOF
143 [section1]
144 # key1 = value1
145 # key2 = 10
146 # key3 = true
148 unit_test conf_test 11 "$conffile"
150 cat > "$conffile" <<EOF
151 [section1]
152 key1 = value2
153 key2 = 20
154 key3 = false
157 cat > "${conffile}.reload" <<EOF
158 [section1]
159 key1 = value3
162 ok <<EOF
163 [section1]
164 key1 = value3
165 # key2 = 10
166 # key3 = true
168 unit_test conf_test 11 "$conffile"