Squashed 'third_party/allwpilib_2017/' content from commit 35ac87d
Change-Id: I7bb6f5556c30d3f5a092e68de0be9c710c60c9f4
git-subtree-dir: third_party/allwpilib_2017
git-subtree-split: 35ac87d6ff8b7f061c4f18c9ea316e5dccd4888a
diff --git a/test-scripts/.gitattributes b/test-scripts/.gitattributes
new file mode 100644
index 0000000..cb5c152
--- /dev/null
+++ b/test-scripts/.gitattributes
@@ -0,0 +1,4 @@
+# Set the default behavior, in case people don't have core.autocrlf set.
+* text=auto
+
+*.sh text eol=lf
diff --git a/test-scripts/README.md b/test-scripts/README.md
new file mode 100644
index 0000000..a96764e
--- /dev/null
+++ b/test-scripts/README.md
@@ -0,0 +1,17 @@
+# WPILIB TEST SCRIPTS
+## Overview
+These test scripts are designed to allow the user of the WPILib test framework to quickly and easily deploy and run their tests on the WPI roboRIO.
+
+In order for the automated test system to work there is a driverstation onboard the roboRIO that handles a queue of users waiting to use the driver station. All of the interaction with this queue is handled internally by test scripts contained within this folder.
+
+If you deploy code to the test stand using the Eclipse plugins, you _must_ remove the build artifacts in `/home/lvuser`, or you will break tests.
+
+## roboRIO Setup
+The roboRIO on the test bench must be updated everytime NI releases a new image.
+
+1. [Use the roboRIO Imaging Tool to format the roboRIO with the lastest image.](https://wpilib.screenstepslive.com/s/4485/m/13503/l/144984-imaging-your-roborio)
+2. [Install Java on the roboRIO.](https://wpilib.screenstepslive.com/s/4485/m/13503/l/599747-installing-java-8-on-the-roborio-using-the-frc-roborio-java-installer-java-only)
+3. SFTP the [teststand, netconsole, and libstdc++ ipk files](https://users.wpi.edu/~phplenefisch/ipk/) on to the roboRIO.
+4. ssh on to the roboRIO as the admin user (ex: `ssh admin@roboRIO-190-FRC.local`)
+5. Use opkg to install the ipk files (ex: `opkg install teststand_1.2-1_armv7a-vfp.ipk`)
+6. Reboot the roboRIO
diff --git a/test-scripts/config.sh b/test-scripts/config.sh
new file mode 100755
index 0000000..1d2688e
--- /dev/null
+++ b/test-scripts/config.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+#*----------------------------------------------------------------------------*#
+#* Copyright (c) FIRST 2014. All Rights Reserved. *#
+#* Open Source Software - may be modified and shared by FRC teams. The code *#
+#* must be accompanied by the FIRST BSD license file in the root directory of *#
+#* the project. *#
+#*----------------------------------------------------------------------------*#
+
+# If this is changed, update the .gitignore
+# so that test results are not commited to the repo
+DEFAULT_LOCAL_TEST_RESULTS_DIR=../test-reports
+
+ROBOT_ADDRESS=admin@roboRIO-190-FRC.local
+ADMIN_ROBOT_ADDRESS=admin@roboRIO-190-FRC.local
+DEFAULT_LOCAL_RUN_TEST_SCRIPT="run-tests-on-robot.sh"
+
+DEFAULT_DESTINATION_DIR=/home/admin
+DEFAULT_TEST_SCP_DIR=${DEFAULT_DESTINATION_DIR}/deployedTests
+DEFAULT_DESTINATION_TEST_RESULTS_DIR=${DEFAULT_DESTINATION_DIR}/testResults
+
+# C++ test variables
+DEFAULT_CPP_TEST_NAME=FRCUserProgram
+DEFAULT_CPP_TEST_ARGS="--gtest_color=yes"
+DEFAULT_LOCAL_CPP_TEST_FILE=../wpilibcIntegrationTests/build/exe/fRCUserProgram/FRCUserProgram
+
+CPP_REPORT=cppreport.xml
+DEFAULT_LOCAL_CPP_TEST_RESULT=${DEFAULT_LOCAL_TEST_RESULTS_DIR}/${CPP_REPORT}
+DEFAULT_DESTINATION_CPP_TEST_RESULTS=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/${CPP_REPORT}
+
+# Java test variables
+DEFAULT_JAVA_TEST_NAME=FRCUserProgram.jar
+DEFAULT_JAVA_TEST_ARGS=""
+
+DEFAULT_LOCAL_JAVA_TEST_FILE=../wpilibjIntegrationTests/build/libs/wpilibjIntegrationTests-all.jar
+
+JAVA_REPORT=javareport.xml
+DEFAULT_LIBRARY_NATIVE_FILES=../wpilibjIntegrationTests/build/nativelibraries
+DEFAULT_LIBRARY_NATIVE_DESTINATION=/usr/local/frc/lib
+DEFAULT_LOCAL_JAVA_TEST_RESULT=${DEFAULT_LOCAL_TEST_RESULTS_DIR}/${JAVA_REPORT}
+DEFAULT_DESTINATION_JAVA_TEST_RESULTS=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/AntReports/TEST-edu.wpi.first.wpilibj.test.TestSuite.xml
diff --git a/test-scripts/deploy-and-run-test-on-robot.sh b/test-scripts/deploy-and-run-test-on-robot.sh
new file mode 100755
index 0000000..a4232e6
--- /dev/null
+++ b/test-scripts/deploy-and-run-test-on-robot.sh
@@ -0,0 +1,96 @@
+#!/usr/bin/env bash
+#*----------------------------------------------------------------------------*#
+#* Copyright (c) FIRST 2014. All Rights Reserved. *#
+#* Open Source Software - may be modified and shared by FRC teams. The code *#
+#* must be accompanied by the FIRST BSD license file in the root directory of *#
+#* the project. *#
+#*----------------------------------------------------------------------------*#
+
+# Configurable variables
+source config.sh
+
+# Java variables
+DEFAULT_DESTINATION_JAVA_TEST_FILE=${DEFAULT_TEST_SCP_DIR}/${DEFAULT_JAVA_TEST_NAME}
+
+# C++ Variables
+DEFAULT_DESTINATION_CPP_TEST_FILE=${DEFAULT_TEST_SCP_DIR}/${DEFAULT_CPP_TEST_NAME}
+
+DEFAULT_DESTINATION_RUN_TEST_SCRIPT=${DEFAULT_DESTINATION_DIR}/${DEFAULT_LOCAL_RUN_TEST_SCRIPT}
+
+usage="$(basename "$0") [-h] (java|cpp) [-m] [-A] [arg] [arg]...
+A script designed to run the integration tests.
+This script should only be run on the roborio.
+Where:
+ -h Show this help text.
+ -m The driver station mutex will be handled manually.
+ -A Disable language recomended arguments.
+ arg Additional arguments to be passed to test."
+
+
+# These variables are set when the language is selected
+LANGUAGE=none
+LOCAL_TEST_FILE=none
+DESTINATION_TEST_FILE=none
+LIBRARY_FILES=none
+TEST_RUN_ARGS=""
+
+# Begin searching for options from the third paramater on
+PARAM_ARGS=${@:2}
+
+if [[ "$1" = java ]]; then
+ LANGUAGE=$1
+ LOCAL_TEST_FILE=$DEFAULT_LOCAL_JAVA_TEST_FILE
+ DESTINATION_TEST_FILE=$DEFAULT_DESTINATION_JAVA_TEST_FILE
+elif [[ "$1" = cpp ]]; then
+ LANGUAGE=$1
+ LOCAL_TEST_FILE=$DEFAULT_LOCAL_CPP_TEST_FILE
+ DESTINATION_TEST_FILE=$DEFAULT_DESTINATION_CPP_TEST_FILE
+elif [[ "$1" = "-h" ]]; then
+ printf "Usage:\n"
+ echo "$usage"
+ exit
+else
+ printf "Invalid language selection: %s\n\n" "$1" >&2
+ echo "$usage" >&2
+ exit 1
+fi
+
+# Check if the test file to upload exists
+if [[ ! -e ${LOCAL_TEST_FILE} ]]; then
+ printf "The test file does not exist: %s\nAre you sure that you compiled the tests??\n\n" "${LOCAL_TEST_FILE}" >&2
+ echo "$usage" >&2
+ exit 1
+fi
+
+MUTEX_OVERRIDE_PARAM_TEXT=""
+if [[ "$2" = "-m" ]]; then
+ MUTEX_OVERRIDE_PARAM_TEXT="-m "
+ TEST_RUN_ARGS="${@:3}"
+else
+ TEST_RUN_ARGS="${@:2}"
+fi
+
+shopt -s huponexit
+
+SCP_TEST_SCRIPT="scp config.sh ${DEFAULT_LOCAL_RUN_TEST_SCRIPT} ${ROBOT_ADDRESS}:/${DEFAULT_DESTINATION_DIR}"
+SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR="ssh -t ${ROBOT_ADDRESS} \"chmod a+x ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT}; mkdir ${DEFAULT_TEST_SCP_DIR}; touch ${DESTINATION_TEST_FILE}\""
+SCP_TEST_PROGRAM="scp ${LOCAL_TEST_FILE} ${ROBOT_ADDRESS}:${DESTINATION_TEST_FILE}"
+SSH_RUN_TESTS="ssh -t ${ROBOT_ADDRESS} ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT} ${LANGUAGE} $(whoami) ${MUTEX_OVERRIDE_PARAM_TEXT}-d ${DEFAULT_TEST_SCP_DIR} ${TEST_RUN_ARGS}"
+SCP_NATIVE_LIBRARIES="scp ${DEFAULT_LIBRARY_NATIVE_FILES}/* ${ROBOT_ADDRESS}:${DEFAULT_LIBRARY_NATIVE_DESTINATION}"
+CONFIG_NATIVE_LIBRARIES="ssh -t ${ADMIN_ROBOT_ADDRESS} ldconfig"
+
+if [ $(which sshpass) ]; then
+ sshpass -p "" ${SCP_NATIVE_LIBRARIES}
+ sshpass -p "" ${CONFIG_NATIVE_LIBRARIES}
+ sshpass -p "" ${SCP_TEST_SCRIPT}
+ sshpass -p "" ${SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR}
+ sshpass -p "" ${SCP_TEST_PROGRAM}
+ sshpass -p "" ${SSH_RUN_TESTS}
+else
+ eval ${SCP_NATIVE_LIBRARIES}
+ eval ${CONFIG_NATIVE_LIBRARIES}
+ eval ${SCP_TEST_SCRIPT}
+ eval ${SSH_CHMOD_AND_MAKE_TEMP_TEST_DIR}
+ eval ${SCP_TEST_PROGRAM}
+ eval ${SSH_RUN_TESTS}
+fi
diff --git a/test-scripts/jenkins-run-tests-get-results.sh b/test-scripts/jenkins-run-tests-get-results.sh
new file mode 100755
index 0000000..71b4945
--- /dev/null
+++ b/test-scripts/jenkins-run-tests-get-results.sh
@@ -0,0 +1,91 @@
+#!/usr/bin/env bash
+#*----------------------------------------------------------------------------*#
+#* Copyright (c) FIRST 2014. All Rights Reserved. *#
+#* Open Source Software - may be modified and shared by FRC teams. The code *#
+#* must be accompanied by the FIRST BSD license file in the root directory of *#
+#* the project. *#
+#*----------------------------------------------------------------------------*#
+
+# Configurable variables
+source config.sh
+
+# Setup the mutex release before we grab it
+mutexTaken=false
+# This function should run even if the script exits abnormally
+function finish {
+ if [ "$mutexTaken" == true ]; then
+ SSH_GIVE_MUTEX="ssh -t ${ROBOT_ADDRESS} /usr/local/frc/bin/teststand give --name=$(whoami)"
+ if [ $(which sshpass) ]; then
+ sshpass -p "" ${SSH_GIVE_MUTEX}
+ else
+ printf "WARNING!!! THIS IS HOW THE MUTEX IS RELEASED!\nIF YOU CHOOSE TO 'ctr+c' NOW YOU WILL HAVE TO HAND BACK THE MUTEX MANUALLY ON THE ROBOT.\n"
+ eval ${SSH_GIVE_MUTEX}
+ fi
+ mutexTaken=false
+ fi
+}
+trap finish EXIT SIGINT
+
+
+
+# Take the mutex from the driver station
+mutexTaken=true
+SSH_TAKE_MUTEX="ssh -t ${ROBOT_ADDRESS} /usr/local/frc/bin/teststand take --name=$(whoami)"
+if [ $(which sshpass) ]; then
+ sshpass -p "" ${SSH_TAKE_MUTEX}
+else
+ eval ${SSH_TAKE_MUTEX}
+fi
+
+# If there are already test results in the repository then remove them
+if [[ -e ${DEFAULT_LOCAL_TEST_RESULTS_DIR} ]]; then
+ rm -R ${DEFAULT_LOCAL_TEST_RESULTS_DIR}
+fi
+
+# Make the directory where the tests should live
+mkdir ${DEFAULT_LOCAL_TEST_RESULTS_DIR} 2>/dev/null
+
+# Remove the preivous test results from the the robot
+SSH_REMOVE_OLD_TEST_RESULTS="ssh -t ${ROBOT_ADDRESS} rm -R ${DEFAULT_DESTINATION_TEST_RESULTS_DIR}; mkdir ${DEFAULT_DESTINATION_TEST_RESULTS_DIR}"
+if [ $(which sshpass) ]; then
+ sshpass -p "" ${SSH_REMOVE_OLD_TEST_RESULTS}
+else
+ eval ${SSH_REMOVE_OLD_TEST_RESULTS}
+fi
+
+printf "Running cpp test\n"
+
+# Run the C++ Tests
+./deploy-and-run-test-on-robot.sh cpp -m -A "--gtest_output=xml:${DEFAULT_DESTINATION_CPP_TEST_RESULTS}"
+
+# Retrive the C++ Test Results
+SCP_GET_CPP_TEST_RESULT="scp ${ROBOT_ADDRESS}:${DEFAULT_DESTINATION_CPP_TEST_RESULTS} ${DEFAULT_LOCAL_CPP_TEST_RESULT}"
+if [ $(which sshpass) ]; then
+ sshpass -p "" ${SCP_GET_CPP_TEST_RESULT}
+else
+ eval ${SCP_GET_CPP_TEST_RESULT}
+fi
+
+# Run the Java Tests
+./deploy-and-run-test-on-robot.sh java -m
+
+# Retrive the Java Test Results
+SCP_GET_JAVA_TEST_RESULT="scp ${ROBOT_ADDRESS}:${DEFAULT_DESTINATION_JAVA_TEST_RESULTS} ${DEFAULT_LOCAL_JAVA_TEST_RESULT}"
+if [ $(which sshpass) ]; then
+ sshpass -p "" ${SCP_GET_JAVA_TEST_RESULT}
+else
+ eval ${SCP_GET_JAVA_TEST_RESULT}
+fi
+
+# Make sure that we got test results back.
+if [ ! -e ${DEFAULT_LOCAL_CPP_TEST_RESULT} ]; then
+ echo "There are no results from the C++ tests; they must have failed."
+ exit 100
+fi
+
+if [ ! -e ${DEFAULT_LOCAL_JAVA_TEST_RESULT} ]; then
+ echo "There are no results from the Java tests; they must have failed."
+ exit 101
+fi
+
+# The mutex is released when this program exits
diff --git a/test-scripts/run-tests-on-robot.sh b/test-scripts/run-tests-on-robot.sh
new file mode 100755
index 0000000..4785dd5
--- /dev/null
+++ b/test-scripts/run-tests-on-robot.sh
@@ -0,0 +1,200 @@
+#!/usr/bin/env bash
+#*----------------------------------------------------------------------------*#
+#* Copyright (c) FIRST 2014. All Rights Reserved. *#
+#* Open Source Software - may be modified and shared by FRC teams. The code *#
+#* must be accompanied by the FIRST BSD license file in the root directory of *#
+#* the project. *#
+#*----------------------------------------------------------------------------*#
+
+# This file is intended to be run in the DEFAULT_TEST_DIR on the roboRIO.
+# Do not attempt to run this file on your local system.
+# There is one file (delploy-and-run-test-on-robot.sh) that is designed to
+# deploy this file allong with the compiled tests for you.
+
+# Configurable variables
+source config.sh
+
+DEFAULT_TEST_DIR=${DEFAULT_DESTINATION_DIR}
+DEFAULT_PATH_TO_JRE=/usr/local/frc/JRE/bin/java
+
+usage="$(basename "$0") [-h] (java|cpp) name [-d test_dir] [-m] [-A] [arg] [arg]...
+A script designed to run the integration tests.
+This script should only be run on the roborio.
+Where:
+ -h Show this help text
+ name The name of the user trying to run the tests (used for driver station)
+ -d The directory where the tests have been placed.
+ This is done to prevent overwriting an already running program
+ in the case where another user already has the driver station mutex.
+ This scrip will automatically move the test into the ${DEFAULT_TEST_DIR}
+ directory when the driver station mutex is released.
+ Default: Assumes the test is in the same directory as this scrip.
+ -m The driver station mutex will be handled manually.
+ -A Do not use the default arguments for the given language.
+ arg The arguments to be passed to test."
+
+mutexTaken=false
+driverStationEnabled=false
+# This function should run even if the script exits abnormally
+function finish {
+ if [ "$driverStationEnabled" == true ]; then
+ /usr/local/frc/bin/teststand ds --name="${NAME}" disable
+ driverStationEnabled=false
+ fi
+ if [ "$mutexTaken" == true ]; then
+ /usr/local/frc/bin/teststand give --name="${NAME}"
+ mutexTaken=false
+ fi
+}
+trap finish EXIT SIGINT
+
+# This function should be run asynchronysly to enable the tests 10
+# seconds after they have been run.
+function enableIn10Seconds {
+ /usr/local/frc/bin/teststand ds --name="${NAME}" disable
+ driverStationEnabled=true
+ sleep 10
+ /usr/local/frc/bin/teststand ds --name="${NAME}" enable
+}
+
+# Are you trying to run this program on a platform other than the roboRIO?
+if [[ ! -e "${DEFAULT_TEST_DIR}" ]]; then
+ printf "Failed to find %s\nAre you trying to run this file on your local computer?\n" "${DEFAULT_TEST_DIR}"
+ printf "This script should only be run on the roboRIO.\n\n"
+ echo "$usage"
+ exit 1
+fi
+
+LANGUAGE=none
+TEST_FILE=none
+NAME=$2
+TEST_DIR="$DEFAULT_TEST_DIR"
+# Begin searching for options from the third paramater on
+PARAM_ARGS=${@:3}
+# Where the test arguments start
+TEST_RUN_ARGS=${@:3}
+RUN_WITH_DEFAULT_ARGS=true
+DEFAULT_ARGS=""
+MUTEX_OVERRIDE=false
+
+# Determine the language that we are attempting to run
+if [[ "$1" = java ]]; then
+ LANGUAGE=$1
+ TEST_FILE=$DEFAULT_JAVA_TEST_NAME
+ DEFAULT_ARGS=$DEFAULT_JAVA_TEST_ARGS
+elif [[ "$1" = cpp ]]; then
+ LANGUAGE=$1
+ TEST_FILE=$DEFAULT_CPP_TEST_NAME
+ DEFAULT_ARGS=$DEFAULT_CPP_TEST_ARGS
+elif [[ "$1" = "-h" ]]; then
+ #If the first argument is the help option
+ #Allow it to be searhced for in getopts
+ PARAM_ARGS=${@}
+else
+ printf "Invalid language selection: %s\n\n" "$1" >&2
+ echo "$usage" >&2
+ exit 1
+fi
+
+PARAM_COUNTER=2
+printf "Param Args ${PARAM_ARGS}\n"
+
+# Check for optional paramaters
+while getopts ':hmd:A' option $PARAM_ARGS ; do
+ case "$option" in
+ h)
+ # Print the help message
+ printf "Usage:\n"
+ echo "$usage"
+ exit
+ ;;
+ A)
+ # Remove the default arguments
+ RUN_WITH_DEFAULT_ARGS=false
+ PARAM_COUNTER=$[$PARAM_COUNTER +1]
+ ;;
+ m)
+ MUTEX_OVERRIDE=true
+ PARAM_COUNTER=$[$PARAM_COUNTER +1]
+ ;;
+ d)
+ TEST_DIR=$OPTARG
+ # Since we are selecting the directory the run args start from the 5th argument
+ PARAM_COUNTER=$[$PARAM_COUNTER +2]
+ ;;
+ ?)
+ # When an unknown param is found then we are done so break
+ break
+ ;;
+ esac
+done
+
+TEST_RUN_ARGS=${@:$[$PARAM_COUNTER +1]}
+
+if [[ "$RUN_WITH_DEFAULT_ARGS" == true ]]; then
+ TEST_RUN_ARGS="${DEFAULT_ARGS} ${TEST_RUN_ARGS}"
+fi
+
+# Make sure at least two paramaters are passed or four if running with -d option
+if [[ $# -lt $PARAM_COUNTER ]]; then
+ printf "Invalid arg count. Should be %s, was %s.\n" "${PARAM_COUNTER}" "$#"
+ echo "$usage"
+ exit 1
+fi
+
+# If the mutex has been retrived a higher level in the tree
+if [ "$MUTEX_OVERRIDE" == false ]; then
+ # Attempt to take the mutex for the driver station
+ mutexTaken=true
+ /usr/local/frc/bin/teststand take --name="${NAME}"
+else
+ printf "Override driver station control enabled.\n"
+fi
+
+# Kill all running robot programs
+killall java FRCUserProgram
+
+# Once we have the mutex no other tests are running
+# If we are running with the -d argument move the test to the DEFAULT_TEST_DIR
+if [[ ! -e "${TEST_DIR}/${TEST_FILE}" ]]; then
+ printf "Failed to find %s.\nDid you copy the test file correctly?\n" "${TEST_DIR}/${TEST_FILE}"
+ echo "$usage"
+ exit 1
+elif [[ $TEST_DIR != "$DEFAULT_TEST_DIR" ]]; then
+ mv "${TEST_DIR}/${TEST_FILE}" "${DEFAULT_TEST_DIR}"
+fi
+
+# Make sure the excecutable file has permission to run
+
+# Setup the driver station to enable automatically in 10 seconds without waiting for the function to excecute.
+enableIn10Seconds&
+
+# Get the serial number and FPGADeviceCode for this rio
+export serialnum=`/sbin/fw_printenv -n serial#`
+export eval `/sbin/fw_printenv DeviceCode FPGADeviceCode DeviceDesc TargetClass`
+
+# Store the run command for the language
+RUN_COMMAND=none
+if [[ ${LANGUAGE} = java ]]; then
+ chmod a+x ${DEFAULT_JAVA_TEST_NAME}
+ RUN_COMMAND="env LD_LIBRARY_PATH=/opt/GenICam_v3_0_NI/bin/Linux32_ARM/:/usr/local/frc/lib ${DEFAULT_PATH_TO_JRE} -ea -jar ${DEFAULT_JAVA_TEST_NAME} ${TEST_RUN_ARGS}"
+elif [[ ${LANGUAGE} = cpp ]]; then
+ chmod a+x ${DEFAULT_CPP_TEST_NAME}
+ RUN_COMMAND="./${DEFAULT_CPP_TEST_NAME} ${TEST_RUN_ARGS}"
+fi
+
+printf "Running: %s\n\n" "${RUN_COMMAND}"
+COREDUMP_DIR=${DEFAULT_DESTINATION_TEST_RESULTS_DIR}/coredump
+mkdir -p ${COREDUMP_DIR}
+CORE_LOCATION=${COREDUMP_DIR}/core
+echo ${CORE_LOCATION} > /proc/sys/kernel/core_pattern
+ulimit -c unlimited
+eval ${RUN_COMMAND}
+if [[ $? -gt 127 && -e ${CORE_LOCATION} ]]; then
+ mv ${CORE_LOCATION} ${COREDUMP_DIR}/core.${LANGUAGE}
+ if [[ ${LANGUAGE} = java ]]; then
+ cp -p ${DEFAULT_JAVA_TEST_NAME} ${COREDUMP_DIR}/
+ elif [[ ${LANGUAGE} = cpp ]]; then
+ cp -p ${DEFAULT_CPP_TEST_NAME} ${COREDUMP_DIR}/
+ fi
+fi
diff --git a/test-scripts/spawn_driver_station.sh b/test-scripts/spawn_driver_station.sh
new file mode 100755
index 0000000..d41b41d
--- /dev/null
+++ b/test-scripts/spawn_driver_station.sh
@@ -0,0 +1,43 @@
+#!/usr/bin/env bash
+#*----------------------------------------------------------------------------*#
+#* Copyright (c) FIRST 2014. All Rights Reserved. *#
+#* Open Source Software - may be modified and shared by FRC teams. The code *#
+#* must be accompanied by the FIRST BSD license file in the root directory of *#
+#* the project. *#
+#*----------------------------------------------------------------------------*#
+
+source config.sh
+
+TESTSTAND_SERVE_COMMAND="/usr/local/frc/bin/teststand serve"
+
+#Checks to see if the mutex driver station is running. If it isn't then start it.
+
+SSH_CHECK_FOR_TESTSTAND="ssh -qn ${ADMIN_ROBOT_ADDRESS} 'pidof ${TESTSTAND_SERVE_COMMAND}' &>/dev/null"
+
+TESTSTAND_SERVE_COMMAND="nohup ${TESTSTAND_SERVE_COMMAND} > /dev/null 2>&1 < /dev/null &"
+
+if [ $(which sshpass) ]; then
+ SSH_CHECK_FOR_TESTSTAND="sshpass -p '' ${SSH_CHECK_FOR_TESTSTAND}"
+fi
+
+echo $SSH_CHECK_FOR_TESTSTAND
+
+if $(eval $SSH_CHECK_FOR_TESTSTAND); then
+ echo "Driver Station is already running";
+ exit 0;
+fi
+
+echo "Starting Driver Station";
+
+function startDS {
+ SSH_START_TESTSTAND_DRIVER_STATION="ssh ${ADMIN_ROBOT_ADDRESS} ${TESTSTAND_SERVE_COMMAND}"
+ if [ $(which sshpass) ]; then
+ sshpass -p "" ${SSH_START_TESTSTAND_DRIVER_STATION}
+ else
+ eval ${SSH_START_TESTSTAND_DRIVER_STATION}
+ fi
+}
+
+startDS&
+
+sleep 1