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
50
51
52
53
54
55
56
57
58
59
60
|
test_description='Check the configuration documents'
. ./setup.sh
ROOT="$TEST_OUTPUT_DIRECTORY/.."
test_expect_success 'extract the key lists' '
sed -n "/^Global settings$/,/^Repository-specific cgitrc file$/p" "$ROOT/MANUAL.txt" |
sed -n "s/^\([a-z][a-zA-Z0-9.<>-]*\)::$/\1/p" |
sort >manual-keys &&
sed -n "s/^#\{0,1\}\([a-z][a-zA-Z0-9.<>-]*\)=.*/\1/p" "$ROOT/custom/cgitrc" |
sed -e "s/^mimetype\..*/mimetype.<ext>/" |
sort -u >example-keys &&
sed -n "s/^#\{0,1\}\(repo\.module-link\)\..*=.*/\1.<path>/p" "$ROOT/custom/cgitrc" >>example-keys &&
sort -o example-keys example-keys &&
test -s manual-keys && test -s example-keys
'
test_expect_success 'the reference config sets every documented key' '
comm -23 manual-keys example-keys >missing &&
test_must_be_empty missing
'
test_expect_success 'every key the reference config sets is documented' '
comm -13 manual-keys example-keys >undocumented &&
test_must_be_empty undocumented
'
test_expect_success 'the manual lists its global settings in order' '
sed -n "/^Global settings$/,/^Repository settings$/p" "$ROOT/MANUAL.txt" |
sed -n "s/^\([a-z][a-zA-Z0-9.<>-]*\)::$/\1/p" >global-order &&
LC_ALL=C sort -c global-order
'
test_expect_success 'the manual lists its repository settings in order' '
sed -n "/^Repository settings$/,/^Repository-specific cgitrc file$/p" "$ROOT/MANUAL.txt" |
sed -n "s/^\(repo\.[a-zA-Z0-9.<>-]*\)::$/\1/p" >repo-order &&
LC_ALL=C sort -c repo-order
'
test_expect_success 'the server configs agree on one content security policy' '
for server in apache lighttpd nginx; do
grep "Content-Security-Policy" "$ROOT/custom/servers/$server.conf" |
grep "default-src" |
sed "s/.*\"\(default-src[^\"]*\)\".*/\1/" || return 1
done >policies &&
test_line_count = 3 policies &&
test $(sort -u policies | wc -l) -eq 1
'
test_done
|