summaryrefslogtreecommitdiffstats
path: root/bin/test_torbrowser-launcher.sh
blob: 0bb46d1ab59058b4cb894bb24c53a8955a6a75af (plain)
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
#!/bin/bash

# Copyright 2015 Holger Levsen <holger@layer-acht.org>
# released under the GPLv=2

DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"

set -e

cleanup_all() {
	cd
	# delete session if it still exists
	schroot --end-session -c tbb-launcher-$SUITE-$(basename $TMPDIR) > /dev/null 2>&1 || true
	# delete main work dir
	rm $TMPDIR -r
	echo "$(date -u) - $TMPDIR deleted. Cleanup done."
}

first_test() {
	set -x
	local SESSION="tbb-launcher-$SUITE-$(basename $TMPDIR)"
	schroot --begin-session --session-name=$SESSION -c jenkins-torbrowser-launcher-$SUITE
	schroot --run-session -c $SESSION --directory /tmp -- torbrowser-launcher --version
	schroot --run-session -c $SESSION --directory /tmp -- torbrowser-launcher https://www.debian.org
	schroot --end-session -c $SESSION
	if ! "$DEBUG" ; then set +x ; fi
}

#
# main
#

TMPDIR=$(mktemp -d)  # where everything actually happens
trap cleanup_all INT TERM EXIT
cd $TMPDIR

SUITE=$1
echo "$(date -u) - testing torbrowser-launcher on $SUITE now."
#
# this is WIP in an early stage (and it won't work as X ain't configured yet)
# - test package build from git (todo)
# - test package from the archive (in progress)
# - test updates (todo)
#
first_test

cd
cleanup_all
trap - INT TERM EXIT
echo "$(date -u) - the end."