finished converting the build scripts over (!!)
diff --git a/aos/build/build.py b/aos/build/build.py
index ac316ce..dd93026 100755
--- a/aos/build/build.py
+++ b/aos/build/build.py
@@ -67,6 +67,7 @@
def compiler(self):
return 'gcc'
+ # TODO(brians): test this
def deploy(self, dry_run):
self.do_deploy(dry_run,
('ncftpput', get_ip('robot'), '/',
@@ -119,6 +120,7 @@
def outname(self):
return str(self)
+ # TODO(brians): test this
def deploy(self, dry_run):
"""Downloads code to the prime in a way that avoids clashing too badly with starter
"""
@@ -273,6 +275,12 @@
help="don't actually download anything",
action='store_true')
+ tests_parser = subparsers.add_parser(
+ 'tests',
+ help='run tests')
+ AddCommonArgs(tests_parser)
+ AddBuildArgs(tests_parser)
+
return parser.parse_args(args)
try:
@@ -354,7 +362,7 @@
return True
else:
raise e
- pattern = re.compile('.*\.gyp[i]$')
+ pattern = re.compile('.*\.gypi?$')
for dirname, _, files in os.walk(os.path.join(aos_path(), '..')):
for f in [f for f in files if pattern.match(f)]:
if (os.stat(os.path.join(dirname, f)).st_mtime > build_mtime):
@@ -419,8 +427,13 @@
if args.action_name == 'deploy':
platform.deploy(args.dry_run)
+ elif args.action_name == 'tests':
+ dirname = os.path.join(platform.outdir(), 'tests')
+ for f in targets or os.listdir(dirname):
+ print('Running test %s...' % f, file=sys.stderr)
+ subprocess.check_call(os.path.join(dirname, f))
+ print('Test %s succeeded' % f, file=sys.stderr)
- # TODO(brians): tests
print('Done building %s...' % platform, file=sys.stderr)
if __name__ == '__main__':
diff --git a/aos/build/build.sh b/aos/build/build.sh
deleted file mode 100755
index d775105..0000000
--- a/aos/build/build.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-#!/bin/bash
-#set -x
-
-set -e
-
-# This file should be called to build the code.
-# Usage: build.sh platform main_file.gyp debug [action]...
-
-PLATFORM=$1
-GYP_MAIN=$2
-DEBUG=$3
-OUT_NAME=$4
-ACTION=$5
-
-shift 4
-shift || true # We might not have a 5th argument if ACTION is empty.
-
-export WIND_BASE=${WIND_BASE:-"/usr/local/powerpc-wrs-vxworks/wind_base"}
-
-#[ "${PLATFORM}" == "crio" -o "${PLATFORM}" == "linux" -o "${PLATFORM}" == "linux-amd64" ] || ( echo Platform "(${PLATFORM})" must be '"crio", "linux", or "linux-amd64"'. ; exit 1 )
-[ "${DEBUG}" == "yes" -o "${DEBUG}" == "no" ] || ( echo Debug "(${DEBUG})" must be '"yes" or "no"'. ; exit 1 )
-
-AOS=`dirname $0`/..
-
-OUTDIR=${AOS}/../output/${OUT_NAME}
-BUILD_NINJA=${OUTDIR}/build.ninja
-
-${AOS}/build/download_externals.sh arm
-${AOS}/build/download_externals.sh amd64
-. $(dirname $0)/tools_config
-
-if [[ "${ACTION}" != "clean" && ( ! -d ${OUTDIR} || -n \
- "`find ${AOS}/.. -newer ${BUILD_NINJA} \( -name '*.gyp' -or -name '*.gypi' \)`" ) ]]; then
- echo 'Running gyp...' 1>&2
- # This is a gyp "file" that we pipe into gyp so that it will put the output
- # in a directory named what we want where we want it.
- GYP_INCLUDE=$(cat <<END
-{
- 'target_defaults': {
- 'configurations': {
- '${OUT_NAME}': {}
- }
- }
-}
-END
-)
- echo "${GYP_INCLUDE}" | ${GYP} \
- --check --depth=${AOS}/.. --no-circular-check -f ninja \
- -I${AOS}/build/aos.gypi -I/dev/stdin -Goutput_dir=output \
- -DOS=$(echo ${PLATFORM} | sed 's/-.*//g') -DPLATFORM=${PLATFORM} \
- -DWIND_BASE=${WIND_BASE} -DDEBUG=${DEBUG} \
- ${GYP_MAIN}
- if [ ${PLATFORM} == crio ]; then
- sed -i 's/nm -gD/nm/g' ${BUILD_NINJA}
- fi
- echo 'Done running gyp.' 1>&2
-fi
-
-if [ "${ACTION}" == "clean" ]; then
- rm -r ${OUTDIR} || true
-else
- if [ "${ACTION}" != "deploy" -a "${ACTION}" != "tests" ]; then
- NINJA_ACTION=${ACTION}
- else
- NINJA_ACTION=
- fi
- ${NINJA} -C ${OUTDIR} ${NINJA_ACTION} "$@"
- if [[ ${ACTION} == deploy ]]; then
- [[ ${PLATFORM} == linux ]] && ${AOS}/build/deploy.sh ${OUTDIR}/outputs
- [ ${PLATFORM} == crio ] && \
- ncftpput `${AOS}/build/get_ip robot` / \
- ${OUTDIR}/lib/FRC_UserProgram.out
- fi
- if [[ ${ACTION} == tests ]]; then
- find ${OUTDIR}/tests -executable -exec ${AOS}/build/run_test.sh {} \;
- fi
-fi
diff --git a/aos/build/deploy.sh b/aos/build/deploy.sh
deleted file mode 100755
index 3efdb55..0000000
--- a/aos/build/deploy.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-#set -x
-
-# Downloads code to the prime in a way that avoids clashing too badly with
-# starter.
-# Requires 1 argument (the directory to download).
-
-GET_IP=$(dirname $0)/get_ip
-SUM=md5sum
-FROM_DIR=$1
-TO_DIR=/home/driver/robot_code/bin
-TMPDIR=/tmp/aos_downloader
-TARGET=driver@$(${GET_IP} prime)
-
-SUMS=$(cd ${FROM_DIR} && ${SUM} *)
-
-TO_DOWNLOAD=$(ssh ${TARGET} "rm -rf ${TMPDIR} && mkdir ${TMPDIR} && cd ${TO_DIR} && echo '${SUMS}' | ${SUM} --check --quiet |& grep -F FAILED | sed 's/^\\(.*\\): FAILED.*"'$'"/\\1/g'")
-if [[ $? != 0 ]]; then
- echo 'Connecting to target failed.'
- exit 1
-fi
-
-if [[ -z "${TO_DOWNLOAD}" ]]; then
- echo "Nothing to download"
- exit 0
-fi
-
-# Compression seems to make it go faster even when the network isn't the
-# bottleneck with a BBB. Maybe it's because ethernet on the BBB uses so much
-# CPU?
-( cd ${FROM_DIR} && scp -o "Compression yes" ${TO_DOWNLOAD} ${TARGET}:${TMPDIR} )
-if [[ $? != 0 ]]; then
- echo 'Copying files into /tmp on target failed.'
- exit 1
-fi
-ssh ${TARGET} "mv ${TMPDIR}/* ${TO_DIR} && echo 'Done moving new executables into place' && ionice -c 3 bash -c 'sync && sync && sync'"
-exit $?
diff --git a/aos/build/get_ip b/aos/build/get_ip
deleted file mode 100755
index d798884..0000000
--- a/aos/build/get_ip
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-# This script provides a central location for getting IP addresses. It uses
-# output/ip_base.txt as the first 3 parts and then adds on whatever is
-# correct for its first argument (prime or robot).
-# It will create output/ip_base.txt with a default value if it does not already
-# exist.
-
-FILE=`dirname $0`/../../output/ip_base.txt
-
-if [[ ! -e ${FILE} ]]; then
- mkdir -p `dirname ${FILE}`
- echo '10.9.71' > ${FILE}
-fi
-
-BASE=`cat ${FILE}`
-
-case $1 in
- prime)
- # This is the IP address that we use for the prime.
- echo ${BASE}.179 ;;
- robot)
- # This is the IP address that the cRIO has to be on.
- echo ${BASE}.2 ;;
- *)
- echo "Unknown IP address $1. Returning ${BASE}.0 instead." 1>&2
- echo ${BASE}.0
-esac
diff --git a/aos/build/run_test.sh b/aos/build/run_test.sh
deleted file mode 100755
index 9da830b..0000000
--- a/aos/build/run_test.sh
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/bash
-
-# This gets called by build.sh to run a test.
-
-EXECUTABLE=$1
-
-echo "Running $(basename ${EXECUTABLE})."
-${EXECUTABLE}
-exit $?