1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
#! /bin/bash -e
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-22 Bradley M. Bell
# ----------------------------------------------------------------------------
if [ $0 != "bin/travis.sh" ]
then
echo 'bin/travis.sh: must be executed from its parent directory'
exit 1
fi
if [ "$1" != 'make' ] && [ "$1" != 'test_one' ]
then
echo 'usage: bin/travis.sh (make|test_one) target1 target2 ...'
echo 'target: if make specified, is one of the available make commands'
echo if test_one, specified, is the path to a test file.
exit 1
fi
cmd="$1"
# -----------------------------------------------------------------------------
# bash function that echos and executes a command
echo_eval() {
echo $*
eval $*
}
# -----------------------------------------------------------------------------
if [ -e 'build' ]
then
echo_eval rm -r build
fi
echo_eval mkdir build
echo_eval cd build
echo_eval cmake \
-D cppad_prefix=$(pwd)/prefix \
-D cppad_cxx_flags='-std=c++11' \
..
# -----------------------------------------------------------------------------
if [ "$cmd" == 'make' ]
then
shift
while [ "$1" != '' ]
do
echo_eval make "$1"
shift
done
else
echo_eval cd ..
shift
while [ "$1" != '' ]
do
echo_eval bin/test_one.sh "$1"
shift
done
fi
# -----------------------------------------------------------------------------
echo 'bin/travis.sh: OK'
exit 0
|