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
|
#! /bin/sh
set -e
pkg="offpunk"
if [ "${AUTOPKGTEST_TMP}" = "" ]
then
AUTOPKGTEST_TMP=$(mktemp -d /tmp/${pkg}-test.XXXXXX)
trap "rm -rf ${AUTOPKGTEST_TMP}" 0 INT QUIT ABRT PIPE TERM
fi
# This test is expected to be run from debian source code.
cp ./doc/index.gmi "${AUTOPKGTEST_TMP}"
cd "${AUTOPKGTEST_TMP}"
HOME="${AUTOPKGTEST_TMP}"
export HOME
set -v
# 0. Basic arguments
offpunk --version
offpunk --help
offpunk --features
echo quit | offpunk --bookmarks
# 1. Basic commands
cat << END | offpunk
version
help
help abbrevs
help add
help back
help blackbox
help bookmarks
help cat
help cert
help copy
help find
help forward
help go
help gus
help handler
help help
help history
help info
help list
help ls
help mark
help move
help offline
help online
help open
help redirect
help reload
help root
help save
help set
help shell echo test
help subscribe
help sync
help theme
help tour
help url
help version
help wikipedia
help xkcd
help exit
help quit
quit
END
# cert calls a submenu which expects then a blank line to get outside.
# find will call the pager
# gus and search will launch the client to the search engine.
# reload will call the pager
# wikipedia will require test to have Internet access
cat << END | offpunk
abbrevs
add
archive
back
blackbox
bookmarks
cat
cert
copy
forward
go
handler
history
info
list
ls
mark
move
offline
online
open
redirect
root
save
set
shell echo test
subscribe
sync
tour
theme
url
exit
END
# 2. Checks against gemini file
cat << END | offpunk
go file://$PWD/index.gmi
quit
END
# 3. Test netcache command
# 3.0 Basic
netcache --help
# 3.1 Various suboptions
OUT="$(netcache --path "file://$PWD/index.gmi")"
echo "$OUT" | grep -q "$PWD/index.gmi"
# (Note that the file local do not feed the user's cache.)
# 3.2 Main functionality
netcache "file://$PWD/index.gmi"
netcache --offline "file://$PWD/index.gmi"
netcache --max-size 1 "file://$PWD/index.gmi"
# Note that testing the --timeout looks to need Internet, so we'll skip this
# option for now.
# 4. Test ansicat
# 4.0 Basic
ansicat --help
# 4.1 Test some ansicat formats and options
# WARNING: there is something about autopkgtest environment that causes the two
# below commands to crash, but running them by hand works perfectly.
# This may indicate fragility in the tool, but it is curious that the
# 4.2 section below gave no difficulty: if this crashes too, then it
# may be reasonable to skip it as well.
#ansicat --format plaintext index.gmi
#ansicat --mime text/plain index.gmi
# 4.2 Main functionality
ansicat --url "file://$PWD/index.gmi" index.gmi
# 5. Test opnk
# 5.0 Basic
opnk --help
# 5.1 Open some things (but stick to not needing Internet).
opnk /usr/share/doc/offpunk/copyright
# 5.2 Main functionality
opnk index.gmi
|