This file is indexed.

/usr/bin/autopilot-sandbox-run is in python-autopilot 1.4.1+15.10.20150911-0ubuntu2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/sh

#
# Runner to execute autopilot locally
#
# This scripts run autopilot in a "fake" X server, either headless with xvfb
# or nested with Xephyr
#

# Copyright (C) 2013 Canonical
#
# Authors: Jean-Baptiste Lallement <jean-baptiste.lallement@canonical.com>
#
# This program is free software; you can redistribute it and/or modify it # under
# the terms of the GNU General Public License as published by the Free # Software
# Foundation; version 3.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # FITNESS
# FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more # details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
set -eu

# General Settings
RC=0  # Main return code
BINDIR=$(dirname $(readlink -f $0))
XEPHYR=0
XEPHYR_CMD="$(which Xephyr||true)"
XEPHYR_OPT="-ac -br -noreset"

XVFB_CMD="$(which Xvfb||true)"
XVFB_OPT=""

AP_CMD="$(which autopilot)"
AP_OPT=""

SERVERNUM=5
SCREEN="1024x768x24"

DBUS_SESSION_BUS_PID=""
X_PID=""

usage() {
    # Display usage and exit with error
    cat<<EOF
Usage: $(basename $0) [OPTIONS...] TEST [TEST...]
Runs autopilot tests in a 'fake' Xserver with Xvfb or Xephyr. autopilot runs
in Xvfb by default.
    
    TEST: autopilot tests to run

Options:
    -h, --help           This help
    -d, --debug          Enable debug mode
    -a, --autopilot ARG  Pass arguments ARG to 'autopilot run'
    -X, --xephyr         Run in nested mode with Xephyr
    -s, --screen WxHxD   Sets screen width, height, and depth to W, H, and D
                         respectively (default: $SCREEN)

EOF
    RC=1
    exit
}

find_free_servernum() {
    # Find a free server number by looking at .X*-lock files in /tmp.
    # Inspired from xvfb-run
    #
    # Args:
    #   None
    # Returns:
    #   First free server number
    #
    snum=$SERVERNUM
    while [ -f /tmp/.X$snum-lock ]; do
        snum=$(($snum + 1))
    done
    echo $snum
}

wait_for_x() {
    # Waits for start of fake X server and exit on timeout
    #
    # Args:
    #   $1: Server number
    # Returns
    #   None
    if [ $# -ne 1 ]; then
        echo "E: wait_for_x: Missing argument servernum"
        RC=1
        exit
    fi
    loops=100
    delay=.1
    snum=$1
    while [ ! -e /tmp/.X$snum-lock ]; do
        sleep $delay
        loops=$((loops - 1))
        if [ $loops -le 0 ]; then
            echo "E: X Server :$snum failed to come up.  Aborting!"
            RC=1
            exit
        fi
    done
}

on_exit() {
    # Exit handler
    for pid in "$DBUS_SESSION_BUS_PID" "$X_PID"; do
        [ -n "$pid" ] && kill $pid >/dev/null 2>&1 || true
    done

    exit $RC
}

trap on_exit EXIT INT QUIT ABRT PIPE TERM

SHORTOPTS="hda:s:X"
LONGOPTS="help,debug,autopilot:,screen:,xephyr"

TEMP=$(getopt -o $SHORTOPTS --long $LONGOPTS -- "$@")
eval set -- "$TEMP"

exec 2>&1

while true ; do
    case "$1" in
        -h|--help)
            usage;;
        -d|--debug)
            set -x
            shift;;
        -a|--autopilot)
            AP_OPT=$2
            shift 2;;
        -s|-screen)
            SCREEN=$2
            shift 2;;
        -X|--xephyr)
            XEPHYR=1
            [ ! -x "$XEPHYR_CMD" ] && \
                echo "E: Xephyr executable not found. Please install Xephyr" &&\
                RC=1 && exit 1
            shift;;
        --) shift;
            break;;
        *) usage;;
    esac
done

[ $# -eq 0 ] && usage
if [ $XEPHYR -eq 0 -a ! -x "$XVFB_CMD" ]; then
    echo "E: Xvfb executable not found. Please install xvfb"
    RC=1
    exit 
fi

TESTLIST="$@"
echo "I: Running tests $TESTLIST"

SERVERNUM=$(find_free_servernum)
XCMD="$XVFB_CMD :$SERVERNUM $XVFB_OPT -screen 0 $SCREEN"
[ $XEPHYR -eq 1 ] && XCMD="$XEPHYR_CMD :$SERVERNUM $XEPHYR_OPT -screen $SCREEN"

echo "I: Starting X Server: $XCMD"
$XCMD >/dev/null 2>&1 &
X_PID=$!
export DISPLAY=:${SERVERNUM}.0

export XAUTHORITY=/dev/null
wait_for_x $SERVERNUM
echo "I: Starting autopilot"
dbus-launch --exit-with-session autopilot run $AP_OPT $TESTLIST || RC=$?
echo "I: autopilot tests done"