File: version.t

package info (click to toggle)
dothost 0.2.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 120 kB
  • sloc: sh: 141; python: 100; makefile: 36
file content (44 lines) | stat: -rwxr-xr-x 1,172 bytes parent folder | download
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
#!/bin/sh

# Copyright © 2019-2020 Jakub Wilk <jwilk@jwilk.net>
# SPDX-License-Identifier: MIT

set -e -u
echo 1..3
base="${0%/*}/.."
prog="${DOTHOST_TEST_TARGET:-"$base/dothost"}"
if [ "${prog%/*}" = "$prog" ]
then
    orig_prog="$prog"
    prog=$(command -v "$prog") || {
        printf '%s: command not found\n' "$orig_prog" >&2
        exit 1
    }
fi
echo "# test target = $prog"
IFS='(); ' read -r _ changelog_version changelog_dist _ < "$base/doc/changelog"
echo "# changelog version = $changelog_version"
echo "# changelog dist = $changelog_dist"
line=$(grep '^__version__ *=' "$prog")
IFS=" ='" read -r _ _ cli_version <<EOF
$line
EOF
echo "# CLI version = $cli_version"
[ "$cli_version" = "$changelog_version" ]
echo "ok 1 CLI version == changelog version"
if [ -d "$base/.git" ]
then
    echo 'ok 2 # skip git checkout'
else
    [ "$changelog_dist" != UNRELEASED ]
    echo 'ok 2 distribution != UNRELEASED'
fi
line=$(grep '^[.]TH ' "$base/doc/"*.1)
IFS=' "' read -r _ _ _ _ _ man_version _ <<EOF
$line
EOF
echo "# man page version = $man_version"
[ "$cli_version" = "$man_version" ]
echo "ok 3 CLI version == man page version"

# vim:ts=4 sts=4 sw=4 et ft=sh