4
# Runs an otto job with otto-run. This script must be integrated as part of a
7
# This script is part of the project Otto
10
# Copyright © 2013 Canonical Ltd.
11
# Author: Jean-baptiste Lallement <jean-baptiste.lallement@canonical.com>
13
# This program is free software; you can redistribute it and/or modify
14
# it under the terms of the GNU General Public License version 2, as
15
# published by the Free Software Foundation.
17
# This program is distributed in the hope that it will be useful,
18
# but WITHOUT ANY WARRANTY; without even the implied warranty of
19
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
# GNU General Public License for more details.
22
# You should have received a copy of the GNU General Public License along
23
# with this program; if not, write to the Free Software Foundation, Inc.,
24
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26
# Usual workspace cleanup
30
# Display the address to download the container used to run this test
32
# $1: Name of the container
35
echo "E: Missing argument: <name of container>"
39
ifdev=$(ip addr show |awk '$1 == "inet" && $3 == "brd" { print $7; exit 0; }')
40
ipaddr=$(ip addr show dev $ifdev |awk '$1 == "inet" && $3 == "brd" { sub (/\/.*/,""); print $2 }')
42
if ! nc -z $ipaddr 80; then
43
echo "W: No http server running on this host"
47
containeruri="http://$ipaddr/otto/$name"
49
______________________________________________________________________________
51
I: Archive of the container to run this test available for download from:
53
______________________________________________________________________________
57
# Location of the testsuite on LP and locally
58
TS_BRANCH="${TS_BRANCH:-lp:~otto-dev/otto/testsuite_autopilot-unity}"
59
TS_EXPORT="$WORKSPACE/testsuite"
61
ARCH=$(dpkg --print-architecture )
62
# Find newest container
63
CONTAINER=$(lxc-ls "${series}-${ARCH}-*" | tail -1)
65
if [ -z "$CONTAINER" ] ; then
66
echo "E: couldn't find containers matching '${series}-${ARCH}-*'".
67
echo "E: Containers available on this system:"
72
# Export the testsuite
73
bzr export $TS_EXPORT $TS_BRANCH
75
# Set environment for Otto and match with parameters from Jenkins
77
[ -n "$ppa" ] && export TESTREPOS="ppa:$ppa"
78
export TESTPKGS="${testpackages:-}"
79
export TESTPKGSSTRICT="${packages:-}"
80
export TESTS="${tests:-}"
81
export RESULTSDIR="${WORKSPACE}/results"
83
# NOTE: Run otto-run with -E to preserve the environment
84
sudo -E $HOME/bin/otto-run $CONTAINER $TS_EXPORT || echo "E: otto-run exited with status $?"
87
show_dl_addr $CONTAINER