#!/bin/sh # # Copyright (c) 2004-2005 The Trustees of Indiana University. # All rights reserved. # Copyright (c) 2004-2005 The Trustees of the University of Tennessee. # All rights reserved. # Copyright (c) 2004-2005 High Performance Computing Center Stuttgart, # University of Stuttgart. All rights reserved. # Copyright (c) 2004-2005 The Regents of the University of California. # All rights reserved. # $COPYRIGHT$ # # Additional copyrights may follow # # $HEADER$ # # This script is used to make a report of how may unimplemented # top-level MPI functions exist. # # $1: scratch root # $2: e-mail address for destination # $3: URL_ARG # scratch_root_arg="$1" email_arg="$2" url_arg="$3" # Set this to any value for additional output; typically only when # debugging debug= # do you want a success mail? want_success_mail=1 # download "latest" filename latest_name="latest_snapshot.txt" # checksum filenames md5_checksums="md5sums.txt" sha1_checksums="sha1sums.txt" # max length of logfile to send in an e-mail max_log_len=250 # email subject subject="Unimplemented function report" # max number of snapshots to keep downloaded max_snapshots=3 # files to not report skip='accumulate.c|^get.c$|put.c|^win_' ############################################################################ # Shouldn't need to change below this line ############################################################################ start_time="`date`" # This gets filled in later config_guess= # Sanity checks if test -z "$scratch_root_arg" -o -z "$email_arg" -o -z "$url_arg"; then echo "Must specify scratch root directory, e-mail address, and URL_ARG" exit 1 fi # send a mail # should only be called after logdir is set send_error_mail() { outfile="$scratch_root_arg/output.txt" rm -f "$outfile" touch "$outfile" for file in `/bin/ls $logdir/* | sort`; do len="`wc -l $file | awk '{ print $1}'`" if test "`expr $len \> $max_log_len`" = "1"; then tail -$max_log_len "$file" >> "$outfile" else cat "$file" >> "$outfile" fi done $mail -s "Failed report" "$email_arg" < "$outfile" rm -f "$outfile" } # send output error message die() { msg="$*" cat > "$logdir/00_announce.txt" < "$logfile" 2>&1 st=$? echo "*** Command complete: exit status: $st" else eval $cmd > "$logfile" 2>&1 st=$? fi if test "$st" != "0"; then cat > "$logdir/15-error.txt" < "$logdir/25-error.txt" < /dev/null 2>&1 if test "$?" = "0" -a -z "$not_found"; then str="$var=$prog" eval $str am_done=1 fi fi done } # Find a mail program find_program mail Mail mailx mail if test -z "$mail"; then echo "Could not find mail program; aborting in despair" exit 1 fi # figure out what download command to use find_program download wget lynx curl if test -z "$download"; then echo "cannot find downloading program -- aborting in despair" exit 1 fi # move into the scratch directory, and ensure we have an absolute path # for it if test ! -d "$scratch_root_arg"; then mkdir -p "$scratch_root_arg" fi if test ! -d "$scratch_root_arg"; then echo "Could not cd to scratch root: $scratch_root_arg" exit 1 fi cd "$scratch_root_arg" scratch_root_arg="`pwd`" logdir="$scratch_root_arg/logs" # ensure some subdirs exist for dir in downloads logs; do if test ! -d $dir; then mkdir $dir fi done # get the latest snapshot version number cd downloads rm -f "$latest_name" do_command $download "$url_arg/$latest_name" if test ! -f "$latest_name"; then die "Could not download latest snapshot number -- aborting" fi version="`cat $latest_name`" # see if we need to download the tarball tarball_name="openmpi-$version.tar.gz" if test ! -f "$tarball_name"; then do_command $download "$url_arg/$tarball_name" if test ! -f "$tarball_name"; then die "Could not download tarball -- aborting" fi # get the checksums rm -f "$md5_checksums" "$sha1_checksums" do_command $download "$url_arg/$md5_checksums" do_command $download "$url_arg/$sha1_checksums" fi # verify the checksums md5_file="`grep $version.tar.gz $md5_checksums`" find_program md5sum md5sum if test -z "$md5sum"; then cat > $logdir/05_md5sum_warning.txt < $logdir/05_md5sum_warning.txt < $logdir/06_sha1sum_warning.txt < $logdir/06_sha1sum_warning.txt < "$report_c" total_c="`ls -1 *.c | wc -l | awk '{ print $1 }'`" num_c="`wc -l $report_c | awk '{ print $1 }'`" # count unimplemented F77 functions cd ../f77 grep -ls "not yet implemented" *.c > "$report_f77" total_f77="`ls -1 *.c | wc -l | awk '{ print $1 }'`" num_f77="`wc -l $report_f77 | awk '{ print $1 }'`" # trim the downloads dir to $max_snapshots cd "$scratch_root_arg/downloads" for ext in gz; do count="`ls openmpi*.tar.$ext | wc -l | awk '{ print $1 }'`" if test "`expr $count \> $max_snapshots`" = "1"; then num_old="`expr $count - $max_snapshots`" old="`ls -rt openmpi*.tar.$ext | head -n $num_old`" rm -f $old fi done # send success mail $mail -s "$subject" "$email_arg" <