[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] OSSTEST: standalone helper



I got a bit fed up of trying to remember which options/$env vars the
various osstest scripts took in standalone mode, so I lashed up a quick
bit of scripting (as one does).

I don't know if others would find this useful enough to add to the repo
and flesh it out (not to mention document it). Anyway, it is below, if
anyone thinks it would be useful I'll repost as a proper patch.

Ian.

#!/bin/bash

set -e

# XXX usage

op=$1 ; shift

TEMP=$(getopt -o c:f:h:rR --long config:,flight:,host:,reuse,noreuse,reinstall 
-- "$@")

eval set -- "$TEMP"

config=
flight="standalone"
host=
reuse=1 # Don't blow away machines by default

while true ; do
    case "$1" in
        -c|--config) config=$2; shift 2;;
        -f|--flight) flight=$2; shift 2;;
        -h|--host)   host=$2;   shift 2;;
        -r|--reuse)  reuse=1;   shift 1;;
        -R|--noreuse|--reinstall)reuse=0;shift 1;;
        --) shift ; break ;;
        *) echo "Internal error!" ; exit 1 ;;

    esac
done

if [ $reuse -eq 0 ]; then
    echo "WARNING: Will blow away machine..."
    echo "Press ENTER to confirm."
    read
fi

if [ ! -f standalone.db ] ; then
    echo "No standalone.db? Run standalone-reset." >&2
    exit 1
fi

# other potential checks:
# - ability to read apache logs
# - presences of working ssh-agent

# other potential ops:
# - run standalone reset
# - to set runvars from a dist tarball

case $op in
    run-job)
        if [ -z "$flight" ] ; then
            echo "run-job: Need a flight" >&2
            exit 1
        fi
        if [ -z "$host" ] ; then
            echo "run-job: Need a host" >&2
            exit 1
        fi
        if [ $# -lt 1 ] ; then
            echo "run-job: Need job" >&2
            exit 1
        fi

        job=$1; shift

        exec env \
            OSSTEST_CONFIG=$config \
            OSSTEST_FLIGHT=$flight \
            OSSTEST_HOST_HOST=$host \
            OSSTEST_HOST_REUSE=$reuse \
                ./sg-run-job $job 2>&1 | tee logs/$flight/$job.log
        ;;
    run-test)
        if [ $# -lt 1 ] ; then
            echo "run-test: Need a test case" >&2
            exit 1
        fi
        if [ -z "$host" ] ; then
            echo "run-test: Need a host" >&2
            exit 1
        fi

        if [ $# -lt 2 ] ; then
            echo "run-test: Need job + test" >&2
            exit 1
        fi

        job=$1; shift
        ts=$1; shift

        exec env \
            OSSTEST_CONFIG=$config \
            OSSTEST_JOB=$job \
                ./$ts host=$host $@ 2>&1 | tee logs/$flight/$job.$ts.log
        ;;
    *)
        echo "Unknown op $op" ; exit 1 ;;
esac



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.