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 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612
|
#!/bin/bash
# Complete tests of PLplot for the three generic build types which
# consist of shared+dynamic, shared+nondynanic, and
# static+nondynamic. These complete tests that are run for each build
# type are (I) ctest, test_noninteractive, and test_interactive in
# build tree; (II) traditional [Makefile+pkg-config]
# test_noninteractive and test_interactive of installed examples; and
# (III) CMake-based test_noninteractive and test_interactive of
# installed examples.
comprehensive_test () {
CMAKE_BUILD_TYPE_OPTION=$1
echo "
Running comprehensive_test function with the following variables set:
The variables below are key CMake options which determine the entire
kind of build that will be tested.
CMAKE_BUILD_TYPE_OPTION = $CMAKE_BUILD_TYPE_OPTION
The location below is where all the important *.out files will be found.
OUTPUT_TREE = $OUTPUT_TREE
The location below is the top-level build-tree directory.
BUILD_TREE = $BUILD_TREE
The location below is the top-level install-tree directory.
INSTALL_TREE = $INSTALL_TREE
The location below is the top-level directory of the build tree used
for the CMake-based build and test of the installed examples.
INSTALL_BUILD_TREE = $INSTALL_BUILD_TREE
Each of the steps in this comprehensive test may take a while...."
PATH_SAVE=$PATH
if [ "$generator_string" = "MinGW Makefiles" -o "$generator_string" = "MSYS Makefiles" ] ; then
MINGW_OR_MSYS="true"
else
MINGW_OR_MSYS="false"
fi
mkdir -p "$OUTPUT_TREE"
rm -rf "$BUILD_TREE"
mkdir -p "$BUILD_TREE"
cd "$BUILD_TREE"
if [ "$do_ctest" = "yes" -o "$do_test_build_tree" = "yes" ] ; then
BUILD_TEST_OPTION="-DBUILD_TEST=ON"
else
BUILD_TEST_OPTION=""
fi
output="$OUTPUT_TREE"/cmake.out
rm -f "$output"
if [ "$CMAKE_BUILD_TYPE_OPTION" != "-DBUILD_SHARED_LIBS=OFF" -a "$MINGW_OR_MSYS" = "true" ] ; then
echo "Prepend $BUILD_TREE/dll to the original PATH"
PATH=$BUILD_TREE/dll:$PATH_SAVE
fi
# Process $cmake_added_options into $* to be used on the cmake command
# line below.
set -- $cmake_added_options
echo "cmake in the build tree"
cmake "-DCMAKE_INSTALL_PREFIX=$INSTALL_TREE" $BUILD_TEST_OPTION \
$* $CMAKE_BUILD_TYPE_OPTION -G "$generator_string" \
"$SOURCE_TREE" >& "$output"
cmake_rc=$?
if [ "$cmake_rc" -ne 0 ] ; then
echo "ERROR: cmake in the build tree failed"
exit 1
fi
if [ "$do_ctest" = "yes" ] ; then
output="$OUTPUT_TREE"/make.out
rm -f "$output"
echo "$build_command VERBOSE=1 in the build tree"
$build_command VERBOSE=1 >& "$output"
make_rc=$?
if [ "$make_rc" -eq 0 ] ; then
output="$OUTPUT_TREE"/ctest.out
rm -f "$output"
echo "$ctest_command in the build tree"
$ctest_command --extra-verbose >& "$output"
ctest_rc=$?
if [ "$ctest_rc" -eq 0 ] ; then
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/clean_ctest_plot_files.out
rm -f "$output"
echo "$build_command clean_ctest_plot_files in the build tree (since we are done with ctest)"
$build_command clean_ctest_plot_files >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command clean_ctest_plot_files failed in the build tree"
exit 1
fi
fi
else
echo "ERROR: $ctest_command failed in the build tree"
exit 1
fi
else
echo "ERROR: $build_command failed in the build tree"
exit 1
fi
fi
if [ "$do_test_build_tree" = "yes" -a "$do_test_noninteractive" = "yes" ] ; then
output="$OUTPUT_TREE"/make_noninteractive.out
rm -f "$output"
echo "$build_command VERBOSE=1 test_noninteractive in the build tree"
$build_command VERBOSE=1 test_noninteractive >& "$output"
make_test_noninteractive_rc=$?
if [ "$make_test_noninteractive_rc" -ne 0 ] ; then
echo "ERROR: $build_command test_noninteractive failed in the build tree"
exit 1
fi
fi
if [ "$do_test_install_tree" = "yes" -o \
"$do_test_traditional_install_tree" = "yes" ] ; then
rm -rf "$INSTALL_TREE"
output="$OUTPUT_TREE"/make_install.out
rm -f "$output"
echo "$build_command VERBOSE=1 install in the build tree"
$build_command VERBOSE=1 install >& "$output"
make_install_rc=$?
if [ "$make_install_rc" -ne 0 ] ; then
echo "ERROR: $build_command install failed in the build tree"
exit 1
fi
fi
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/clean.out
rm -f "$output"
echo "$build_command clean in the build tree (since we are done with it at least for the non-interactive test case)"
$build_command clean >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command clean failed in the build tree"
exit 1
fi
fi
if [ "$do_test_install_tree" = "yes" -o \
"$do_test_traditional_install_tree" = "yes" ] ; then
echo "Prepend $INSTALL_TREE/bin to the original PATH"
PATH="$INSTALL_TREE/bin":$PATH_SAVE
if [ "$CMAKE_BUILD_TYPE_OPTION" = "-DBUILD_SHARED_LIBS=ON" -a "$MINGW_OR_MSYS" = "true" ] ; then
# Use this logic to be as version-independent as possible.
current_dir=$(pwd)
# Wild cards must not be inside quotes.
cd "$INSTALL_TREE"/lib/plplot[0-9].[0-9]*.[0-9]*/drivers*
echo "Prepend $(pwd) to the current PATH"
PATH="$(pwd):$PATH"
cd $current_dir
fi
if [ "$do_test_install_tree" = "yes" ] ; then
rm -rf "$INSTALL_BUILD_TREE"
mkdir -p "$INSTALL_BUILD_TREE"
cd "$INSTALL_BUILD_TREE"
output="$OUTPUT_TREE"/installed_cmake.out
rm -f "$output"
echo "cmake in the installed examples build tree"
cmake -G "$generator_string" "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples >& "$output"
if [ "$do_test_noninteractive" = "yes" ] ; then
output="$OUTPUT_TREE"/installed_make_noninteractive.out
rm -f "$output"
echo "$build_command VERBOSE=1 test_noninteractive in the installed examples build tree"
$build_command VERBOSE=1 test_noninteractive >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command test_noninteractive failed in the installed examples build tree"
exit 1
fi
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/installed_clean.out
rm -f "$output"
echo "$build_command clean in the installed examples build tree (since we are done with it at least for the non-interactive test case)"
$build_command clean >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command clean failed in the installed examples build tree"
exit 1
fi
fi
fi
fi
if [ "$do_test_traditional_install_tree" = "yes" -a "$do_test_noninteractive" = "yes" ] ; then
cd "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples
output="$OUTPUT_TREE"/traditional_make_noninteractive.out
rm -f "$output"
echo "Traditional $build_command test_noninteractive in the installed examples tree"
$build_command test_noninteractive >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: Traditional $build_command test_noninteractive failed in the installed examples tree"
exit 1
fi
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/traditional_clean.out
rm -f "$output"
echo "Traditional $build_command clean in the installed examples tree (since we are done with it at least for the non-interactive test case)"
$build_command clean >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: Traditional $build_command clean failed in the installed examples tree"
exit 1
fi
fi
fi
fi
if [ "$do_test_interactive" = "yes" ] ; then
if [ "$do_test_build_tree" = "yes" ] ; then
if [ "$CMAKE_BUILD_TYPE_OPTION" != "-DBUILD_SHARED_LIBS=OFF" -a "$MINGW_OR_MSYS" = "true" ] ; then
echo "Prepend $BUILD_TREE/dll to the original PATH"
PATH=$BUILD_TREE/dll:$PATH_SAVE
fi
cd "$BUILD_TREE"
output="$OUTPUT_TREE"/make_interactive.out
rm -f "$output"
echo "$build_command VERBOSE=1 test_interactive in the build tree"
$build_command VERBOSE=1 test_interactive >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command test_interactive failed in the build tree"
exit 1
fi
fi
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/clean.out
rm -f "$output"
echo "$build_command clean in the build tree (since we are done with it)"
$build_command clean >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command clean failed in the build tree"
exit 1
fi
fi
echo "Prepend $INSTALL_TREE/bin to the original PATH"
PATH="$INSTALL_TREE/bin":$PATH_SAVE
if [ "$CMAKE_BUILD_TYPE_OPTION" = "-DBUILD_SHARED_LIBS=ON" -a "$MINGW_OR_MSYS" = "true" ] ; then
# Use this logic to be as version-independent as possible.
current_dir=$(pwd)
# Wild cards must not be inside quotes.
cd "$INSTALL_TREE"/lib/plplot[0-9].[0-9]*.[0-9]*/drivers*
echo "Prepend $(pwd) to the current PATH"
PATH="$(pwd):$PATH"
cd $current_dir
fi
if [ "$do_test_install_tree" = "yes" ] ; then
cd "$INSTALL_BUILD_TREE"
output="$OUTPUT_TREE"/installed_make_interactive.out
rm -f "$output"
echo "$build_command VERBOSE=1 test_interactive in the installed examples build tree"
$build_command VERBOSE=1 test_interactive >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command test_interactive failed in the installed examples build tree"
exit 1
fi
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/installed_clean.out
rm -f "$output"
echo "$build_command clean in the installed examples build tree (since we are done with it)"
$build_command clean >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: $build_command clean failed in the installed examples build tree"
exit 1
fi
fi
fi
if [ "$do_test_traditional_install_tree" = "yes" ] ; then
cd "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples
output="$OUTPUT_TREE"/traditional_make_interactive.out
rm -f "$output"
echo "Traditional $build_command test_interactive in the installed examples tree"
$build_command test_interactive >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: Traditional $build_command test_interactive failed in the installed exaples tree"
exit 1
fi
if [ "$do_clean_as_you_go" = "yes" ] ; then
output="$OUTPUT_TREE"/traditional_clean.out
rm -f "$output"
echo "Traditional $build_command clean in the installed examples tree (since we are done with it)"
$build_command clean >& "$output"
make_rc=$?
if [ "$make_rc" -ne 0 ] ; then
echo "ERROR: Traditional $build_command clean failed in the installed examples tree"
exit 1
fi
fi
fi
fi
echo "Restore PATH to the original PATH"
PATH=$PATH_SAVE
}
usage () {
local prog=`basename $0`
echo "Usage: $prog [OPTIONS]
OPTIONS:
The next option specifies the directory prefix which controls where
all files produced by this script are located.
[--prefix (defaults to the 'comprehensive_test_disposeable'
subdirectory of the top-level source-tree directory)]
The next option controls whether the script runs clean to get rid of
file results and save disk space after the tests are completed.
This option is highly recommended to greatly reduce the
the disk usage (which can be as large as 40GB [!] without this
option).
[--do_clean_as_you_go (yes/no, defaults to yes)]
The next four control how the builds and tests are done.
[--generator_string (defaults to 'Unix Makefiles')]
[--ctest_command (defaults to 'ctest -j8')]
[--build_command (defaults to 'make -j8')]
The next four control what kind of builds and tests are done.
[--cmake_added_options (defaults to none, but can be used to specify any
combination of white-space-separated cmake options
to, e.g., refine what parts of the PLplot software are
built and tested)]
[--do_shared (yes/no, defaults to yes)]
[--do_nondynamic (yes/no, defaults to yes)]
[--do_static (yes/no, defaults to yes)]
The next six control which of seven kinds of tests are done for
each kind of build.
[--do_ctest (yes/no, defaults to yes)]
[--do_test_noninteractive (yes/no, defaults to yes)]
[--do_test_interactive (yes/no, defaults to yes)]
[--do_test_build_tree (yes/no, defaults to yes)]
[--do_test_install_tree (yes/no, defaults to yes)]
[--do_test_traditional_install_tree (yes/no, defaults to yes)]
[--help] Show this message.
"
if [ $1 -ne 0 ]; then
exit $1
fi
}
# Find absolute PATH of script without using readlink (since readlink is
# not available on all platforms). Followed advice at
# http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/
ORIGINAL_PATH="$(pwd)"
cd "$(dirname $0)"
# Absolute Path of the script
SCRIPT_PATH="$(pwd)"
cd "${ORIGINAL_PATH}"
# Assumption: top-level source tree is parent directory of where script
# is located.
SOURCE_TREE="$(dirname ${SCRIPT_PATH})"
# This is the parent tree for the BUILD_TREE, INSTALL_TREE,
# INSTALL_BUILD_TREE, and OUTPUT_TREE. It is disposable.
# Default values for options
prefix="${SOURCE_TREE}/../comprehensive_test_disposeable"
do_clean_as_you_go=yes
generator_string="Unix Makefiles"
ctest_command="ctest -j8"
build_command="make -j8"
cmake_added_options=
do_shared=yes
do_nondynamic=yes
do_static=yes
do_ctest=yes
do_test_noninteractive=yes
do_test_interactive=yes
do_test_build_tree=yes
do_test_install_tree=yes
do_test_traditional_install_tree=yes
usage_reported=0
while test $# -gt 0; do
case $1 in
--prefix)
prefix=$2
shift
;;
--do_clean_as_you_go)
case $2 in
yes|no)
do_clean_as_you_go=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--generator_string)
generator_string=$2
shift
;;
--ctest_command)
ctest_command=$2
shift
;;
--build_command)
build_command=$2
shift
;;
--cmake_added_options)
cmake_added_options=$2
shift
;;
--do_shared)
case $2 in
yes|no)
do_shared=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_nondynamic)
case $2 in
yes|no)
do_nondynamic=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_static)
case $2 in
yes|no)
do_static=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_ctest)
case $2 in
yes|no)
do_ctest=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_test_noninteractive)
case $2 in
yes|no)
do_test_noninteractive=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_test_interactive)
case $2 in
yes|no)
do_test_interactive=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_test_build_tree)
case $2 in
yes|no)
do_test_build_tree=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_test_install_tree)
case $2 in
yes|no)
do_test_install_tree=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--do_test_traditional_install_tree)
case $2 in
yes|no)
do_test_traditional_install_tree=$2
shift
;;
*)
usage 1 1>&2
;;
esac
;;
--help)
usage 0 1>&2
exit 0;
;;
*)
if [ $usage_reported -eq 0 ]; then
usage_reported=1
usage 0 1>&2
echo " "
fi
echo "Unknown option: $1"
;;
esac
shift
done
if [ $usage_reported -eq 1 ]; then
exit 1
fi
echo "Summary of options used for these tests
prefix=$prefix
do_clean_as_you_go=$do_clean_as_you_go
generator_string=$generator_string"
echo "
ctest_command=$ctest_command
build_command=$build_command
cmake_added_options=$cmake_added_options
do_shared=$do_shared
do_nondynamic=$do_nondynamic
do_static=$do_static
do_ctest=$do_ctest
do_test_noninteractive=$do_test_noninteractive
do_test_interactive=$do_test_interactive
do_test_build_tree=$do_test_build_tree
do_test_install_tree=$do_test_install_tree
do_test_traditional_install_tree=$do_test_traditional_install_tree
N.B. do_clean_as_you_go above should be yes unless you don't mind an
accumulation of ~40GB of plot files! Even with this option set to yes
the high-water mark of disk usage can still be as high as 4GB so be
sure you have enough free disk space to run this test!
"
ANSWER=
while [ "$ANSWER" != "yes" -a "$ANSWER" != "no" ] ; do
echo -n "Continue (yes/no)? "
read ANSWER
done
if [ "$ANSWER" = "no" ] ; then
echo "Immediate exit specified!"
exit
fi
# Shared + dynamic
if [ "$do_shared" = "yes" ] ; then
OUTPUT_TREE="$prefix/shared/output_tree"
BUILD_TREE="$prefix/shared/build_tree"
INSTALL_TREE="$prefix/shared/install_tree"
INSTALL_BUILD_TREE="$prefix/shared/install_build_tree"
comprehensive_test "-DBUILD_SHARED_LIBS=ON"
fi
# Shared + nondynamic
if [ "$do_nondynamic" = "yes" ] ; then
OUTPUT_TREE="$prefix/nondynamic/output_tree"
BUILD_TREE="$prefix/nondynamic/build_tree"
INSTALL_TREE="$prefix/nondynamic/install_tree"
INSTALL_BUILD_TREE="$prefix/nondynamic/install_build_tree"
comprehensive_test "-DBUILD_SHARED_LIBS=ON -DENABLE_DYNDRIVERS=OFF"
fi
if [ "$do_static" = "yes" ] ; then
# Static + nondynamic
OUTPUT_TREE="$prefix/static/output_tree"
BUILD_TREE="$prefix/static/build_tree"
INSTALL_TREE="$prefix/static/install_tree"
INSTALL_BUILD_TREE="$prefix/static/install_build_tree"
comprehensive_test "-DBUILD_SHARED_LIBS=OFF"
fi
|