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 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203
|
#! /usr/bin/env perl
##
## Copyright (C) by Argonne National Laboratory
## See COPYRIGHT in top-level directory
##
# checkbuilds. Generated from checkbuilds.in by configure.
#
# Configure and build mpich with some of the options
#
# Set default values
$projects_dir = "/home/MPI/testing/tsuites";
# alt is for systems that have /homes instead of /home
$altprojects_dir = "/homes/MPI/testing/tsuites";
if (! -d $projects_dir && -d $altprojects_dir ) {
$projects_dir = $altprojects_dir;
}
$srcdir = "/home/MPI/testing/mpich2/mpich2";
$logname = $ENV{"LOGNAME"};
$tmpdir = "/sandbox/$logname";
# rundir is the directory in which to run the tests.
$rundir = "";
# By default, use random arguments for the tests
$use_rand_args = 1;
#
$is_xml = 0;
# Set the default compilers. These can be overridden by setting the CC
# and FC environment variables.
$ccname = "gcc";
$fcname = "f77";
#
# Set whether the C++ and Fortran bindings have been built.
$has_f77 = 1;
$has_cxx = 1;
# Set this for the make option to enable the execution of multiple job
# steps at once. Do not use this if the archive step (ar) is not setup
# to avoid concurrent, conflicting updates to the same archive.
$parallelBuild = "-j 8";
#$parallelBuild = "";
#
# Some process managers require separate startup and rundown steps. The
# following variables are used to handle this
$StartDemon = ""; # Name of routine to start demons
$StopDemon = ""; # Name of routine to stop demons
$hasDemon = 0;
#
# Set available options. For enable and with, the values are
# {with,enable}-name[;possiblevalues]*
# We need a way to keep these consistent with the arguments recognized by
# configure
@enable_array = (
'error-checking;no;runtime;all',
'error-messages;all;generic;class;none',
'timer-type;linux86_cycle;gethrtime;clock_gettime;gettimeofday',
'timing;none;all;runtime;log;log_detailed',
'g;none;all;handle;dbg;log;meminit;handlealloc;instr;mem;mutex;memarena',
'fast;nochkmsg;notiming;ndebug;all',
'f77',
'fc',
'cxx',
'romio',
'coverage',
'check-compiler-flags',
'smpcoll',
'strict;c99;posix', #;posix
'debuginfo', # Message queues
'weak-symbols;no;yes',
'threads;single;multiple;runtime',
'thread-cs;global;per-vci;lock-free',
'refcount;lock;lock-free;none',
'mutex-timing',
'multi-aliases',
'predefined-refcount',
'yield;sched_yield;yield;select;usleep;sleep',
'checkpointing',
'runtimevalues', # Fortran true/false
);
%chosenEnable = ();
@with_array = (
'logging;none;rlog',
'pmi;simple', #; uni no longer supported
'pm;gforker', #;remshell
'namepublisher;no;file', #;ldap:ldapserver',
'device;ch3;ch3:sock',
'wrapper-dl-type;runpath;rpath;none',
);
%chosenWith = ();
@env_array = (
# 'CC;gcc;cc;pgcc;ecc;xlc',
# 'FC;f77;pgf77;efc;xlf',
# 'CXX;gcc;CC;pgCC;ecc;xlC',
# 'CFLAGS;-g;-O',
);
# Also cross;sample-cross-files, but we need the files first
# Also missing are levels of thread support.
$n_enable = $#enable_array + 1;
$n_with = $#with_array + 1;
$n_env = $#env_array + 1;
$show = 0;
$debug = 0;
$echoSteps = 0; # Set to one to echo each run program to stdout
$report_signals = 1; # Set to one to generate a message about signals
# received by a program
$max_count = 5;
$OUTFD = OUTFD;
#
# The following variable separate the various sections
$TestStart = "-----------------------------------------------------------\n";
$TestEnd = "-----------------------------------------------------------\n";
$TestDateStart = "Run on ";
$TestDateEnd = "\n";
$TestHostStart = "Run on host ";
$TestHostEnd = "\n";
$TestUserStart = "Run by ";
$TestUserEnd = "\n";
$ConfigStart = " -- Begin Configure Step -- \n";
$ConfigEnd = " -- End Configure Step -- \n";
$MakeStart = " -- Begin Make Step --\n";
$MakeEnd = " -- End Make Step --\n";
$GlobNameStart = " -- Begin Check of global names --\n";
$GlobNameEnd = " -- End Check of global names --\n";
$UsedNameStart = " -- Begin Check of used names --\n";
$UsedNameEnd = " -- End Check of used names --\n";
$MakeInstStart = " -- Begin Make Install Step --\n";
$MakeInstEnd = " -- End Make Install Step --\n";
$MakeInstcheckStart = " -- Begin Make Installcheck Step --\n";
$MakeInstcheckEnd = " -- End Make Installcheck Step --\n";
$RunTestStart = " -- Begin Run Test Step --\n";
$RunTestEnd = " -- End Run Test Step --\n";
$SumStart = "";
$SumEnd = "";
$SumConfigStart = "Config status = ";
$SumConfigEnd = "\n";
$SumMakeStart = "Make status = ";
$SumMakeEnd = "\n";
$SumGlobStart = "Global name check status = ";
$SumGlobEnd = "\n";
$SumInstStart = "Install status = ";
$SumInstEnd = "\n";
$SumTestRunStart = "Test status = ";
$SumTestRunEnd = "\n";
# Defaults
$config_args = "";
$with_args = "";
$enable_args = "";
$env_args = "";
$outfile = "";
$builddir = "";
$instdir = "";
# Read the arguments
foreach $_ (@ARGV) {
if (/--?enable-n=(\d*)/) {
$n_enable = $1;
}
elsif (/--?with-n=(\d*)/) {
$n_with = $1;
}
elsif (/--?show/) {
$show = 1;
}
elsif (/--?debug/) {
$debug = 1;
}
elsif (/--?envopt=(.*)/) {
# Add a list of possible env values
$env_array[$#env_array+1] = $1;
$n_env = $#env_array + 1;
}
elsif (/--?srcdir=(.*)/) {
$srcdir = $1;
}
elsif (/--?instdir=(.*)/) {
$instdir = $1;
}
elsif (/--?rundir=(.*)/) {
$rundir = $1;
}
elsif (/--?projectsdir=(.*)/) {
$projects_dir = $1;
}
elsif (/--?maxcount=(.*)/) {
# max count. Set to -1 for infinity
$max_count = $1;
}
elsif (/--?maxtime=(.*)/) {
# max time in seconds
set_time_left( $1 );
}
elsif (/--?tests=(.*)/) {
$tests = ":" . $1 . ":";
}
elsif (/--?outfile=(.*)/) {
$outfile = $1;
}
elsif (/--?tmpdir=(.*)/) {
$tmpdir = $1;
}
elsif (/--?builddir=(.*)/) {
$builddir = $1;
}
elsif (/--?xml/) {
&XMLStyle;
$is_xml = 1;
}
elsif (/--?norand/) {
$use_rand_args = 0;
}
elsif (/--?enable=(.*)/) {
$use_rand_args = 0;
$enable_args .= "$1 ";
}
elsif (/--?with=(.*)/) {
$use_rand_args = 0;
$with_args .= "$1 ";
}
elsif (/--?env=(.*)/) {
$use_rand_args = 0;
$envval=$1;
$envval =~ s/ /<SP>/g;
$env_args .= "--env-$envval ";
}
elsif (/--?configarg=(.*)/) {
# Use this to add a special arg (such as -host) to the
# configure call
$config_args .= "$1 ";
}
elsif (/--?help/) {
print STDERR "\
checkbuilds [ -enable-n=d ] [ -with-n=d ] [ -show ] [-envopt=name;value;... ]
[-srcdir=SRCDIR] [-instdir=INSTALLDIR] [-builddir=BUILDDIR]
[-maxcount=MAXCNT] [-maxtime=MAXTIME]
[-norand ] [-enable=enable-args] [-with=with-args]
[-tmpdir=dir]
-enable-n=d sets the number of --enable options to try
-with=n=d set the number of --with options to try
-envopt=name;value;... adds an environment variable with possible
values (quote the text so that the semicolons do not
cause trouble)
-maxcount sets the number of builds to try
-maxtime sets the maximum length of time to run
Example:
checkbuilds -envopt=\"CC;gcc;pgcc;ecc\"\n";
exit(0);
}
else {
print STDERR "checkbuilds: Unrecognized argument $_\n";
exit(1);
}
}
#
# Set directories that have not been chosen.
if ($instdir eq "") {
$instdir = "$tmpdir/cb/mpi2-inst";
}
if ($mpich1_dir eq "") {
$mpich1_dir = "$projects_dir/mpich1test";
}
# Make the builddir compatible with the installation directory
if ($builddir eq "") {
$builddir = "$tmpdir/cb/mpich2";
}
# ---------------------------------------------------------------------------
#
# ---------------------------------------------------------------------------
# Run one instance of the configuration
sub RunTest {
my $makepgm;
$rc = chdir $builddir;
if (!$rc) {
print STDERR "Cannot change to $builddir\n";
return;
}
# Clean the installation and build directories
# Even better would be to remove the installation directory altogether,
# but we should only do that if explicitly requested (we could
# *require* an empty directory for the tests instead)
if (-d "$instdir/lib") {
system "rm -f $instdir/lib/libmpi*.* $instdir/lib/libmpifort*.*";
system "rm -f $instdir/lib/libmpe*.a";
}
if (-d "$instdir/bin") {
system "rm -f $instdir/bin/mpi*";
}
if (-d "$builddir/lib") {
system "rm -f $builddir/lib/libmpi*.* $builddir/lib/libmpifort*.*";
system "rm -f $builddir/lib/libmpe*.a";
}
#
# Create the with and enable options
#$enable_args = "--enable-strict"; # Only if compiler is gcc
# Chosen *without* replacement. If an option is chosen twice,
# then there will be fewer options
%chosenWith = ();
%chosenEnable = ();
if ($use_rand_args) {
$enable_args = &RandArgs( $n_enable, "enable_array", "enable", "disable" );
$with_args = &RandArgs ( $n_with, "with_array", "with", "without" );
# To set the environment, use the same code to set things up,
# then process the env array to set the environment
$env_args = &RandArgs( $n_env, "env_array", "env" );
}
foreach my $en (split(/\s+/,$enable_args)) {
if ($en =~ /--enable-([-A-Za-z0-9=]*)/) {
my $name = $1;
if ($name =~ /(.*)=(.*)/) {
$chosenEnable{$1} = $2;
$name = $1;
}
else {
$chosenEnable{$name} = "yes";
}
print STDERR "setting chosen enable of $name to $chosenEnable{$name}\n" if $debug;
}
}
foreach my $en (split(/\s+/,$with_args)) {
if ($en =~ /--with-([-A-Za-z0-9=]*)/) {
my $name = $1;
if ($name =~ /(.*)=(.*)/) {
$chosenWith{$1} = $2;
$name = $1;
}
else {
$chosenWith{$name} = "yes";
}
print STDERR "setting chosen with of $name to $chosenWith{$name}\n" if $debug;
}
}
$envset = "";
%saveENV = %ENV;
foreach $_ (split(/ /,$env_args)) {
if (/--env-([^=]*)=(.*)/) {
$name = $1;
$value = $2;
# Replace <SP> with blanks
$value =~ s/<SP>/ /g;
# Grrr <SP> is a bad choice, since <> are shell metacharacters.
# Allow --SP-- as an alternative
$value =~ s/--SP--/ /g;
print "Env $name = $value\n" if $debug;
# Since most of these so far are programs, we should check to
# see if they're available. Instead, we'll make the user
# specify the valid values (see -envopt above)
$ENV{$name} = $value;
$envset .= "$name = $value; ";
}
}
# Get the version of make to use
if (defined($ENV{"MAKE"})) {
$makepgm = $ENV{"MAKE"};
}
else {
$makepgm = "make";
}
# Check configure location
if ( ! (-x "$srcdir/configure") && (-x "./configure") ) {
$srcdir = ".";
}
$config_status = "none";
$make_status = "none";
$globcheck_status = "none";
# usedname is from the old test to check for which routines
# were loaded for the simplest MPI Hello World program.
#$usedname_status = "none";
$install_status = "none";
$installcheck_status = "none";
$test_status = "none";
if ($show) {
print "Configure: $enable_args $with_args $config_args\n";
if ($envset ne "") {
print "Environment = $envset\n";
}
}
else {
# $enable_args .= " --enable-echo";
print $OUTFD $TestStart;
my $host = `uname -n`;
print $OUTFD "$TestHostStart$host$TestHostEnd";
my $user = $ENV{"LOGNAME"};
print $OUTFD "$TestUserStart$user$TestUserEnd";
my $date = `date "+%Y-%m-%d-%H-%M"`;
print $OUTFD "$TestDateStart$date$TestDateEnd";
unlink "Makefile";
print $OUTFD $ConfigStart;
@config = split( /\s+/, "$srcdir/configure --prefix=$instdir $enable_args $with_args $config_args" );
print $OUTFD "Configure: " . join(" ", @config) . "\n";
if ($envset ne "") {
print $OUTFD "Environment = $envset\n";
}
$rc = &RunProgram( @config );
$config_status = $rc;
if (! -s "Makefile" && $rc == 0) {
$config_status = "No Makefile";
$rc = 1;
}
print $OUTFD $ConfigEnd;
# print "rc = $rc\n";
if ($rc == 0) {
print $OUTFD $MakeStart;
$rc = &RunProgram( "$makepgm $parallelBuild" );
print $OUTFD $MakeEnd;
$make_status = $rc;
if ($rc == 0) {
# Only perform these steps if the make succeeded
# FIXME: Restore the tests for nonconforming global systems and for
# minimum memory and routing footprint
# Deleted this test because it is no longer a design goal for MPICH
# that it have no nonconforming global symbols
# Deleted this test because it is no longer a design goal for MPICH2
# to have a minimum memory and routine footprint.
# Install the libraries
print $OUTFD $MakeInstStart;
# Clean the install directory
$install_status = &RunProgram( "$makepgm install" );
if ($install_status) {
my $cwd = `pwd`;
chomp $cwd;
print $OUTFD "Current directory is $cwd\n";
}
print $OUTFD $MakeInstEnd;
if ($install_status == 0) {
# Try the install check target
print $OUTFD $MakeInstcheckStart;
$installcheck_status = &RunProgram( "$makepgm installcheck" );
print $OUTFD $MakeInstcheckEnd;
# Run the tests
$test_status = &RunTestSuites;
}
}
}
print $OUTFD $TestEnd;
}
%ENV = %saveENV;
print $OUTFD $SumStart;
print $OUTFD $SumConfigStart;
print $OUTFD $config_status;
print $OUTFD $SumConfigEnd;
print $OUTFD $SumMakeStart;
print $OUTFD $make_status;
print $OUTFD $SumMakeEnd;
print $OUTFD $SumGlobStart;
print $OUTFD $globcheck_status;
print $OUTFD $SumGlobEnd;
print $OUTFD $SumInstStart;
print $OUTFD $install_status;
print $OUTFD $SumInstEnd;
print $OUTFD $SumTestRunStart;
print $OUTFD $test_status;
print $OUTFD $SumTestRunEnd;
print $OUTFD $SumEnd;
}
# ---------------------------------------------------------------------------
# Chosen *without* replacement. If an option is chosen twice,
# then there will be fewer options
sub RandArgs {
my ($n_choice, $array_name, $optname, $negoptname ) = @_;
my @chosen = ( );
my $args = "";
my $array_len = $#$array_name;
my $idx;
print "select $n_choice\n" if $debug;
for (my $i=0; $i<$n_choice; $i++) {
$idx = int( rand (1 + $array_len) );
print "Found $idx\n" if $debug;
if ($chosen[$idx]) { next; }
$chosen[$idx] = 1;
@args = split( /;/, $$array_name[$idx] );
print "Trying $$array_name[$idx]\n" if $debug;
$name = $args[0];
if ($#args == 0) {
# Only the name is provided. Choose one of three
# choices:
# No option (skip this one)
# just --$optname-$name
# just --$negoptname-$name (if non-null)
$idx = int ( rand ( 3 ) );
if ($idx == 0) {
$args .= " --$optname-$name";
}
elsif ($idx == 1 && $negoptname ne "") {
$args .= " --$negoptname-$name";
}
else {
# skip
;
}
}
else {
$idx = 1 + int( rand $#args );
$value = $args[$idx];
if ($value ne "") {
$args .= " --$optname-$name=$value";
}
else {
$args .= " --$optname-$name";
}
}
}
return $args;
}
# ---------------------------------------------------------------------------
# Timer support. Time_left returns 1 if time remains, 0 otherwise
$final_time = -1;
sub set_time_left {
my $delta_time = $_[0];
$final_time = time + $delta_time;
}
sub time_left {
if ($final_time eq "" || $final_time == -1) { return 1; }
if (time > $final_time) { return 0; }
else { return 1; }
}
# ---------------------------------------------------------------------------
# cb for check build
#
# Eventually, we'll need
# bootstep
# compiler names
# unbootstep
# for each test.
#
sub RunTestSuites {
my $run_status = 0;
my $r_status = 0;
# Start by adding "notest" files to any optional tests
if (!$has_cxx) {
&SkipCxxTestSuite;
}
foreach my $testname (split(':',$tests)) {
if ($testname eq "") { next; }
print $OUTFD $RunTestStart;
if ($is_xml) {
print $OUTFD "<TESTNAME>$testname</TESTNAME>\n";
print $OUTFD "<TESTOUT>\n";
}
else {
print $OUTFD "Running test $testname...\n";
}
# Eventually, we should store the test routines in a hash,
# with the key the test name and the value the name of the
# routine.
if ($testname eq "mpich") {
&RunMpichTestSuite;
}
elsif ($testname eq "intel") {
&RunIntelTestSuite;
}
elsif ($testname eq "testmpio") {
&RunTestMPIOSuite;
}
elsif ($testname eq "mpicxx" && $has_cxx) {
&RunCxxTestSuite;
}
elsif ($testname eq "mpich2") {
&RunMPICH2TestSuite;
}
else {
print $OUTFD "checkbuilds: Unrecognized test $testname\n";
}
if ($is_xml) {
print $OUTFD "</TESTOUT>\n";
}
print $OUTFD $RunTestEnd;
if ($run_status != 0) {
# If any test fails, record its status.
$r_status = $run_status;
}
}
return $r_status;
}
# ---------------------------------------------------------------------------
sub RunMpichTestSuite {
my $nargs;
$cwd = `pwd`;
chomp $cwd;
my @config;
if ($mpich_test_dir eq "") {
$mpich_test_dir = "$tmpdir/cb/mpitest";
}
# Make sure that the tests run past a failure to build an
# executable. Without this, the summary doesn't include
# any tests in the same directory that completed.
$ENV{"MPITEST_CONTINUE"} = "always";
$rc = chdir $mpich_test_dir;
if (!$rc) {
#print STDERR "Cannot change to $mpich_test_dir\n";
return;
}
# A special hack for the io part
# If there is no link or io directory, create one and populate it
if (! -f "io/Mfile.in") {
if (-s "$mpich1_dir/io/Mfile.in") {
if (! -d "io" && ! -l "io") {
`mkdir "io"`;
}
`cp $mpich1_dir/io/*.in io`;
}
elsif (-s "$srcdir/src/mpi/romio/test/Mfile.in") {
if (! -d "io" && ! -l "io") {
`mkdir "io"`;
}
`cp $srcdir/src/mpi/romio/test/*.in io`;
}
# Else, we can't find the IO tests, so we don't create the io
# directory
}
# Create the arguments for the configure step
$nargs = 0;
$config[$nargs++] = "$mpich1_dir/configure";
$config[$nargs++] = "--prefix=$instdir";
$config[$nargs++] = "-mpilibname=mpich";
if (defined($chosenEnable{"romio"})) {
$config[$nargs++] = "--enable-io";
}
# f77 is now the default, so we should run with the f77 tests
# unless we did not build f77
if (! $has_f77) { # !defined($chosenEnable{"f77"})
$config[$nargs++] = "--disable-f77";
}
# This isn't right, since these need to use the compilation
# scripts. We'll approximate this by trying to use the
# compilation scripts if they're found
if (defined($ENV{"CC"})) {
$ccname = $ENV{"CC"};
}
if (defined($ENV{"FC"})) {
$fcname = $ENV{"FC"};
}
# Note that there are no quotes in the following because
# they are not needed (no shell evaluation here)
if (-x "$instdir/bin/mpicc" ) {
$config[$nargs++] = "-cc=$instdir/bin/mpicc";
}
else {
$config[$nargs++] = "-cc=$ccname -I$instdir/include -L$instdir/lib";
}
if (-x "$instdir/bin/mpifort" ) {
$config[$nargs++] = "-fc=$instdir/bin/mpifort";
}
else {
$config[$nargs++] = "-fc=$fcname -I$instdir/include -L$instdir/lib";
}
# Add $config[$nargs++] = "--enable-coverage";
# if we build mpich2 with the coverage switch.
if (defined($ENV{"MAKE"})) {
$makepgm = $ENV{"MAKE"};
$config[$nargs++] = "-make=$makepgm";
}
else {
$makepgm = "make";
}
#$config[$nargs++] = "--enable-echo";
%saveENV = %ENV;
$ENV{MPIRUN} = "$instdir/bin/mpiexec";
# This timeout needs to be made uniform for all mpiruns
# 3 minutes is enough for some of our slower machines
$ENV{MPIEXEC_TIMEOUT} = "180";
$rc = &RunProgram( @config );
if ($rc == 0) {
if ($hasDemon) {
&$StartDemon;
}
$rc = &RunProgram( "$makepgm testing" );
$test_status = $rc;
if ($run_status == 0 && $rc != 0) { $run_status = $rc; }
if ($hasDemon) {
&$StopDemon;
}
}
else {
$run_status = $rc;
print $OUTFD "Configure step for test failed\n";
print $OUTFD "Could not execute " . join(" ", @config) . "\n";
print $OUTFD "Environment was\n";
foreach $key (keys(%ENV)) {
my $line = "$key = $ENV{$key}";
if ($is_xml) { $line = &XMLify( $line ); }
print $OUTFD "$line\n";
}
}
%ENV = %saveENV;
chdir $cwd;
}
# ---------------------------------------------------------------------------
sub SkipCxxTestSuite {
if ($mpicxx_test_dir eq "") {
$mpicxx_test_dir = "$tmpdir/cb/mpicxxtest";
}
`date > $mpicxx_test_dir/notest`;
}
sub RunCxxTestSuite {
my $nargs = 0;
$cwd = `pwd`;
chomp $cwd;
my @config;
if ($mpicxx_test_dir eq "") {
$mpicxx_test_dir = "$tmpdir/cb/mpicxxtest";
}
#
# First, check for the mpicxx program
if (! -x "$instdir/bin/mpicxx" || !defined($chosenEnable{"cxx"})) {
# Probably built without C++ support
$run_status = 0;
&SkipCxxTestSuite;
return;
}
$rc = chdir $mpicxx_test_dir;
if (!$rc) {
#print STDERR "Cannot change to $mpicxx_test_dir\n";
return;
}
# Remove any "notest" file
if (-s "notest") { unlink "notest"; }
$config[$nargs++] = "$projects_dir/mpicxxtest/configure";
$config[$nargs++] = "--with-mpich=$instdir";
$config[$nargs++] = "--enable-xml";
if (defined($ENV{"MAKE"})) {
$makepgm = $ENV{"MAKE"};
}
else {
$makepgm = "make";
}
%saveENV = %ENV;
# This timeout needs to be made uniform for all mpiruns
# 3 minutes is enough for some of our slower machines
$ENV{MPIEXEC_TIMEOUT} = "180";
$rc = &RunProgram( @config );
if ($rc == 0) {
if ($hasDemon) {
&$StartDemon;
}
$rc = &RunProgram( "$makepgm run-tests" );
$test_status = $rc;
if ($run_status == 0 && $rc != 0) { $run_status = $rc; }
# This step converts the summary.xml file into a valid XML file
# by adding the appropriate header and footer
$rc = &RunProgram( "$makepgm get-summary" );
if ($hasDemon) {
&$StopDemon;
}
}
else {
$run_status = $rc;
print $OUTFD "Configure step for test failed\n";
print $OUTFD "Could not execute " . join(" ", @config) . "\n";
print $OUTFD "Environment was\n";
foreach $key (keys(%ENV)) {
my $line = "$key = $ENV{$key}";
if ($is_xml) { $line = &XMLify( $line ); }
print $OUTFD "$line\n";
}
}
%ENV = %saveENV;
chdir $cwd;
}
# Run the LLNL IO Test suite
sub RunTestMPIOSuite {
my $nargs = 0;
my $testname = "testing";
$cwd = `pwd`;
chomp $cwd;
my @config;
if ($testmpio_test_dir eq "") {
$testmpio_test_dir = "$tmpdir/cb/testmpio";
}
$rc = chdir $testmpio_test_dir;
if (!$rc) {
print $OUTFD "Cannot change to $testmpio_test_dir\n";
return;
}
# Switch to using the checked-in version of the Testmpio test
if (-x "$projects_dir/testmpio/configure") {
$config[$nargs++] = "$projects_dir/testmpio/configure";
}
elsif (-x "$projects_dir/Testmpio/configure") {
$config[$nargs++] = "$projects_dir/Testmpio/configure";
}
else {
print $OUTFD "Cannot find testmpio source directory!";
return;
}
$config[$nargs++] = "--enable-xml";
$config[$nargs++] = "CC=$instdir/bin/mpicc";
$config[$nargs++] = "MPIEXEC=$instdir/bin/mpiexec";
if (defined($ENV{"MAKE"})) {
$makepgm = $ENV{"MAKE"};
}
else {
$makepgm = "make";
}
%saveENV = %ENV;
# This timeout needs to be made uniform for all mpiruns
# 3 minutes is enough for some of our slower machines
$ENV{MPIEXEC_TIMEOUT} = "180";
$rc = &RunProgram( @config );
if ($rc == 0) {
if ($hasDemon) {
&$StartDemon;
}
$rc = &RunProgram( "$makepgm $testname" );
$test_status = $rc;
if ($run_status == 0 && $rc != 0) { $run_status = $rc; }
if ($hasDemon) {
&$StopDemon;
}
if ($test_status != 0) {
# Try to figure out what went wrong.
if (-s "Test/test.results") {
&CopyFileToOutput( "Test/test.results" );
}
}
}
else {
$run_status = $rc;
print $OUTFD "Configure step for test failed\n";
print $OUTFD "Could not execute " . join(" ", @config) . "\n";
print $OUTFD "Environment was\n";
foreach $key (keys(%ENV)) {
my $line = "$key = $ENV{$key}";
if ($is_xml) { $line = &XMLify( $line ); }
print $OUTFD "$line\n";
}
}
%ENV = %saveENV;
chdir $cwd;
}
sub RunIntelTestSuite {
my $nargs = 0;
my $testname = "newtestl";
$cwd = `pwd`;
chomp $cwd;
my @config;
if ($intel_test_dir eq "") {
$intel_test_dir = "$tmpdir/cb/MPITEST";
}
$rc = chdir $intel_test_dir;
if (!$rc) {
#print STDERR "Cannot change to $intel_test_dir\n";
return;
}
# Switch to using the checked-in version of the Intel test
$config[$nargs++] = "$projects_dir/IntelMPITEST/configure";
$config[$nargs++] = "--with-mpich2=$instdir";
# The Absoft Fortran compiler fails some tests if MAX_RANKS
# (used to dimension some arrays) is too large. Since the
# default tests never use more than 6 processes, setting a
# maximum of 16 is safe.
$config[$nargs++] = "--enable-maxprocs=16";
# f77 is now the default, so we should run with the f77 tests
# unless we did not build f77
if (!$has_f77) { # defined($chosenEnable{"f77"})
# Only run the C tests if we did not build fortran
$config[$nargs++] = "--disable-f77";
$testname = "newtestl_c";
}
if (defined($ENV{"MAKE"})) {
$makepgm = $ENV{"MAKE"};
}
else {
$makepgm = "make";
}
%saveENV = %ENV;
# This timeout needs to be made uniform for all mpiruns
# 3 minutes is enough for some of our slower machines
$ENV{MPIEXEC_TIMEOUT} = "180";
$rc = &RunProgram( @config );
if ($rc == 0) {
if ($hasDemon) {
&$StartDemon;
}
$rc = &RunProgram( "$makepgm $testname" );
$test_status = $rc;
if ($run_status == 0 && $rc != 0) { $run_status = $rc; }
if ($hasDemon) {
&$StopDemon;
}
if ($test_status != 0) {
# Try to figure out what went wrong.
if (-s "Test/test.results") {
&CopyFileToOutput( "Test/test.results" );
}
if (! -s "lib/libmpitestf_mpich2.a" &&
-s "lib/makeflib.log") {
&CopyFileToOutput( "lib/makeflib.log" );
}
if (! -s "lib/libmpitest_mpich2.a" &&
-s "lib/makeclib.log") {
&CopyFileToOutput( "lib/makeclib.log" );
}
}
}
else {
$run_status = $rc;
print $OUTFD "Configure step for test failed\n";
print $OUTFD "Could not execute " . join(" ", @config) . "\n";
print $OUTFD "Environment was\n";
foreach $key (keys(%ENV)) {
my $line = "$key = $ENV{$key}";
if ($is_xml) { $line = &XMLify( $line ); }
print $OUTFD "$line\n";
}
}
%ENV = %saveENV;
chdir $cwd;
}
sub RunMPICH2TestSuite {
my $nargs = 0;
my $makepgm;
$cwd = `pwd`;
chomp $cwd;
# This must match the directory into which mpich2 was built for
# us to use the configure there.
if ($mpich2_test_dir eq "") {
$mpich2_test_dir = "$builddir/test/mpi";
}
$rc = chdir $mpich2_test_dir;
if (!$rc) {
#print STDERR "Cannot change to $mpich2_test_dir\n";
return;
}
# MPICH2 tests are already built, so no configure step required
%saveENV = %ENV;
#
# Make sure that there a no leftovers
# Get the version of make to use
if (defined($ENV{"MAKE"})) {
$makepgm = $ENV{"MAKE"};
}
else {
$makepgm = "make";
}
&RunProgram( "$makepgm clean" );
# This timeout needs to be made uniform for all mpiruns
# 3 minutes is enough for some of our slower machines
$ENV{MPIEXEC_TIMEOUT} = "180";
if ($hasDemon) {
&$StartDemon;
}
# The MPICH2 test suite has a program for running the tests
$rc = &RunProgram( "./runtests -mpiexec=$instdir/bin/mpiexec -srcdir=$srcdir/test/mpi -tests=testlist -xmlfile=summary.xml" );
$test_status = $rc;
if ($run_status == 0 && $rc != 0) { $run_status = $rc; }
if ($hasDemon) {
&$StopDemon;
}
%ENV = %saveENV;
chdir $cwd;
}
# ---------------------------------------------------------------------------
# RunProgram LIST
sub RunProgram {
my $signal_num = 0;
if ($echoSteps) {
my $cmd = join(' ',@_);
my $curdir = `pwd`;
chomp $curdir;
print STDOUT "Running $cmd in $curdir\n";
}
# perl does not correctly handle ">>foo 2>&1" redirection in system
# correctly (some stderr escapes to the prior stderr). This
# code attempts to do the correct thing.
# By reopening stdout and stderr, we can ensure that all of the
# output goes to the specified files. Unfortunately, we can't
# force perl to correctly flush files without open/close, so
# we close the output file before the fork. This guarantees that
# the data is flushed. We reopen it after the fork (which is implicit
# in the open)
if ($outfile ne "") {
close $OUTFD;
}
# We now use a different approach that uses a open that creates a
# fork and associates file handle (CFD for Child FD).
@args = @_;
$pid = open(CFD,"-|");
if ($pid == 0) {
# we're the child
open STDIN, '/dev/null';
# Do we want to allow an output filter, e.g., to convert the
# output into well-formed XML?
open STDERR, ">>&STDOUT";
exec @args;
die "Could not exec program $args[0]\n";
}
else {
# Read from the child
if ($outfile ne "") {
open( $OUTFD, ">>$outfile" ) || die "Could not reopen $outfile for appending\n";
}
while (<CFD>) {
if ($is_xml) {
$_ = &XMLify( $_ );
}
print $OUTFD $_;
}
# Closing a pipe implicitly waits for the command on the other
# end to complete, and puts the exit status into $?
close CFD;
# end of read from the child
# Note that this status is usually shifted right by 8, so
# we check for that
$rc = $?;
$signal_num = $rc & 127;
if ($rc > 255) { $rc = $rc >> 8; }
if ($signal_num != 0 && $report_signals) {
print OUTFD "Process exited with signal $signal_num\n";
}
}
if ($echoSteps) {
print STDOUT "Completed command with status $rc\n";
}
return $rc;
}
#
# Change output style
sub XMLStyle {
$TestStart = "<BUILDTEST>\n";
$TestEnd = "</BUILDTEST>\n";
$TestDateStart = "<DATE>\n";
$TestDateEnd = "</DATE>\n";
$TestHostStart = "<HOST>\n";
$TestHostEnd = "</HOST>\n";
$TestUserStart = "<USER>\n";
$TestUserEnd = "</USER>\n";
$ConfigStart = "<CONFIG>\n";
$ConfigEnd = "</CONFIG>\n";
$MakeStart = "<MAKE>\n";
$MakeEnd = "</MAKE>\n";
$GlobNameStart = "<GLOBNAME>\n";
$GlobNameEnd = "</GLOBNAME>\n";
$UsedNameStart = "<USEDNAMES>\n";
$UsedNameEnd = "</USEDNAMES>\n";
$MakeInstStart = "<MAKEINST>\n";
$MakeInstEnd = "</MAKEINST>\n";
$MakeInstcheckStart = "<MAKEINSTCHECK>\n";
$MakeInstcheckEnd = "</MAKEINSTCHECK>\n";
$RunTestStart = "<RUNTEST>\n";
$RunTestEnd = "</RUNTEST>\n";
$SumStart = "<SUMMARY>\n";
$SumEnd = "</SUMMARY>\n";
$SumConfigStart = "<STATUS NAME=\"configure\">";
$SumConfigEnd = "</STATUS>\n";
$SumMakeStart = "<STATUS NAME=\"make\">";
$SumMakeEnd = "</STATUS>\n";
$SumGlobStart = "<STATUS NAME=\"globname\">";
$SumGlobEnd = "</STATUS>\n";
$SumInstStart = "<STATUS NAME=\"install\">";
$SumInstEnd = "</STATUS>\n";
$SumTestRunStart = "<STATUS NAME=\"test\">";
$SumTestRunEnd = "</STATUS>\n";
}
# ---------------------------------------------------------------------------
#
# Other options
# --enable-threads={single, multiple}
# ---------------------------------------------------------------------------
# Here's the real code to execute
# ---------------------------------------------------------------------------
if ($rundir ne "") {
chdir $rundir || die "could not change directory to $rundir\n";
}
# Select the output file
if ($outfile ne "") {
if (! ($outfile =~ /^\//) ) {
# Ensure that we have an absolute directory for the output file
my $curdir = `pwd`;
chop $curdir;
$outfile = "$curdir/$outfile";
}
open( $OUTFD, ">$outfile" ) || die "Could not open $outfile for writing\n";
# Setting autoflush is not enough to ensure that output is
# correctly ordered when child processes also write to the file.
# All of the shells get this right but unfortunately perl does not.
#autoflush $OUTFD 1;
if ($is_xml) {
print $OUTFD "<?xml version='1.0' ?>\n";
print $OUTFD "<?xml-stylesheet href=\"build.xsl\" type=\"text/xsl\" ?>\n";
print $OUTFD "<MPICH2BUILD>\n";
}
}
else {
$OUTFD = STDOUT;
}
# ---------------------------------------------------------------------------
#
# There are several ways to run the tests. They are
# For a fixed number of times
# For a fixed length of time
for ($test_count = 0;
($max_count < 0 || $test_count < $max_count) && &time_left;
$test_count++) {
if ($is_xml) {
}
else {
print $OUTFD "\nRunning test $test_count\n\n";
}
&RunTest;
}
if ($is_xml) {
print $OUTFD "</MPICH2BUILD>\n";
}
close $OUTFD;
sub CopyFileToOutput {
my $filename = $_[0];
my $linecount = 256;
if (open( TESTFD, "<$filename" )) {
print $OUTFD "First $linecount lines of $filename\n";
while (<TESTFD>) {
if ($linecount <= 0) { last; }
if ($is_xml) {
$_ = &XMLify( $_ );
}
print $OUTFD $_;
$linecount --;
}
close (TESTFD);
}
}
sub XMLify {
my $line = $_[0];
my $itcount = 0;
# xml-ify the line by escaping the special characters
$line =~ s/</\*AMP\*lt;/g;
$line =~ s/>/\*AMP\*gt;/g;
$line =~ s/&/\*AMP\*amp;/g;
$line =~ s/\*AMP\*/&/g;
# Handle non-printing ascii characters (e.g., ones that emacs would
# print as \200). XML may refuse to display non-printing characters
# BUG IN PERL: The negated POSIX character class does not work!
# It isn't clear whether ANY of the POSIX character classes work
# while ($line =~ /^([:print:]*)([:^print:])(.*)/s) {
# Instead, we use an explicit ASCII range, and include tab characters
while ($line =~ /^([ -~\t]*)([^ -~\t\n])(.*)/s) {
# Grr. This doesn't work either. The character conversion
# gets lost. However, this is still better than including
# a nonprinting character in the output
$char = $2;
$hexversion = sprintf( "\\%03x", $char );
$line = $1 . $hexversion . $3;
if ($itcount++ > 100) { last; }
}
return $line;
}
|