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 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467
|
#! /usr/bin/env bash
set -e -u
# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
# SPDX-FileCopyrightText: Bradley M. Bell <bradbell@seanet.com>
# SPDX-FileContributor: 2003-25 Bradley M. Bell
# ----------------------------------------------------------------------------
#
if [ "$0" != 'bin/check_all.sh' ]
then
echo "bin/check_all.sh: must be executed from its parent directory"
exit 1
fi
if [ $# == 1 ]
then
if [ "$1" == --help ]
then
cat << EOF
bin/check_all.sh flags
possible flags
--mixed mix debug and release compiles
--debug only compile for debugging
--release only compile for release
--verbose_make generate verbose makefiles
--skip_external_links do not check documentation external links
--skip_check_copy do not check copyright messages
--suppress_spell_warnings do not check for documentation spelling errors
EOF
exit 0
fi
fi
#
# build_type, verbose_make, skip_external_links, suppress_spell_warnings
build_type='mixed'
verbose_make='no'
skip_external_links='no'
skip_check_copy='no'
suppress_spell_warnings='no'
while [ $# != 0 ]
do
case "$1" in
--mixed)
build_type=mixed
;;
--debug)
build_type=debug
;;
--release)
build_type=release
;;
--verbose_make)
verbose_make='yes'
;;
--skip_external_links)
skip_external_links='yes'
;;
--skip_check_copy)
skip_check_copy='yes'
;;
--suppress_spell_warnings)
suppress_spell_warnings='yes'
;;
*)
echo "bin/check_all.sh: command line argument "$1" is not valid"
exit 1
;;
esac
#
shift
done
#
# grep and sed
source bin/grep_and_sed.sh
#
# LD_LIBRARY_PATH
# all linking of dynamic libraries should use rpath
export LD_LIBRARY_PATH=''
#
# top_srcdir
top_srcdir=`pwd`
echo "top_srcdir = $top_srcdir"
#
# echo_eval
echo_eval() {
echo $*
eval $*
}
#
# echo_log_eval
echo_log_eval() {
echo "$* >& check_all.tmp"
echo "$*" > $top_srcdir/check_all.tmp
if ! $* >& $top_srcdir/check_all.tmp
then
tail $top_srcdir/check_all.tmp
echo 'Error: see check_all.tmp'
exit 1
fi
# 1. If we don't have c++17 and mkstemp, then temp_file is not thread safe.
#
# 2. If using g++ -O3 -DNDEBUG -Wall,
# an improper compile time warning is generated at:
# forward.hpp:187, reverse.hpp:151, independent.hpp:100-109,
# base_alloc.hpp:143, abs_min_quad.hpp:424 .
#
# warning
warning='no'
if [ "$compiler" == '--clang' ]
then
if $sed $top_srcdir/check_all.tmp \
-e '/temp_file.cpp:.*warning.*tmpnam/d' \
| $grep ': *warning *:'
then
warning='yes'
fi
else
if $sed $top_srcdir/check_all.tmp \
-e '/temp_file.cpp:.*warning.*tmpnam/d' \
-e '/forward.hpp:187:.*warning.*outside array bounds/d' \
-e '/reverse.hpp:151:.*warning.*outside array bounds/d' \
-e '/independent.hpp:10[0-9]:.*warning.*outside array bounds/d' \
-e '/base_alloc.hpp:143:.*warning.*may be used uninitialized/d' \
-e '/abs_min_quad.hpp:424:.*bound.*exceeds maximum/d' \
| $grep ': *warning *:'
then
warning='yes'
fi
fi
if [ "$warning" == 'yes' ]
then
echo "The warnings above happened during the command: $*"
echo "see the file $top_srcdir/check_all.tmp"
exit 1
fi
#
# check_all.log
echo ' cat check_all.tmp >> check_all.log'
cat $top_srcdir/check_all.tmp >> $top_srcdir/check_all.log
}
#
# random_01
random_01() {
set +e
eval random_01_$1="`expr $RANDOM % 2`"
eval echo "random_01_$1=\$random_01_$1"
set -e
}
#
# check_all.log
# start new check_all.log
echo "date > check_all.log"
date | $sed -e 's|^|date: |' > check_all.log
#
# $HOME/prefix/cppad
if [ -e "$HOME/prefix/cppad" ]
then
echo_log_eval rm -r $HOME/prefix/cppad
fi
#
# version
version=$(
$sed -n -e '/^SET( *cppad_version *"[0-9.]*")/p' CMakeLists.txt | \
$sed -e 's|.*"\([^"]*\)".*|\1|'
)
#
# compiler
random_01 compiler
if [ "$random_01_compiler" == '0' ]
then
compiler='default'
else
compiler='--clang'
fi
#
# standard
random_01 standard
if [ "$random_01_standard" == '0' ]
then
random_01 standard
if [ "$random_01_standard" == '0' ]
then
standard='--c++11'
else
standard='--c++17'
fi
else
standard='--c++17'
fi
#
# use_configure
random_01 use_configure
if [ "$random_01_use_configure" == '0' ]
then
random_01 use_configure
if [ "$random_01_use_configure" == '0' ]
then
use_configure='yes'
else
use_configure='no'
fi
else
use_configure='no'
fi
#
# package_vector, debug_which
if [ "$build_type" == 'debug' ]
then
package_vector='--cppad_vector'
debug_which='--debug_all'
elif [ "$build_type" == 'release' ]
then
package_vector='--cppad_vector'
debug_which='--debug_none'
else
if [ "$build_type" != 'mixed' ]
then
msg="build_type = $build_type not debug release or mixed"
echo "bin/check_all.sh $msg"
exit 1
fi
random_01 debug_which
if [ "$random_01_debug_which" == '0' ]
then
debug_which='--debug_even'
else
debug_which='--debug_odd'
fi
#
random_01 package_vector
if [ "$random_01_package_vector" == '0' ]
then
package_vector='--boost_vector'
else
if [ "$standard" == '--c++17' ]
then
package_vector='--eigen_vector'
else
package_vector='--std_vector'
fi
fi
fi
#
# debug_which
if [ "$use_configure" == 'yes' ]
then
debug_which='--debug_none'
fi
cat << EOF
tarball = cppad-$version.tgz
compiler = $compiler
standard = $standard
debug_which = $debug_which
package_vector = $package_vector
use_configure = $use_configure
verbose_make = $verbose_make
EOF
cat << EOF >> $top_srcdir/check_all.log
tarball = cppad-$version.tgz
compiler = $compiler
standard = $standard
debug_which = $debug_which
package_vector = $package_vector
use_configure = $use_configure
verbose_make = $verbose_make
EOF
#
# compiler
if [ "$compiler" == 'default' ]
then
compiler=''
fi
#
# standard, exclude_package
if [ "$standard" == '--c++17' ]
then
standard='' # default for run_cmake.sh and configure
exclude_package=''
else
exclude_package='--no_sacado'
fi
if [ "$(uname)" == 'Darwin' ]
then
exclude_package+=' --no_colpack'
fi
#
# prefix
# absolute prefix where optional packages are installed
eval `$grep '^prefix=' bin/get_optional.sh`
if [[ "$prefix" =~ ^[^/] ]]
then
prefix="$(pwd)/$prefix"
fi
if [ ! -d $prefix/include/cppad/cg ]
then
echo "Cannot find $prefix/include/cppad/cg"
echo 'Probably need to run bin/get_optional.sh'
exit 1
fi
#
# typos
if which typos >& /dev/null
then
if ! typos
then
echo 'check_all: see typos errors above'
exit 1
fi
fi
#
# check_version
if echo $version | $grep '[0-9]\{4\}0000[.]' > /dev/null
then
# special interactive case for stable versions.
echo_eval bin/check_version.sh
else
echo_log_eval bin/check_version.sh
fi
#
# bin/check_*.sh
# Run automated checks for the form bin/check_*.sh with a few exceptions.
list=$(
ls bin/check_* | $sed \
-e '/check_all.sh/d' \
-e '/check_doxygen.sh/d' \
-e '/check_install.sh/d' \
-e '/check_copy.sh/d' \
-e '/check_invisible/d'
)
#
echo_eval bin/check_invisible.sh
if [ "$skip_check_copy" == 'no' ]
then
echo_eval bin/check_copy.sh
fi
for check in $list
do
echo_log_eval $check
done
#
# run_xrst.sh
flags=''
if [ "$skip_external_links" == 'no' ]
then
flags+=' --external_links'
fi
if [ "$suppress_spell_warnings" == 'yes' ]
then
flags+=' --suppress_spell_warnings'
fi
bin/run_xrst.sh $flags
#
# build/cppad-$version.tgz
echo_log_eval bin/package.sh
#
# build/cppad-$version
echo_log_eval cd build
echo_log_eval tar -xzf cppad-$version.tgz
echo_log_eval cd cppad-$version
#
# build/cppad-$version/bin/get_optional.sh
$sed -i bin/get_optional.sh -e "s|^prefix=.*|prefix=$prefix|"
#
# builder
if [ "$use_configure" == 'yes' ]
then
builder='make'
elif [ "$verbose_make" == 'yes' ]
then
builder='make'
else
builder='ninja'
fi
#
# verbose_flag
if [ "$verbose_make" == 'yes' ]
then
verbose_flag='--verbose_make'
else
verbose_flag=''
fi
#
# configure or cmake
if [ "$use_configure" == 'yes' ]
then
echo_log_eval bin/run_configure.sh \
$verbose_flag \
$compiler \
$standard \
$package_vector
else
echo_log_eval bin/run_cmake.sh \
$verbose_flag \
$compiler \
$standard \
$debug_which \
$exclude_package \
$package_vector
fi
echo_log_eval cd build
#
# n_job
if which nproc >& /dev/null
then
n_job=$(nproc)
else
n_job=$(sysctl -n hw.ncpu)
fi
#
# build: check
echo_log_eval $builder -j $n_job check
#
# speed/cppad/speed_cppad
for option in onetape colpack optimize atomic memory boolsparsity
do
echo_eval speed/cppad/speed_cppad correct 432 $option
done
#
# speed/adolc/speed_adolc
echo_eval speed/adolc/speed_adolc correct 432 onetape
echo_eval speed/adolc/speed_adolc sparse_jacobian 432 onetape colpack
echo_eval speed/adolc/speed_adolc sparse_hessian 432 onetape colpack
#
# bin/test_multi_thread.sh
cd ..
bin/test_multi_thread.sh $builder
cd build
#
# print_for test
# redo this build in case it is commented out above
program='example/print_for/example_print_for'
echo_log_eval $builder -j $n_job example_print_for
echo_log_eval $program
$program | $sed -e '/^Test passes/,$d' > temp.1.$$
$program | $sed -e '1,/^Test passes/d' > temp.2.$$
if diff temp.1.$$ temp.2.$$
then
rm temp.1.$$ temp.2.$$
echo_log_eval echo "print_for: OK"
else
echo_log_eval echo "print_for: Error"
exit 1
fi
#
# bin/test_install.sh
echo_log_eval cd ..
if [ "$standard" == '' ]
then
echo_log_eval bin/test_install.sh $builder --c++17
else
echo_log_eval bin/test_install.sh $builder $standard
fi
#
#
echo "date >> check_all.log"
date | $sed -e 's|^|date: |' >> $top_srcdir/check_all.log
# ----------------------------------------------------------------------------
echo "$0: OK" >> $top_srcdir/check_all.log
echo "$0: OK"
exit 0
|