Debian Codegraph @

debian/tests/run-commands

raw
1 #! /bin/sh
2 set -e
3 pkg="offpunk"
4
5 if [ "${AUTOPKGTEST_TMP}" = "" ]
6 then
7 AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
8 trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
9 fi
10
11 # This test is expected to be run from debian source code.
12 cp ./tutorial/index.gmi "${AUTOPKGTEST_TMP}"
13 cd "${AUTOPKGTEST_TMP}"
14 HOME="${AUTOPKGTEST_TMP}"
15 export HOME
16
17 set -v
18
19 # 0. Basic arguments
20 offpunk --version
21 offpunk --help
22 offpunk --features
23 echo quit | offpunk --bookmarks
24
25 # 1. Basic commands
26 cat << END | offpunk
27 version
28 help
29 help abbrevs
30 help add
31 help back
32 help blackbox
33 help bookmarks
34 help cat
35 help cert
36 help copy
37 help find
38 help forward
39 help go
40 help gus
41 help handler
42 help help
43 help history
44 help info
45 help list
46 help ls
47 help mark
48 help move
49 help offline
50 help online
51 help open
52 help redirect
53 help reload
54 help root
55 help save
56 help set
57 help shell echo test
58 help subscribe
59 help sync
60 help theme
61 help tour
62 help url
63 help version
64 help wikipedia
65 help xkcd
66 help exit
67 help quit
68 quit
69 END
70
71 # cert calls a submenu which expects then a blank line to get outside.
72 # find will call the pager
73 # gus and search will launch the client to the search engine.
74 # reload will call the pager
75 # wikipedia will require test to have Internet access
76 cat << END | offpunk
77 abbrevs
78 add
79 archive
80 back
81 blackbox
82 bookmarks
83 cat
84 cert
85
86 copy
87 forward
88 go
89 handler
90 history
91 info
92 list
93 ls
94 mark
95 move
96 offline
97 online
98 open
99 redirect
100 root
101 save
102 set
103 shell echo test
104 subscribe
105
106 sync
107 tour
108 theme
109 url
110 exit
111 END
112
113 # 2. Checks against gemini file
114 cat << END | offpunk
115 go file://$PWD/index.gmi
116 quit
117 END
118
119 # 3. Test netcache command
120 # 3.0 Basic
121 netcache --help
122 # 3.1 Various suboptions
123 OUT="$(netcache --path "file://$PWD/index.gmi")"
124 echo "$OUT" | grep -q "$PWD/index.gmi"
125 # (Note that the file local do not feed the user's cache.)
126 # 3.2 Main functionality
127 netcache "file://$PWD/index.gmi"
128 netcache --offline "file://$PWD/index.gmi"
129 netcache --max-size 1 "file://$PWD/index.gmi"
130 # Note that testing the --timeout looks to need Internet, so we'll skip this
131 # option for now.
132
133 # 4. Test ansicat
134 # 4.0 Basic
135 ansicat --help
136 # 4.1 Test some ansicat formats and options
137 # WARNING: there is something about autopkgtest environment that causes the two
138 # below commands to crash, but running them by hand works perfectly.
139 # This may indicate fragility in the tool, but it is curious that the
140 # 4.2 section below gave no difficulty: if this crashes too, then it
141 # may be reasonable to skip it as well.
142 #ansicat --format plaintext index.gmi
143 #ansicat --mime text/plain index.gmi
144 # 4.2 Main functionality
145 ansicat --url "file://$PWD/index.gmi" index.gmi
146
147 # 5. Test openk
148 # 5.0 Basic
149 openk --help
150 # 5.1 Open some things (but stick to not needing Internet).
151 openk /usr/share/doc/offpunk/copyright
152 # 5.2 Main functionality
153 openk index.gmi