#! /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 ./tutorial/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 openk # 5.0 Basic openk --help # 5.1 Open some things (but stick to not needing Internet). openk /usr/share/doc/offpunk/copyright # 5.2 Main functionality openk index.gmi