Debian Codegraph @

.ci/ci-test.sh

raw symbols SCIP
1 #! /bin/shscip-shell filesystem . . `/bin/sh`.
2
3 DNS_PORT=5300
4 HTTP_PORT=3053
5 TEST_COUNT=0
6
7 exec 2>error.log
8
9 tscip-shell shell shell-project 0.0.0 t().() {
10 TEST_COUNT=$((TEST_COUNT + 1))
11 echoscip-shell system . . echo. "Test #${TEST_COUNT}..."
12 falsescip-shell system . . false.
13 }
14
15 failscip-shell shell shell-project 0.0.0 fail().() (
16 echoscip-shell system . . echo. "*** Test #${TEST_COUNT} FAILED, line: $1 ***" >&2
17 )
18
19 sectionscip-shell shell shell-project 0.0.0 section().() {
20 truescip-shell system . . true.
21 }
22
23 rmscip-shell system . . rm. -f blocked-names.log blocked-ips.log query.log nx.log allowed-names.log
24
25 tscip-shell shell shell-project 0.0.0 t(). || (
26 cd ../dnscrypt-proxy
27 goscip-shell system . . go. test -mod vendor
28 goscip-shell system . . go. build -mod vendor -race
29 ) || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
30
31 sectionscip-shell shell shell-project 0.0.0 section().
32 sedscip-shell system . . sed. -e "s/127.0.0.1:53/127.0.0.1:${DNS_PORT}/g" -e "s/# server_names =.*/server_names = ['scaleway-fr']/" ../dnscrypt-proxy/example-dnscrypt-proxy.toml >test-dnscrypt-proxy.toml
33 ../dnscrypt-proxy/dnscrypt-proxy -loglevel 3 -config test-dnscrypt-proxy.toml -pidfile /tmp/dnscrypt-proxy.pidfilescip-shell filesystem . . `/tmp/dnscrypt-proxy.pidfile`. &
34 sleepscip-shell system . . sleep. 5
35
36 tscip-shell shell shell-project 0.0.0 t(). ||
37 dig -p${DNS_PORT} . @127.0.0.1 | grepscip-shell system . . grep. -Fq 'root-servers.net.' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
38 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec . @127.0.0.1 | grepscip-shell system . . grep. -Fq 'root-servers.net.' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
39 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec . @127.0.0.1 | grepscip-shell system . . grep. -Fq 'flags: do;' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
40 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short one.one.one.one @127.0.0.1 | grepscip-shell system . . grep. -Fq '1.1.1.1' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
41 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec dnscrypt.info @127.0.0.1 | grepscip-shell system . . grep. -Fq 'flags: qr rd ra ad' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
42 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec dnscrypt.info @127.0.0.1 | grepscip-shell system . . grep. -Fq 'flags: do;' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
43
44 killscip-shell system . . kill. $(catscip-shell system . . cat. /tmp/dnscrypt-proxy.pidfilescip-shell filesystem . . `/tmp/dnscrypt-proxy.pidfile`.)
45 sleepscip-shell system . . sleep. 5
46
47 sectionscip-shell shell shell-project 0.0.0 section().
48 ../dnscrypt-proxy/dnscrypt-proxy -loglevel 3 -config test2-dnscrypt-proxy.toml -pidfile /tmp/dnscrypt-proxy.pidfilescip-shell filesystem . . `/tmp/dnscrypt-proxy.pidfile`. &
49 sleepscip-shell system . . sleep. 5
50
51 sectionscip-shell shell shell-project 0.0.0 section().
52 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A microsoft.com @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
53 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A MICROSOFT.COM @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
54
55 sectionscip-shell shell shell-project 0.0.0 section().
56 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} AAAA ipv6.google.com @127.0.0.1 | grepscip-shell system . . grep. -Fq 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
57
58 sectionscip-shell shell shell-project 0.0.0 section().
59 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} invalid. @127.0.0.1 | grepscip-shell system . . grep. -Fq NXDOMAIN || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
60 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec invalid. @127.0.0.1 | grepscip-shell system . . grep. -Fq 'flags: do;' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
61 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} PTR 168.192.in-addr.arpa @127.0.0.1 | grepscip-shell system . . grep. -Fq 'NXDOMAIN' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
62 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec PTR 168.192.in-addr.arpa @127.0.0.1 | grepscip-shell system . . grep. -Fq 'flags: do;' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
63
64 sectionscip-shell shell shell-project 0.0.0 section().
65 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec darpa.mil @127.0.0.1 2>&1 | grepscip-shell system . . grep. -Fvq 'RRSIG' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
66 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +dnssec www.darpa.mil @127.0.0.1 2>&1 | grepscip-shell system . . grep. -Fvq 'RRSIG' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
67 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A download.windowsupdate.com @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
68
69 sectionscip-shell shell shell-project 0.0.0 section().
70 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short cloakedunregistered.com @127.0.0.1 | grepscip-shell system . . grep. -Eq '1.1.1.1|1.0.0.1' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
71 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short MX cloakedunregistered.com @127.0.0.1 | grepscip-shell system . . grep. -Fq 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
72 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short MX example.com @127.0.0.1 | grepscip-shell system . . grep. -Fvq 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
73 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} NS cloakedunregistered.com @127.0.0.1 | grepscip-shell system . . grep. -Fiq 'gtld-servers.net' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
74 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short www.cloakedunregistered2.com @127.0.0.1 | grepscip-shell system . . grep. -Eq '1.1.1.1|1.0.0.1' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
75 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short www.dnscrypt-test @127.0.0.1 | grepscip-shell system . . grep. -Fq '192.168.100.100' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
76 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} a.www.dnscrypt-test @127.0.0.1 | grepscip-shell system . . grep. -Fq 'NXDOMAIN' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
77 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short ptr 101.100.168.192.in-addr.arpa. @127.0.0.1 | grepscip-shell system . . grep. -Eq 'www.dnscrypt-test.com' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
78 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} +short ptr 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.d.f.ip6.arpa. @127.0.0.1 | grepscip-shell system . . grep. -Eq 'ipv6.dnscrypt-test.com' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
79
80 sectionscip-shell shell shell-project 0.0.0 section().
81 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} telemetry.example @127.0.0.1 | grepscip-shell system . . grep. -Fq 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
82
83 sectionscip-shell shell shell-project 0.0.0 section().
84 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} dns.google @127.0.0.1 | grepscip-shell system . . grep. -Fq 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
85
86 sectionscip-shell shell shell-project 0.0.0 section().
87 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} tracker.xdebian.org @127.0.0.1 | grepscip-shell system . . grep. -Fq 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
88 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} tracker.debian.org @127.0.0.1 | grepscip-shell system . . grep. -Fqv 'locally blocked' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
89
90 sectionscip-shell shell shell-project 0.0.0 section().
91 tscip-shell shell shell-project 0.0.0 t(). || curlscip-shell system . . curl. --insecure -siL https://127.0.0.1:${HTTP_PORT}/ | grepscip-shell system . . grep. -Fq 'HTTP/2 404' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
92 tscip-shell shell shell-project 0.0.0 t(). || curlscip-shell system . . curl. --insecure -sL https://127.0.0.1:${HTTP_PORT}/dns-query | grepscip-shell system . . grep. -Fq 'dnscrypt-proxy local DoH server' || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
93 tscip-shell shell shell-project 0.0.0 t(). ||
94 echoscip-shell system . . echo. yv4BAAABAAAAAAABAAACAAEAACkQAAAAgAAAAA== | base64scip-shell system . . base64. -d |
95 curlscip-shell system . . curl. -H'Content-Type: application/dns-message' -H'Accept: application/dns-message' --data-binary @- -D - --insecure https://127.0.0.1:${HTTP_PORT}/dns-query 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
96 grepscip-shell system . . grep. -Fq application/dns-message || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
97
98 killscip-shell system . . kill. $(catscip-shell system . . cat. /tmp/dnscrypt-proxy.pidfilescip-shell filesystem . . `/tmp/dnscrypt-proxy.pidfile`.)
99
100 sleepscip-shell system . . sleep. 5
101
102 sectionscip-shell shell shell-project 0.0.0 section().
103 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'telemetry.example' blocked-names.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
104 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'telemetry.*' blocked-names.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
105 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'tracker.xdebian.org' blocked-names.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
106 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'tracker.*' blocked-names.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
107
108 sectionscip-shell shell shell-project 0.0.0 section().
109 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'dns.google' blocked-ips.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
110 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq '8.8.8.8' blocked-ips.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
111
112 sectionscip-shell shell shell-project 0.0.0 section().
113 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'a.www.dnscrypt-test' nx.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
114
115 sectionscip-shell shell shell-project 0.0.0 section().
116 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'a.www.dnscrypt-test' nx.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
117
118 sectionscip-shell shell shell-project 0.0.0 section().
119 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'microsoft.com.*PASS.*ms.[a-zA-Z]' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
120 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'microsoft.com.*PASS.*ms.-.' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
121 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'ipv6.google.com.*SYNTH' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
122 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'invalid.*SYNTH' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
123 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq '168.192.in-addr.arpa.*SYNTH' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
124 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'darpa.mil.*FORWARD' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
125 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'www.darpa.mil.*FORWARD' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
126 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'download.windowsupdate.com.*FORWARD' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
127 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'cloakedunregistered.com.*CLOAK' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
128 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'www.cloakedunregistered2.com.*CLOAK' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
129 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'www.dnscrypt-test.*CLOAK' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
130 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'a.www.dnscrypt-test.*NXDOMAIN' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
131 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'telemetry.example.*REJECT' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
132 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'dns.google.*REJECT' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
133 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'tracker.xdebian.org.*REJECT' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
134 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq 'tracker.debian.org.*PASS' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
135 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Eq '[.].*NS.*PASS' query.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
136
137 sectionscip-shell shell shell-project 0.0.0 section().
138 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq 'tracker.debian.org' allowed-names.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
139 tscip-shell shell shell-project 0.0.0 t(). || grepscip-shell system . . grep. -Fq '*.tracker.debian' allowed-names.log || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
140
141 sectionscip-shell shell shell-project 0.0.0 section().
142 ../dnscrypt-proxy/dnscrypt-proxy -loglevel 3 -config test3-dnscrypt-proxy.toml -pidfile /tmp/dnscrypt-proxy.pidfilescip-shell filesystem . . `/tmp/dnscrypt-proxy.pidfile`. &
143 sleepscip-shell system . . sleep. 5
144
145 sectionscip-shell shell shell-project 0.0.0 section().
146 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A microsoft.com @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
147 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A MICROSOFT.COM @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
148
149 killscip-shell system . . kill. $(catscip-shell system . . cat. /tmp/dnscrypt-proxy.pidfilescip-shell filesystem . . `/tmp/dnscrypt-proxy.pidfile`.)
150 sleepscip-shell system . . sleep. 5
151
152 sectionscip-shell shell shell-project 0.0.0 section().
153 ../dnscrypt-proxy/dnscrypt-proxy -loglevel 3 -config test-odoh-proxied.toml -pidfile /tmp/odoh-proxied.pidfilescip-shell filesystem . . `/tmp/odoh-proxied.pidfile`. &
154 sleepscip-shell system . . sleep. 5
155
156 sectionscip-shell shell shell-project 0.0.0 section().
157 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A microsoft.com @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
158 tscip-shell shell shell-project 0.0.0 t(). || dig -p${DNS_PORT} A cloudflare.com @127.0.0.1 | grepscip-shell system . . grep. -Fq "NOERROR" || failscip-shell shell shell-project 0.0.0 fail(). $LINENO
159
160 killscip-shell system . . kill. $(catscip-shell system . . cat. /tmp/odoh-proxied.pidfilescip-shell filesystem . . `/tmp/odoh-proxied.pidfile`.)
161 sleepscip-shell system . . sleep. 5
162
163 if [scip-shell system . . `[`. -s error.log ]; then
164 catscip-shell system . . cat. *.log
165 exit 1
166 fi