diff options
author | Michael Vogt <mvo@debian.org> | 2014-06-12 08:36:58 +0200 |
---|---|---|
committer | Michael Vogt <mvo@debian.org> | 2014-06-12 08:36:58 +0200 |
commit | cfc7f735774ba30dbee1897248f8dfedf0229a4c (patch) | |
tree | b4e0ac29a6b398045a803e890f5cdabcca189d6a /test/integration/test-apt-extracttemplates | |
parent | a0187f0f82a184b850b05b62e5a59b6a2055a506 (diff) | |
parent | 7701680af12a2c1a65121533c6ebcd635c013c25 (diff) |
Merge tag '1.0.1ubuntu2' into ubuntu/trusty
Conflicts:
configure.ac
debian/changelog
debian/control
test/integration/framework
Diffstat (limited to 'test/integration/test-apt-extracttemplates')
-rwxr-xr-x | test/integration/test-apt-extracttemplates | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/test/integration/test-apt-extracttemplates b/test/integration/test-apt-extracttemplates new file mode 100755 index 000000000..ae2cc8bc2 --- /dev/null +++ b/test/integration/test-apt-extracttemplates @@ -0,0 +1,45 @@ +#!/bin/sh +set -e + +TESTDIR=$(readlink -f $(dirname $0)) +. $TESTDIR/framework + +setupenvironment +configarchitecture 'amd64' + +# apt-extracttemplates needs this +insertinstalledpackage 'debconf' 'amd64' '1.5' +insertinstalledpackage 'pkg-with-template' 'amd64' '1.0' + +# build a simple package that contains a config and a tempalte +mkdir -p DEBIAN +TEMPLATE_STR="Template: foo/bar +Type: string +Description: Some bar var +" +echo "$TEMPLATE_STR" > DEBIAN/templates + +CONFIG_STR="#!/bin/sh +random shell stuff +" +echo "$CONFIG_STR" > DEBIAN/config + +buildsimplenativepackage 'pkg-with-template' 'amd64' '0.8.15' 'stable' '' 'pkg with template' '' '' './DEBIAN' + +# ensure we get the right stuff out of the file +mkdir extracttemplates-out +OUT="$(aptextracttemplates -t ./extracttemplates-out incoming/pkg-with-template*.deb)" + +PKG=$(printf "$OUT" | cut -f1 -d' ') +INSTALLED_VER=$(printf "$OUT" | cut -f2 -d' ') +TEMPLATE=$(printf "$OUT" | cut -f3 -d' ') +CONFIG=$(printf "$OUT" | cut -f4 -d' ') + +testequal "$CONFIG_STR" cat $CONFIG +testequal "$TEMPLATE_STR" cat $TEMPLATE + +# ensure that the format of the output string has the right number of dots +for s in "$CONFIG" "$TEMPLATE"; do + NR_DOTS=$(basename "$s" | tr -c -d .) + testequal ".." echo $NR_DOTS +done |