Files
Dimitri John Ledkov 5774390b2d Refactor stage1/init to source most of options from manifest, rather than flavor/stampfile-based.
This refactor will make it easier to integrate lkvm support, and also
brings other benefits.

Specifically, with this refactor almost all functionality of stage1
init is flavor independent and can be fully controlled via a manifest
and uses as little hard coded paths as possible.

Thus, e.g. distribution packagers, can create package which will only
have rkt/stage1 provided binaries (gc, waiter, init, etc.) and specify
the rest of things in the manifest (path to nspawn, ld.so, LD LIBRARY
PATH, libfakesdbooted.so, etc). And create fully free-standing
stage1.aci by simply creating basic distribution chroot with
distro-native tools and supplying a matching/correct aci-manifest. By
fully free-standing, I mean similar to current coreos flavor, which is
completely independent of the host OS binaries & load paths and is
truly run everywhere.

Many of these refactors will be useful for future lkvm integration,
e.g. reusing ld.so load paths and similar.
2015-06-09 10:47:56 +01:00

38 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# This script is normally executed by ./test in the topdir source directory.
# In this case, $GOPATH is already set.
#
# However, when developing a new functional test, it is useful to run the
# tests manually without recompiling rkt. GOPATH is set to the same directory
# as ./build in the topdir source directory does.
#
# To run all tests:
# $ cd tests && ./test
#
# To run only one test:
# $ cd tests && ./test -run=TestEnv
# Sudo does not preserve $PATH. Use go from the user's $PATH instead of
# root's $PATH. It is needed when a home-built go does not have the same
# version as the system-wide installed go.
GO=`which go`
HOST_RUNNING_SYSTEMD=0
if [ $(basename $(sudo readlink /proc/1/exe)) == systemd ] ; then
HOST_RUNNING_SYSTEMD=1
fi
STAGE1_SRC_FROM_HOST=0
if tar xOvf ../bin/stage1.aci manifest|grep -q usr-from-host ; then
STAGE1_SRC_FROM_HOST=1
fi
if [ $HOST_RUNNING_SYSTEMD -eq 0 -a $STAGE1_SRC_FROM_HOST -eq 1 ] ; then
echo "Cannot use stage1 compiled with usr-from-host because systemd is not installed."
echo "Functional tests disabled."
exit 0
fi
sudo GOPATH="${PWD}/../gopath" GOROOT="$GOROOT" $GO test -v $*