blob: bd54babdcde3de2e8707cf3a3ad1d0fb061ec9d0 (
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
#!/usr/bin/env bash
set -euo pipefail
root_dir=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
source "$root_dir/scripts/fossil-env.sh"
test_dir=$(mktemp -d -t copland-smoke.XXXXXX)
port=${COPLAND_TEST_PORT:-18081}
server_pid=""
finish() {
if [[ -n "$server_pid" ]]; then
kill "$server_pid" 2>/dev/null || true
wait "$server_pid" 2>/dev/null || true
fi
}
trap finish EXIT INT TERM
require_org_fossil
"$root_dir/scripts/create-demo.sh" "$test_dir"
verify_org_mime "$test_dir/repositories/alpha.fossil"
"$FOSSIL" sql -R "$test_dir/repositories/alpha.fossil" \
"REPLACE INTO config(name,value,mtime) VALUES('doc-glob','*.org',unixepoch());"
"$FOSSIL" fts-config enable document -R "$test_dir/repositories/alpha.fossil" >/dev/null
"$FOSSIL" fts-config enable wiki -R "$test_dir/repositories/alpha.fossil" >/dev/null
"$FOSSIL" fts-config index on -R "$test_dir/repositories/alpha.fossil" >/dev/null
"$FOSSIL" fts-config reindex -R "$test_dir/repositories/alpha.fossil" >/dev/null
FOSSIL_REPOLIST_TITLE=Copland "$FOSSIL" server \
--localhost \
--localauth \
--port "$port" \
--repolist \
"$test_dir/repositories" >"$test_dir/server.log" 2>&1 &
server_pid=$!
base_url="http://127.0.0.1:$port"
for attempt in $(seq 1 50); do
if curl --fail --location --silent "$base_url/" >/dev/null; then
break
fi
if [[ "$attempt" -eq 50 ]]; then
printf 'Fossil server did not start.\n' >&2
sed -n '1,120p' "$test_dir/server.log" >&2
exit 1
fi
sleep 0.1
done
paths=(
"/"
"/alpha/home"
"/alpha/timeline"
"/alpha/tree?ci=tip"
"/alpha/dir?ci=tip"
"/alpha/brlist"
"/alpha/taglist"
"/alpha/wiki"
"/alpha/wiki?name=Org%20Wiki"
"/alpha/wikiedit?name=New%20Org%20Page"
"/alpha/whistory?name=Org%20Wiki"
"/alpha/reportlist"
"/alpha/forum"
"/alpha/login"
"/alpha/sitemap"
"/alpha/doc/tip/docs/org-support.org"
"/alpha/file?name=docs/org-support.org&ci=tip"
"/alpha/file?name=docs/org-support.org&ci=tip&txt=1"
"/alpha/search?s=Native%20Org%20preview&y=d"
"/alpha/search?s=deployment%20guide&y=w"
)
for path in "${paths[@]}"; do
body=$(curl --fail --location --silent --show-error "$base_url$path")
if [[ "$body" != *"Copland"* ]]; then
printf 'Copland marker missing from %s\n' "$path" >&2
exit 1
fi
if [[ "$body" == *"thmainError"* ]]; then
printf 'TH1 template error on %s\n' "$path" >&2
exit 1
fi
if [[ "$path" == "/" && ("$body" != *"Alpha"* || "$body" != *"Beta"*) ]]; then
printf 'Demo repositories missing from repository list\n' >&2
exit 1
fi
if [[ "$path" == "/alpha/home" ]]; then
mainmenu=${body#*'<nav class="container mainmenu"'}
mainmenu=${mainmenu%%'</nav>'*}
for hidden_route in chat taglist forum reportlist sitemap ticket tkt; do
if [[ "$mainmenu" == *"/$hidden_route"* ]]; then
printf 'Hidden route /%s is still present in the main menu\n' "$hidden_route" >&2
exit 1
fi
done
fi
if [[ "$path" == "/alpha/wiki" ]]; then
if [[ "$body" != *"Available Wiki Pages"* || "$body" != *"Org Wiki"* ]]; then
printf 'Wiki landing page did not list available pages\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/tree?ci=tip" ]]; then
if [[ "$body" != *'class="org-document"'* || "$body" != *"A small repository"* ]]; then
printf 'README.org was not rendered below the repository tree\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/doc/tip/docs/org-support.org" ]]; then
if [[ "$body" != *'<title>Alpha: Native Org preview</title>'*
|| "$body" != *'class="org-toc"'*
|| "$body" != *'href="../README.org"'*
|| "$body" != *'id="overview"'* ]]; then
printf 'Native Org /doc rendering is incomplete\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/wiki?name=Org%20Wiki" ]]; then
if [[ "$body" != *'<title>Alpha: Org Wiki</title>'*
|| "$body" != *'class="org-document"'*
|| "$body" == *'class="org-title"'*
|| "$body" != *'href="wiki?name=Deployment+Guide"'*
|| "$body" != *'href="doc/tip/docs/org-support.org"'* ]]; then
printf 'Native Org wiki rendering is incomplete\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/wikiedit?name=New%20Org%20Page" ]]; then
if [[ "$body" != *'value="text/x-org" selected'* ]]; then
printf 'Org is not the default format in the wiki editor\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/file?name=docs/org-support.org&ci=tip" ]]; then
if [[ "$body" != *'class="org-document"'* || "$body" != *'>Text</a>'* ]]; then
printf 'Native Org /file rendering or Text toggle is missing\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/file?name=docs/org-support.org&ci=tip&txt=1" ]]; then
if [[ "$body" == *'class="org-document"'* || "$body" != *'#+title: Native Org preview'* ]]; then
printf 'Org /file Text view did not show source\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/search?s=Native%20Org%20preview&y=d" ]]; then
if [[ "$body" != *"Native Org preview"* ]]; then
printf 'Org document was not found by full-text search\n' >&2
exit 1
fi
fi
if [[ "$path" == "/alpha/search?s=deployment%20guide&y=w" ]]; then
if [[ "$body" != *"Org Wiki"* ]]; then
printf 'Org wiki page was not found by full-text search\n' >&2
exit 1
fi
fi
printf 'ok %s\n' "$path"
done
default_skin_body=$(curl --fail --location --silent --show-error \
"$base_url/alpha/home?skin=default")
if [[ "$default_skin_body" == *'class="site-brand"'* ]]; then
printf 'The original Fossil default skin is not selectable\n' >&2
exit 1
fi
copland_skin_body=$(curl --fail --location --silent --show-error \
"$base_url/alpha/home?skin=copland")
if [[ "$copland_skin_body" != *'class="site-brand"'* ]]; then
printf 'The built-in Copland skin is not selectable\n' >&2
exit 1
fi
json_wiki=$(curl --fail --silent --show-error \
"$base_url/alpha/json/wiki/get?name=Org%20Wiki&format=html")
if [[ "$json_wiki" != *'org-document'* || "$json_wiki" != *'contentFormat":"html'* ]]; then
printf 'JSON wiki output did not render Org\n' >&2
exit 1
fi
json_preview=$(curl --fail --silent --show-error \
--header 'Content-Type: application/json' \
--data '{"payload":{"body":"* JSON preview","mimetype":"text/x-org"}}' \
"$base_url/alpha/json/wiki/preview")
if [[ "$json_preview" != *'org-document'* || "$json_preview" != *'JSON preview'* ]]; then
printf 'JSON wiki preview did not render Org\n' >&2
exit 1
fi
printf 'Smoke tests passed. Temporary fixtures: %s\n' "$test_dir"
|