1#!/bin/bash 2 3# Complete tests of PLplot for the three generic build types which 4# consist of shared+dynamic, shared+nondynamic, and static+nondynamic. 5# These complete tests that are run for each build type are (I) 6# test_noninteractive, test_interactive, and ctest in the core build 7# tree; (II) CMake-based test_noninteractive, test_interactive and 8# ctest in the build tree for the installed examples; and (III) 9# traditional [Makefile+pkg-config] test_noninteractive and 10# test_interactive of the installed examples. 11 12usage () { 13 local prog=`basename $0` 14 echo "Usage: $prog [OPTIONS] 15OPTIONS: 16 The next option specifies the directory prefix (absolute or relative to 17 the original directory from which this script was invoked) which controls 18 where all files produced by this script are located. 19 [--prefix (defaults to the 'comprehensive_test_disposeable' 20 subdirectory of the directory just above the 21 top-level source-tree directory)] 22 23 The next option controls whether the shared, nondynamic, and static 24 subdirectories of the prefix tree are initially removed so the 25 tarball of all results is guaranteed not to contain stale results. 26 Only use no for this option if you want to preserve results from a 27 previous run of this script that will not be tested for this run, 28 (e.g., if you previously used the option --do_shared yes and are now 29 using the option --do_shared no). 30 [--do_clean_first (yes/no, defaults to yes)] 31 32 The next option controls whether the script runs clean to get rid of 33 file results and save disk space after the tests are completed. 34 This option is highly recommended to greatly reduce the 35 the disk usage (which can be as large as 40GB [!] without this 36 option). 37 [--do_clean_as_you_go (yes/no, defaults to yes)] 38 39 The next six options control the tools used for the configurations, builds, and tests. 40 [--cmake_command (defaults to cmake)] 41 [--generator_string (defaults to 'Unix Makefiles')] 42 [--cmake_added_options (defaults to none, but can be used to specify any 43 combination of white-space-separated cmake options 44 to, e.g., refine what parts of the PLplot software are 45 built and tested)] 46 [--build_command (defaults to 'make -j4')] 47 [--ctest_command (defaults to 'ctest -j4')] 48 [--do_submit_dashboard (yes/no defaults to no, but if set to yes, the -D Experimental option 49 will be added to the ctest command, i.e., a dashboard of the ctest results 50 will be sent to <http://my.cdash.org/index.php?project=PLplot_git> where 51 they will be publicly displayed.] 52 53 The next three options control which of the three principal PLplot configurations are tested. 54 [--do_shared (yes/no, defaults to yes)] 55 [--do_nondynamic (yes/no, defaults to yes)] 56 [--do_static (yes/no, defaults to yes)] 57 58 The next six control which of eight kinds of tests 59 (test_interactive, test_noninteractive, and ctest for both the build 60 and install tree and test_interactive and test_noninteractive for 61 the traditional install tree) are done for each kind of build. 62 [--do_test_interactive (yes/no, defaults to yes)] 63 [--do_test_noninteractive (yes/no, defaults to yes)] 64 [--do_ctest (yes/no, defaults to yes)] 65 [--do_test_build_tree (yes/no, defaults to yes)] 66 [--do_test_install_tree (yes/no, defaults to yes)] 67 [--do_test_traditional_install_tree (yes/no, defaults to yes)] 68 69 [--help] Show this message. 70" 71 if [ $1 -ne 0 ]; then 72 exit $1 73 fi 74} 75 76collect_exit() { 77 # Collect all information in a tarball and exit with return 78 # code = $1 79 80 # This function should only be used after prefix, 81 # RELATIVE_COMPREHENSIVE_TEST_LOG and RELATIVE_ENVIRONMENT_LOG 82 # have been defined. 83 84 return_code=$1 85 cd "$prefix" 86 87 # Clean up stale results before appending new information to the tarball. 88 TARBALL="$prefix/comprehensive_test.tar" 89 90 rm -f "$TARBALL" "$TARBALL.gz" 91 92 # Collect relevant subset of $prefix information in the tarball 93 if [ -f $RELATIVE_COMPREHENSIVE_TEST_LOG ] ; then 94 tar rf "$TARBALL" $RELATIVE_COMPREHENSIVE_TEST_LOG 95 fi 96 97 if [ -f $RELATIVE_ENVIRONMENT_LOG ] ; then 98 tar rf "$TARBALL" $RELATIVE_ENVIRONMENT_LOG 99 fi 100 101 for directory in shared/interactive shared/noninteractive nondynamic/interactive nondynamic/noninteractive static/interactive static/noninteractive ; do 102 if [ -d $directory/output_tree ] ; then 103 tar rf "$TARBALL" $directory/output_tree 104 fi 105 if [ -f $directory/build_tree/CMakeCache.txt ] ; then 106 tar rf "$TARBALL" $directory/build_tree/CMakeCache.txt 107 fi 108 if [ -f $directory/install_build_tree/CMakeCache.txt ] ; then 109 tar rf "$TARBALL" $directory/install_build_tree/CMakeCache.txt 110 fi 111 done 112 113 # Collect listing of every file generated by the script 114 find . -type f |xargs ls -l >| comprehensive_test_listing.out 115 tar rf "$TARBALL" comprehensive_test_listing.out 116 117 gzip "$TARBALL" 118 119 exit $return_code 120} 121 122echo_tee() { 123 # N.B. only useful after this script defines $COMPREHENSIVE_TEST_LOG 124 echo "$@" |tee -a "$COMPREHENSIVE_TEST_LOG" 125} 126 127comprehensive_test () { 128 CMAKE_BUILD_TYPE_OPTION=$1 129 TEST_TYPE=$2 130 echo_tee " 131Running comprehensive_test function with the following variables set: 132 133The variables below are key CMake options which determine the entire 134kind of build that will be tested. 135CMAKE_BUILD_TYPE_OPTION = $CMAKE_BUILD_TYPE_OPTION 136TEST_TYPE = ${TEST_TYPE} 137 138The location below is where all the important *.out files will be found. 139OUTPUT_TREE = \"$OUTPUT_TREE\" 140 141The location below is the top-level build-tree directory. 142BUILD_TREE = \"$BUILD_TREE\" 143 144The location below is the top-level install-tree directory. 145INSTALL_TREE = \"$INSTALL_TREE\" 146 147The location below is the top-level directory of the build tree used 148for the CMake-based build and test of the installed examples. 149INSTALL_BUILD_TREE = \"$INSTALL_BUILD_TREE\"" 150 151 echo_tee " 152This variable specifies whether any windows platform has been detected 153ANY_WINDOWS_PLATFORM=$ANY_WINDOWS_PLATFORM" 154 155 echo_tee " 156Each of the steps in this comprehensive test may take a while...." 157 158 PATH_SAVE="$PATH" 159 mkdir -p "$OUTPUT_TREE" 160 # Clean start with nonexistent install tree and empty build tree(s). 161 rm -rf "$INSTALL_TREE" 162 rm -rf "$BUILD_TREE" 163 mkdir -p "$BUILD_TREE" 164 if [ "$do_test_install_tree" = "yes" ] ; then 165 rm -rf "$INSTALL_BUILD_TREE" 166 mkdir -p "$INSTALL_BUILD_TREE" 167 fi 168 cd "$BUILD_TREE" 169 if [ "$do_test_build_tree" = "yes" ] ; then 170 BUILD_TEST_OPTION="-DBUILD_TEST=ON" 171 else 172 BUILD_TEST_OPTION="" 173 fi 174 output="$OUTPUT_TREE"/cmake.out 175 rm -f "$output" 176 177 if [ "$CMAKE_BUILD_TYPE_OPTION" != "-DBUILD_SHARED_LIBS=OFF" -a "$ANY_WINDOWS_PLATFORM" = "true" ] ; then 178 echo_tee "Prepend \"$BUILD_TREE/dll\" to the original PATH" 179 PATH="$BUILD_TREE/dll:$PATH_SAVE" 180 fi 181 182 # Process $cmake_added_options into $* to be used on the ${cmake_command} command 183 # line below. 184 set -- $cmake_added_options 185 echo_tee "${cmake_command} in the build tree" 186 ${cmake_command} "-DCMAKE_INSTALL_PREFIX=$INSTALL_TREE" $BUILD_TEST_OPTION \ 187 $* $CMAKE_BUILD_TYPE_OPTION -G "$generator_string" \ 188 "$DASHBOARD_LABEL_OPTION" "$SOURCE_TREE" >& "$output" 189 cmake_rc=$? 190 if [ "$cmake_rc" -ne 0 ] ; then 191 echo_tee "ERROR: ${cmake_command} in the build tree failed" 192 collect_exit 1 193 fi 194 195 # Prepare do_test_type variables. 196 if [ "$TEST_TYPE" = "noninteractive" ] ; then 197 do_test_type=$do_test_noninteractive 198 else 199 do_test_type=$do_test_interactive 200 fi 201 if [ "$do_test_build_tree" = "yes" ] ; then 202 if [ "$do_test_type" = "yes" ] ; then 203 output="${OUTPUT_TREE}/make_${TEST_TYPE}.out" 204 rm -f "$output" 205 echo_tee "$build_command VERBOSE=1 test_${TEST_TYPE} in the build tree" 206 $build_command VERBOSE=1 test_${TEST_TYPE} >& "$output" 207 make_test_type_rc=$? 208 if [ "$make_test_type_rc" -ne 0 ] ; then 209 echo_tee "ERROR: $build_command VERBOSE=1 test_${TEST_TYPE} failed in the build tree" 210 collect_exit 1 211 fi 212 fi 213 214 if [ "$do_ctest" = "yes" -a "$TEST_TYPE" = "noninteractive" ] ; then 215 output="$OUTPUT_TREE"/make.out 216 rm -f "$output" 217 echo_tee "$build_command VERBOSE=1 in the build tree" 218 $build_command VERBOSE=1 >& "$output" 219 make_rc=$? 220 if [ "$make_rc" -eq 0 ] ; then 221 output="$OUTPUT_TREE"/ctest.out 222 rm -f "$output" 223 echo_tee "$ctest_command --extra-verbose ${dashboard_option}in the build tree" 224 $ctest_command --extra-verbose ${dashboard_option}>& "$output" 225 ctest_rc=$? 226 if [ "$ctest_rc" -eq 0 ] ; then 227 if [ "$do_clean_as_you_go" = "yes" ] ; then 228 output="$OUTPUT_TREE"/clean_ctest_plot_files.out 229 rm -f "$output" 230 echo_tee "$build_command VERBOSE=1 clean_ctest_plot_files in the build tree (since we are done with ctest)" 231 $build_command VERBOSE=1 clean_ctest_plot_files >& "$output" 232 make_rc=$? 233 if [ "$make_rc" -ne 0 ] ; then 234 echo_tee "ERROR: $build_command VERBOSE=1 clean_ctest_plot_files failed in the build tree" 235 collect_exit 1 236 fi 237 fi 238 else 239 echo_tee "ERROR: $ctest_command --extra-verbose ${dashboard_option}failed in the build tree" 240 collect_exit 1 241 fi 242 else 243 echo_tee "ERROR: $build_command VERBOSE=1 failed in the build tree" 244 collect_exit 1 245 fi 246 fi 247 fi 248 249 if [ "$do_test_install_tree" = "yes" -o "$do_test_traditional_install_tree" = "yes" ] ; then 250 rm -rf "$INSTALL_TREE" 251 output="$OUTPUT_TREE"/make_install.out 252 rm -f "$output" 253 echo_tee "$build_command VERBOSE=1 install in the build tree" 254 $build_command VERBOSE=1 install >& "$output" 255 make_install_rc=$? 256 if [ "$make_install_rc" -ne 0 ] ; then 257 echo_tee "ERROR: $build_command VERBOSE=1 install failed in the build tree" 258 collect_exit 1 259 fi 260 261 if [[ "$OSTYPE" =~ ^linux && "$CMAKE_BUILD_TYPE_OPTION" != "-DBUILD_SHARED_LIBS=OFF" ]]; then 262 # The above install and the above "if" assure there are 263 # *.so files in both the build and install trees for the 264 # linux case that can be analyzed with ldd -r. N.B. we 265 # deliberately drop dllplplot_stubs.so and 266 # dllinstalled_plplotstubs.so from the reports because 267 # there is no known way to set the rpath for that 268 # ocamlmklib-generated shared object at the moment. See 269 # plplot-devel mailing discusion on 2016-12-09 with the 270 # subject line "Setting rpath for dllplplot_stubs.so 271 # appears not to be possible". 272 output="$OUTPUT_TREE"/build_tree_ldd.out 273 rm -f "$output" 274 echo_tee "find \"$BUILD_TREE\" -name \"*.so\" -a ! -name \"dll*plplot_stubs.so\" -a -print0 |xargs -0 ldd -r >& \"$output\" in the build tree just after the install for TEST_TYPE = ${TEST_TYPE})" 275 find "$BUILD_TREE" -name "*.so" -a ! -name "dll*plplot_stubs.so" -a -print0 | xargs -0 ldd -r >& "$output" 276 ldd_rc=$? 277 if [ "$ldd_rc" -ne 0 ] ; then 278 echo_tee "ERROR: find \"$BUILD_TREE\" -name \"*.so\" -a ! -name \"dll*plplot_stubs.so\" -a -print0 |xargs -0 ldd -r >& \"$output\" failed in the build tree" 279 collect_exit 1 280 fi 281 282 output="$OUTPUT_TREE"/install_tree_ldd.out 283 rm -f "$output" 284 echo_tee "find \"$INSTALL_TREE\" -name \"*.so\" -a ! -name \"dll*plplot_stubs.so\" -a -print0 |xargs -0 ldd -r >& \"$output\" in the install tree just after the install for TEST_TYPE = ${TEST_TYPE})" 285 find "$INSTALL_TREE" -name "*.so" -a ! -name "dll*plplot_stubs.so" -a -print0 | xargs -0 ldd -r >& "$output" 286 ldd_rc=$? 287 if [ "$ldd_rc" -ne 0 ] ; then 288 echo_tee "ERROR: find \"$INSTALL_TREE\" -name \"*.so\" -a ! -name \"dll*plplot_stubs.so\" -a -print0 |xargs -0 ldd -r >& \"$output\" failed in the install tree" 289 collect_exit 1 290 fi 291 fi 292 fi 293 294 if [ "$do_clean_as_you_go" = "yes" ] ; then 295 output="$OUTPUT_TREE"/clean.out 296 rm -f "$output" 297 echo_tee "$build_command VERBOSE=1 clean in the build tree (since we are done with it for TEST_TYPE = ${TEST_TYPE})" 298 $build_command VERBOSE=1 clean >& "$output" 299 make_rc=$? 300 if [ "$make_rc" -ne 0 ] ; then 301 echo_tee "ERROR: $build_command VERBOSE=1 clean failed in the build tree" 302 collect_exit 1 303 fi 304 fi 305 306 if [ "$do_test_install_tree" = "yes" -o "$do_test_traditional_install_tree" = "yes" ] ; then 307 echo_tee "Prepend \"$INSTALL_TREE/bin\" to the original PATH" 308 PATH="$INSTALL_TREE/bin:$PATH_SAVE" 309 310 if [ "$CMAKE_BUILD_TYPE_OPTION" = "-DBUILD_SHARED_LIBS=ON" -a "$ANY_WINDOWS_PLATFORM" = "true" ] ; then 311 # Use this logic to be as version-independent as possible. 312 current_dir="$(pwd)" 313 # Wild cards must not be inside quotes. 314 cd "$INSTALL_TREE"/lib/plplot[0-9].[0-9]*.[0-9]*/drivers* 315 echo_tee "Prepend \"$(pwd)\" to the current PATH" 316 PATH="$(pwd):$PATH" 317 cd $current_dir 318 fi 319 320 if [ "$do_test_install_tree" = "yes" ] ; then 321 cd "$INSTALL_BUILD_TREE" 322 output="$OUTPUT_TREE"/installed_cmake.out 323 rm -f "$output" 324 echo_tee "${cmake_command} in the installed examples build tree" 325 ${cmake_command} -G "$generator_string" "$INSTALLED_DASHBOARD_LABEL_OPTION" "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples >& "$output" 326 cmake_rc=$? 327 if [ "$cmake_rc" -ne 0 ] ; then 328 echo_tee "ERROR: ${cmake_command} in the installed examples build tree failed" 329 collect_exit 1 330 fi 331 if [ "$do_test_type" = "yes" ] ; then 332 output="${OUTPUT_TREE}/installed_make_${TEST_TYPE}.out" 333 rm -f "$output" 334 echo_tee "$build_command VERBOSE=1 test_${TEST_TYPE} in the installed examples build tree" 335 $build_command VERBOSE=1 test_${TEST_TYPE} >& "$output" 336 make_rc=$? 337 if [ "$make_rc" -ne 0 ] ; then 338 echo_tee "ERROR: $build_command VERBOSE=1 test_${TEST_TYPE} failed in the installed examples build tree" 339 collect_exit 1 340 fi 341 342 if [ "$do_clean_as_you_go" = "yes" ] ; then 343 output="$OUTPUT_TREE"/installed_clean.out 344 rm -f "$output" 345 echo_tee "$build_command VERBOSE=1 clean in the installed examples build tree (since we are done with it for TEST_TYPE = ${TEST_TYPE})" 346 $build_command VERBOSE=1 clean >& "$output" 347 make_rc=$? 348 if [ "$make_rc" -ne 0 ] ; then 349 echo_tee "ERROR: $build_command VERBOSE=1 clean failed in the installed examples build tree" 350 collect_exit 1 351 fi 352 fi 353 fi 354 if [ "$do_ctest" = "yes" -a "$TEST_TYPE" = "noninteractive" ] ; then 355 output="$OUTPUT_TREE"/installed_make.out 356 rm -f "$output" 357 echo_tee "$build_command VERBOSE=1 in the installed examples build tree" 358 $build_command VERBOSE=1 >& "$output" 359 make_rc=$? 360 if [ "$make_rc" -eq 0 ] ; then 361 output="$OUTPUT_TREE"/installed_ctest.out 362 rm -f "$output" 363 echo_tee "$ctest_command --extra-verbose ${dashboard_option}in the installed examples build tree" 364 $ctest_command --extra-verbose ${dashboard_option}>& "$output" 365 ctest_rc=$? 366 if [ "$ctest_rc" -eq 0 ] ; then 367 if [ "$do_clean_as_you_go" = "yes" ] ; then 368 output="$OUTPUT_TREE"/installed_clean_ctest_plot_files.out 369 rm -f "$output" 370 echo_tee "$build_command VERBOSE=1 clean_ctest_plot_files in the installed examples build tree" 371 $build_command VERBOSE=1 clean_ctest_plot_files >& "$output" 372 make_rc=$? 373 if [ "$make_rc" -ne 0 ] ; then 374 echo_tee "ERROR: $build_command VERBOSE=1 clean_ctest_plot_files failed in the installed examples build tree" 375 collect_exit 1 376 fi 377 fi 378 else 379 echo_tee "ERROR: $ctest_command --extra-verbose ${dashboard_option}failed in the installed examples build tree" 380 collect_exit 1 381 fi 382 else 383 echo_tee "ERROR: $build_command VERBOSE=1 failed in the installed examples build tree" 384 collect_exit 1 385 fi 386 fi 387 fi 388 389 if [ "$do_test_traditional_install_tree" = "yes" -a "$do_test_type" = "yes" ] ; then 390 cd "$INSTALL_TREE"/share/plplot[0-9].[0-9]*.[0-9]*/examples 391 output="${OUTPUT_TREE}/traditional_make_${TEST_TYPE}.out" 392 rm -f "$output" 393 echo_tee "Traditional $traditional_build_command test_${TEST_TYPE} in the installed examples tree" 394 $traditional_build_command test_${TEST_TYPE} >& "$output" 395 make_rc=$? 396 if [ "$make_rc" -ne 0 ] ; then 397 echo_tee "ERROR: Traditional $traditional_build_command test_${TEST_TYPE} failed in the installed examples tree" 398 collect_exit 1 399 fi 400 if [ "$do_clean_as_you_go" = "yes" ] ; then 401 output="$OUTPUT_TREE"/traditional_clean.out 402 rm -f "$output" 403 echo_tee "Traditional $traditional_build_command clean in the installed examples tree (since we are done with it for TEST_TYPE = ${TEST_TYPE})" 404 $traditional_build_command clean >& "$output" 405 make_rc=$? 406 if [ "$make_rc" -ne 0 ] ; then 407 echo_tee "ERROR: Traditional $traditional_build_command clean failed in the installed examples tree" 408 collect_exit 1 409 fi 410 fi 411 fi 412 fi 413 echo_tee "Restore PATH to its original form" 414 PATH="$PATH_SAVE" 415} 416 417# Start of actual script after functions are defined. 418 419# Find absolute PATH of script without using readlink (since readlink is 420# not available on all platforms). Followed advice at 421# http://fritzthomas.com/open-source/linux/551-how-to-get-absolute-path-within-shell-script-part2/ 422ORIGINAL_PATH="$(pwd)" 423cd "$(dirname "$0")" 424# Absolute Path of the script 425SCRIPT_PATH="$(pwd)" 426cd "${ORIGINAL_PATH}" 427 428# Assumption: top-level source tree is parent directory of where script 429# is located. 430SOURCE_TREE=$(dirname "${SCRIPT_PATH}") 431# This is the parent tree for the BUILD_TREE, INSTALL_TREE, 432# INSTALL_BUILD_TREE, and OUTPUT_TREE. It is disposable. 433 434# Default values for options 435prefix="${SOURCE_TREE}/../comprehensive_test_disposeable" 436 437do_clean_first=yes 438 439do_clean_as_you_go=yes 440 441cmake_command="cmake" 442generator_string="Unix Makefiles" 443cmake_added_options= 444build_command="make -j4" 445ctest_command="ctest -j4" 446do_submit_dashboard=no 447 448do_shared=yes 449do_nondynamic=yes 450do_static=yes 451 452do_test_interactive=yes 453do_test_noninteractive=yes 454do_ctest=yes 455do_test_build_tree=yes 456do_test_install_tree=yes 457do_test_traditional_install_tree=yes 458 459usage_reported=0 460 461while test $# -gt 0; do 462 463 case $1 in 464 --prefix) 465 prefix="$2" 466 shift 467 ;; 468 --do_clean_first) 469 case $2 in 470 yes|no) 471 do_clean_first=$2 472 shift 473 ;; 474 475 *) 476 usage 1 1>&2 477 ;; 478 esac 479 ;; 480 --do_clean_as_you_go) 481 case $2 in 482 yes|no) 483 do_clean_as_you_go=$2 484 shift 485 ;; 486 487 *) 488 usage 1 1>&2 489 ;; 490 esac 491 ;; 492 --cmake_command) 493 cmake_command=$2 494 shift 495 ;; 496 --generator_string) 497 generator_string=$2 498 shift 499 ;; 500 --cmake_added_options) 501 cmake_added_options=$2 502 shift 503 ;; 504 --build_command) 505 build_command=$2 506 shift 507 ;; 508 --ctest_command) 509 ctest_command=$2 510 shift 511 ;; 512 --do_submit_dashboard) 513 case $2 in 514 yes|no) 515 do_submit_dashboard=$2 516 shift 517 ;; 518 519 *) 520 usage 1 1>&2 521 ;; 522 esac 523 ;; 524 --do_shared) 525 case $2 in 526 yes|no) 527 do_shared=$2 528 shift 529 ;; 530 531 *) 532 usage 1 1>&2 533 ;; 534 esac 535 ;; 536 --do_nondynamic) 537 case $2 in 538 yes|no) 539 do_nondynamic=$2 540 shift 541 ;; 542 *) 543 usage 1 1>&2 544 ;; 545 esac 546 ;; 547 --do_static) 548 case $2 in 549 yes|no) 550 do_static=$2 551 shift 552 ;; 553 *) 554 usage 1 1>&2 555 ;; 556 esac 557 ;; 558 --do_test_interactive) 559 case $2 in 560 yes|no) 561 do_test_interactive=$2 562 shift 563 ;; 564 *) 565 usage 1 1>&2 566 ;; 567 esac 568 ;; 569 --do_test_noninteractive) 570 case $2 in 571 yes|no) 572 do_test_noninteractive=$2 573 shift 574 ;; 575 *) 576 usage 1 1>&2 577 ;; 578 esac 579 ;; 580 --do_ctest) 581 case $2 in 582 yes|no) 583 do_ctest=$2 584 shift 585 ;; 586 *) 587 usage 1 1>&2 588 ;; 589 esac 590 ;; 591 --do_test_build_tree) 592 case $2 in 593 yes|no) 594 do_test_build_tree=$2 595 shift 596 ;; 597 *) 598 usage 1 1>&2 599 ;; 600 esac 601 ;; 602 --do_test_install_tree) 603 case $2 in 604 yes|no) 605 do_test_install_tree=$2 606 shift 607 ;; 608 *) 609 usage 1 1>&2 610 ;; 611 esac 612 ;; 613 --do_test_traditional_install_tree) 614 case $2 in 615 yes|no) 616 do_test_traditional_install_tree=$2 617 shift 618 ;; 619 *) 620 usage 1 1>&2 621 ;; 622 esac 623 ;; 624 --help) 625 usage 0 1>&2 626 exit 0; 627 ;; 628 *) 629 if [ $usage_reported -eq 0 ]; then 630 usage_reported=1 631 usage 0 1>&2 632 echo " " 633 fi 634 echo "Unknown option: $1" 635 ;; 636 esac 637 shift 638done 639 640if [ $usage_reported -eq 1 ]; then 641 exit 1 642fi 643 644# Create $prefix directory if it does not exist already 645mkdir -p "$prefix" 646# Convert $prefix to absolute path (if it is not already that). 647cd "$prefix" 648prefix="$(pwd)" 649cd "${ORIGINAL_PATH}" 650 651# Establish names of output files. We do this here (as soon as 652# possible after $prefix is determined) because 653# $COMPREHENSIVE_TEST_LOG affects echo_tee results. 654# The relative versions of these are needed for the tar command. 655RELATIVE_COMPREHENSIVE_TEST_LOG=comprehensive_test.sh.out 656RELATIVE_ENVIRONMENT_LOG=comprehensive_test_env.out 657COMPREHENSIVE_TEST_LOG="$prefix/$RELATIVE_COMPREHENSIVE_TEST_LOG" 658ENVIRONMENT_LOG="$prefix/$RELATIVE_ENVIRONMENT_LOG" 659 660# Clean up stale results before appending new information to this file 661# with the echo_tee command. 662rm -f "$COMPREHENSIVE_TEST_LOG" 663 664# Set up trap of user interrupts as soon as possible after the above variables 665# have been determined and the stale $COMPREHENSIVE_TEST_LOG has been removed. 666trap '{ echo_tee "Exiting because of user interrupt" ; collect_exit 1; }' INT 667 668hash git 669hash_rc=$? 670 671if [ "$hash_rc" -ne 0 ] ; then 672 echo_tee "WARNING: git not on PATH so cannot determine if SOURCE_TREE = 673$SOURCE_TREE is a git repository or not" 674else 675 cd "$SOURCE_TREE" 676 git_commit_id=$(git rev-parse --short HEAD) 677 git_rc=$? 678 if [ "$git_rc" -ne 0 ] ; then 679 echo_tee "WARNING: SOURCE_TREE = $SOURCE_TREE is not a git repository 680 so cannot determine git commit id of the version of PLplot being tested" 681 else 682 echo_tee "git commit id for the PLplot version being tested = $git_commit_id" 683 fi 684fi 685 686echo_tee "OSTYPE = ${OSTYPE}" 687 688hash pkg-config 689hash_rc=$? 690if [ "$hash_rc" -ne 0 ] ; then 691 echo_tee "WARNING: pkg-config not on PATH so setting do_test_traditional_install_tree=no" 692 do_test_traditional_install_tree=no 693fi 694 695# The question of what to use for the traditional build command is a 696# tricky one that depends on platform. Therefore, we hard code the 697# value of this variable rather than allowing the user to change it. 698if [ "$generator_string" = "MinGW Makefiles" -o "$generator_string" = "MSYS Makefiles" ] ; then 699 # For both these cases the MSYS make command should be used rather than 700 # the MinGW mingw32-make command. But a 701 # parallel version of the MSYS make command is problematic. 702 # Therefore, specify no -j option. 703 traditional_build_command="make" 704else 705 # For all other cases, the traditional build command should be the 706 # same as the build command. 707 traditional_build_command="$build_command" 708fi 709 710echo_tee "Summary of options used for these tests 711 712--prefix \"$prefix\" 713 714--do_clean_first $do_clean_first 715 716--do_clean_as_you_go $do_clean_as_you_go 717 718--cmake_command \"$cmake_command\" 719--generator_string \"$generator_string\" 720--cmake_added_options \"$cmake_added_options\" 721--build_command \"$build_command\" 722 (derived) traditional_build_command \"$traditional_build_command\" 723--ctest_command \"$ctest_command\" 724--do_submit_dashboard $do_submit_dashboard 725 726--do_shared $do_shared 727--do_nondynamic $do_nondynamic 728--do_static $do_static 729 730--do_test_interactive $do_test_interactive 731--do_test_noninteractive $do_test_noninteractive 732--do_ctest $do_ctest 733--do_test_build_tree $do_test_build_tree 734--do_test_install_tree $do_test_install_tree 735--do_test_traditional_install_tree $do_test_traditional_install_tree 736 737N.B. do_clean_as_you_go above should be yes unless you don't mind an 738accumulation of ~40GB of plot files! Even with this option set to yes 739the high-water mark of disk usage can still be as high as 4GB so be 740sure you have enough free disk space to run this test! 741" 742 743if [ "$do_submit_dashboard" = "yes" ] ; then 744 echo_tee "WARNING: Because you have specified \"do_submit_dashboard $do_submit_dashboard\" above, all (anonymized) details concerning each 745of your ctest results will be published at <http://my.cdash.org/index.php?project=PLplot_git> 746" 747 dashboard_option="-D Experimental " 748else 749 dashboard_option="" 750fi 751 752 753if [ "$do_clean_first" = "yes" ] ; then 754 echo_tee "WARNING: The shared, nondynamic, and static subdirectory trees of 755\"$prefix\" 756are about to be removed! 757" 758fi 759ANSWER= 760while [ "$ANSWER" != "yes" -a "$ANSWER" != "no" ] ; do 761 echo_tee -n "Continue (yes/no)? " 762 read ANSWER 763 if [ -z "$ANSWER" ] ; then 764 # default of no if no ANSWER 765 ANSWER=no 766 fi 767done 768echo_tee "" 769 770if [ "$ANSWER" = "no" ] ; then 771 echo_tee "Immediate exit specified!" 772 exit 773fi 774 775if [ "$do_clean_first" = "yes" ] ; then 776 rm -rf "$prefix/shared" "$prefix/nondynamic" "$prefix/static" 777fi 778 779# Discover if it is a Windows platform or not. 780if [[ "$OSTYPE" =~ ^cygwin ]]; then 781 ANY_WINDOWS_PLATFORM="true" 782elif [[ "$OSTYPE" =~ ^msys ]]; then 783 ANY_WINDOWS_PLATFORM="true" 784elif [[ "$OSTYPE" =~ ^win ]]; then 785 ANY_WINDOWS_PLATFORM="true" 786else 787 ANY_WINDOWS_PLATFORM="false" 788fi 789 790# Discover if it is a Mac OS X platform or not. 791if [[ "$OSTYPE" =~ ^darwin ]]; then 792 ANY_MAC_OSX_PLATFORM="true" 793else 794 ANY_MAC_OSX_PLATFORM="false" 795fi 796 797hash printenv 798hash_rc=$? 799if [ "$hash_rc" -ne 0 ] ; then 800 HAS_PRINTENV=false 801else 802 HAS_PRINTENV=true 803fi 804 805# Collect selected important environment variable results prior to testing. 806rm -f "$ENVIRONMENT_LOG" 807if [ "$HAS_PRINTENV" = "false" ] ; then 808 echo_tee "WARNING: printenv not on PATH so cannot collect certain important environment variables in $ENVIRONMENT_LOG" 809else 810 echo "# Look for the following subset of environment variables: 811 # Java-related, 812 # non-Java compilers, 813 # compiler flags, 814 # PATH-related variables, 815 # current directory, and 816 # PLplot-related." > "$ENVIRONMENT_LOG" 817 for ENVVAR in "$(printenv |grep -E '^JAVA.*=|^ADA=|^CC=|^CXX=|^DC=|^FC=|^.*FLAGS=|^PATH=|^CMAKE_.*PATH=|^PKG_CONFIG_PATH=|^LD_LIBRARY_PATH=|^PWD=|PLPLOT' | sort -u)"; do 818 echo "${ENVVAR}" | sed -e 's?=?="?' -e 's?\(.*\)$?\1"?' >> "$ENVIRONMENT_LOG" 819 done 820fi 821 822test_types= 823if [ "$do_test_interactive" = "yes" ] ; then 824 test_types="${test_types} interactive" 825fi 826 827if [ "$do_test_noninteractive" = "yes" -o "$do_ctest" = "yes" ] ; then 828 test_types="${test_types} noninteractive" 829fi 830 831for test_type in ${test_types} ; do 832 # Shared + dynamic 833 if [ "$do_shared" = "yes" ] ; then 834 OUTPUT_TREE="$prefix/shared/$test_type/output_tree" 835 BUILD_TREE="$prefix/shared/$test_type/build_tree" 836 INSTALL_TREE="$prefix/shared/$test_type/install_tree" 837 INSTALL_BUILD_TREE="$prefix/shared/$test_type/install_build_tree" 838 if [ "$do_submit_dashboard" = "yes" ] ; then 839 DASHBOARD_LABEL_OPTION="-DPLPLOT_BUILDNAME_SUFFIX:STRING=-(shared library + dynamic devices)" 840 INSTALLED_DASHBOARD_LABEL_OPTION="-DPLPLOT_BUILDNAME_SUFFIX:STRING=-(installed shared library + dynamic devices)" 841 else 842 DASHBOARD_LABEL_OPTION= 843 INSTALLED_DASHBOARD_LABEL_OPTION= 844 fi 845 comprehensive_test "-DBUILD_SHARED_LIBS=ON" $test_type 846 fi 847 848 # Shared + nondynamic 849 if [ "$do_nondynamic" = "yes" ] ; then 850 OUTPUT_TREE="$prefix/nondynamic/$test_type/output_tree" 851 BUILD_TREE="$prefix/nondynamic/$test_type/build_tree" 852 INSTALL_TREE="$prefix/nondynamic/$test_type/install_tree" 853 INSTALL_BUILD_TREE="$prefix/nondynamic/$test_type/install_build_tree" 854 if [ "$do_submit_dashboard" = "yes" ] ; then 855 DASHBOARD_LABEL_OPTION="-DPLPLOT_BUILDNAME_SUFFIX:STRING=-(shared library + nondynamic devices)" 856 INSTALLED_DASHBOARD_LABEL_OPTION="-DPLPLOT_BUILDNAME_SUFFIX:STRING=-(installed shared library + nondynamic devices)" 857 else 858 DASHBOARD_LABEL_OPTION= 859 INSTALLED_DASHBOARD_LABEL_OPTION= 860 fi 861 comprehensive_test "-DBUILD_SHARED_LIBS=ON -DENABLE_DYNDRIVERS=OFF" $test_type 862 fi 863 864 # Static + nondynamic 865 if [ "$do_static" = "yes" ] ; then 866 OUTPUT_TREE="$prefix/static/$test_type/output_tree" 867 BUILD_TREE="$prefix/static/$test_type/build_tree" 868 INSTALL_TREE="$prefix/static/$test_type/install_tree" 869 INSTALL_BUILD_TREE="$prefix/static/$test_type/install_build_tree" 870 if [ "$do_submit_dashboard" = "yes" ] ; then 871 DASHBOARD_LABEL_OPTION="-DPLPLOT_BUILDNAME_SUFFIX:STRING=-(static library + nondynamic devices)" 872 INSTALLED_DASHBOARD_LABEL_OPTION="-DPLPLOT_BUILDNAME_SUFFIX:STRING=-(installed static library + nondynamic devices)" 873 else 874 DASHBOARD_LABEL_OPTION= 875 INSTALLED_DASHBOARD_LABEL_OPTION= 876 fi 877 comprehensive_test "-DBUILD_SHARED_LIBS=OFF" $test_type 878 fi 879done 880 881collect_exit 0 882