diff --git a/test-scripts/.gitattributes b/test-scripts/.gitattributes deleted file mode 100644 index cb5c1522d9f..00000000000 --- a/test-scripts/.gitattributes +++ /dev/null @@ -1,4 +0,0 @@ -# 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 deleted file mode 100644 index e877a7dbf5b..00000000000 --- a/test-scripts/README.md +++ /dev/null @@ -1,19 +0,0 @@ -# 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. - -If you deploy code to the test stand using GradleRIO, you _must_ remove the build artifacts in `/home/lvuser`, or you will break the test stand. - -## roboRIO Setup -The roboRIO on the test bench must be updated every time NI releases a new image. - -1. [Use the roboRIO Imaging Tool to format the roboRIO with the latest image.](https://frcdocs.wpi.edu/en/stable/docs/zero-to-robot/step-3/imaging-your-roborio.html) -2. Set a static ip on the roboRIO web dashboard to `10.1.90.2` -2. Install Java on the roboRIO - 1. [Download the JRE from Maven.](https://frcmaven.wpi.edu/artifactory/list/release/edu/wpi/first/jdk/) - 2. Transfer the JRE ipk to the roboRIO with scp: `scp admin@roboRIO-190-FRC.local:/tmp/frcjre.ipk` - 3. Install the JRE: `opkg install /tmp/frcjre.ipk` - 4. Remove the ipk file: `rm /tmp/frcjre.ipk` -3. Reboot the roboRIO diff --git a/test-scripts/config.sh b/test-scripts/config.sh deleted file mode 100755 index dce90314bd8..00000000000 --- a/test-scripts/config.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash -#*----------------------------------------------------------------------------*# -#* Copyright (c) 2014-2019 FIRST. 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 committed 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=../build/integrationTestFiles/cpp/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=../build/integrationTestFiles/java/wpilibjIntegrationTests-all.jar - -JAVA_REPORT=javareport.xml -DEFAULT_LIBRARY_NATIVE_FILES=../build/integrationTestFiles/libs -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 deleted file mode 100755 index 1caf045daa0..00000000000 --- a/test-scripts/deploy-and-run-test-on-robot.sh +++ /dev/null @@ -1,84 +0,0 @@ -#!/usr/bin/env bash -#*----------------------------------------------------------------------------*# -#* Copyright (c) 2014-2019 FIRST. 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) [-A] [arg] [arg]... -A script designed to run the integration tests. -This script should only be run on the computer connected to the roboRIO. -Where: - -h Show this help text. - -A Disable language recommended 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 -TEST_RUN_ARGS="" -DESTINATION_TEST_RESULTS=none -LOCAL_TEST_RESULTS=none - - -# Begin searching for options from the second parameter 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 - DESTINATION_TEST_RESULTS=$DEFAULT_DESTINATION_JAVA_TEST_RESULTS - LOCAL_TEST_RESULTS=$DEFAULT_LOCAL_JAVA_TEST_RESULT -elif [[ "$1" = cpp ]]; then - LANGUAGE=$1 - LOCAL_TEST_FILE=$DEFAULT_LOCAL_CPP_TEST_FILE - DESTINATION_TEST_FILE=$DEFAULT_DESTINATION_CPP_TEST_FILE - DESTINATION_TEST_RESULTS=$DEFAULT_DESTINATION_CPP_TEST_RESULTS - LOCAL_TEST_RESULTS=$DEFAULT_LOCAL_CPP_TEST_RESULT -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 - -TEST_RUN_ARGS="${@:2}" - -shopt -s huponexit - -# Fail if any command fails -set -e - -ssh ${ROBOT_ADDRESS} "rm -R ${DEFAULT_DESTINATION_TEST_RESULTS_DIR}; mkdir ${DEFAULT_DESTINATION_TEST_RESULTS_DIR}" -scp ${DEFAULT_LIBRARY_NATIVE_FILES}/* ${ROBOT_ADDRESS}:${DEFAULT_LIBRARY_NATIVE_DESTINATION} -ssh ${ADMIN_ROBOT_ADDRESS} ldconfig -scp config.sh ${DEFAULT_LOCAL_RUN_TEST_SCRIPT} ${ROBOT_ADDRESS}:/${DEFAULT_DESTINATION_DIR} -ssh ${ROBOT_ADDRESS} "chmod a+x ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT}; mkdir ${DEFAULT_TEST_SCP_DIR}; touch ${DESTINATION_TEST_FILE}" -scp ${LOCAL_TEST_FILE} ${ROBOT_ADDRESS}:${DESTINATION_TEST_FILE} -ssh ${ROBOT_ADDRESS} ${DEFAULT_DESTINATION_RUN_TEST_SCRIPT} ${LANGUAGE} -d ${DEFAULT_TEST_SCP_DIR} ${TEST_RUN_ARGS} -mkdir ${DEFAULT_LOCAL_TEST_RESULTS_DIR}; scp ${ROBOT_ADDRESS}:${DESTINATION_TEST_RESULTS} ${LOCAL_TEST_RESULTS} diff --git a/test-scripts/run-tests-on-robot.sh b/test-scripts/run-tests-on-robot.sh deleted file mode 100755 index 534eafd3a7c..00000000000 --- a/test-scripts/run-tests-on-robot.sh +++ /dev/null @@ -1,160 +0,0 @@ -#!/usr/bin/env bash -#*----------------------------------------------------------------------------*# -#* Copyright (c) 2014-2019 FIRST. 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 along with the compiled tests for you. - -set -e - -# 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) [-d test_dir] [-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 - -d The directory where the tests have been placed. - This is done to prevent overwriting an already running program. - This script will automatically move the test into the ${DEFAULT_TEST_DIR} - directory. - Default: Assumes the test is in the same directory as this script. - -A Do not use the default arguments for the given language. - arg The arguments to be passed to test." - - -# 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 -TEST_DIR="$DEFAULT_TEST_DIR" -# Begin searching for options from the second parameter on -PARAM_ARGS=${@:2} -# Where the test arguments start -TEST_RUN_ARGS=${@:2} -RUN_WITH_DEFAULT_ARGS=true -DEFAULT_ARGS="" - -# 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=1 -printf "Param Args ${PARAM_ARGS}\n" - -# Check for optional parameters -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] - ;; - 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 parameters 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 - -# Make sure the webserver is disabled to save memory -/usr/local/natinst/etc/init.d/systemWebServer stop - -# Kill all running robot programs -killall java FRCUserProgram || true - -# 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 executable file has permission to run - -# 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