File: regression_test

package info (click to toggle)
lua5.1 5.1.5-7.1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 1,312 kB
  • ctags: 2,940
  • sloc: ansic: 12,763; makefile: 406; sh: 73
file content (91 lines) | stat: -rwxr-xr-x 2,378 bytes parent folder | download | duplicates (5)
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
#!/bin/bash -e
#
# Regression test for Lua packages.
#
# Synopsis:
#       $ regression_test  build-area/lua5.1_5.1-1_i386.changes
#
# As new packaging bugs are discovered, try to add a corresponding regression
# test to this script.
#
# This script requires root privilege.  It's intended to be run in a
# base chroot environment (e.g. via "pbuilder execute").
#

if (($# != 1)); then
    echo "usage: $(basename $0) CHANGES_FILE"
    exit 1
fi 1>&2

trap "echo 'Regression test FAILED.' 1>&2" EXIT

CHANGES="$1"
PACKAGE_DIR=$(dirname $CHANGES)

PACKAGE_NAME=$(grep ^Source: $CHANGES | cut -d' ' -f2)
PACKAGE_V=$(grep ^Version: $CHANGES | cut -d' ' -f2)
DEBS=$(grep '\.deb$' $CHANGES | cut -d' ' -f6 |
    xargs -iXX echo ${PACKAGE_DIR}/XX)
PACKAGES=$(grep '\.deb$' $CHANGES | cut -d' ' -f6 | cut -d_ -f1)

LUA_V=$(cut -d'-' -f1 <<<$PACKAGE_V)
LUA_MAJOR_V=$(cut -d'.' -f-2 <<<$LUA_V)
SRC_BASE=${PACKAGE_DIR}/${PACKAGE_NAME}_${PACKAGE_V}
DSC_FILE=${SRC_BASE}.dsc
DIFF_FILE=${SRC_BASE}.diff.gz

APT_INSTALL="apt-get install -qq --force-yes"

function msg
{
    echo "*** $@"
}

msg "Starting tests."

# Since we are installing our .deb's directly, we have to manually install
# dependencies.  It would be better to have our packages available through
# an apt source.
msg "(Installing dependencies...)"
$APT_INSTALL libreadline-dev libncurses5-dev

msg "Package install..."
dpkg -i $DEBS

msg "(Installing support packages...)"
# install packages for other tests
$APT_INSTALL pkg-config libtool lintian patchutils

msg "Lintian test..."
lintian -i --allow-root $DSC_FILE $DEBS

msg "pkg-config test..."
pkg-config --exists $PACKAGE_NAME
[[ "$(pkg-config $PACKAGE_NAME --modversion)" == "$LUA_V" ]] || exit 1
[[ "$(pkg-config $PACKAGE_NAME --variable major_version)" == \
    "$LUA_MAJOR_V" ]] || exit 1

msg "Examples test..."
cd /usr/share/doc/${PACKAGE_NAME}-doc/examples/debian
make -s
cd -

msg "Man page test..."
man lua luac lua${LUA_MAJOR_V} luac${LUA_MAJOR_V} > /dev/null

msg "Doc test..."
# ensure every package has README.Debian
for name in $PACKAGES; do
    [[ -f /usr/share/doc/$name/README.Debian.gz ]] || exit 1
done

msg "Diff test..."
if BAD_DIFFS=$(zcat $DIFF_FILE | lsdiff --strip=1 |
        grep -v ^debian/); then
    echo "ERROR: diff contains items outside of debian directory:"
    echo "$BAD_DIFFS"
    exit 1
fi 1>&2

msg "All tests passed."
trap EXIT