This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] new contrib/apps_test to test apps from release criteria


This patch adds a script, apps_test, to the contrib directory.  The
script builds and tests some of the applications listed in the GCC 3.1
release criteria.  As an added bonus, for some of them it can build a
library with one version of GCC and then run the tests for that library
using a different version, providing a basic form of interoperability
testing.  I've occasionally thought about integrating these apps into
regression testing but don't think that's really feasible.

By default, each application is built with the optimizations that are
normally used for that package.  For most of them those options can be
overridden.  Besides using the interoperability testing for different
versions of GCC, it can be used with different sets of options that are
not supposed to affect code compatibility.

I've been using a version of this script since March (during the 3.1
stabilization period) for nightly testing of the release branch on
ia64-unknown-linux-gnu and just recently made cleanups and changes for
interoperability testing.  For the 3.2 branch, everything passes on
i686-pc-linux-gnu and ia64-unknown-linux-gnu, and the interoperability
tests pass with the 3.2 branch plus the 3.2 release.  With the mainline,
however, there are failures (yet to be investigated) on both of those
platforms.

Some of the applications need additional support to be configured for
systems other than GNU/Linux, which this script does not yet provide and
which I realize is major hole.  In spite of that, would it be acceptable
to add this script to contrib?

2002-09-09  Janis Johnson  <janis187@us.ibm.com>

	* apps_test: New file.

--- empty	Wed Jan  2 10:14:44 2002
+++ apps_test	Sun Sep  8 21:45:38 2002
@@ -0,0 +1,1011 @@
+#! /bin/sh
+
+########################################################################
+#
+# Build one or more applications with a specified GCC installation and
+# specified compilation options.  Some applications are build-only, and
+# some have test suites and/or performance suites.  Some are set up to
+# build libraries with one compiler and then run tests that use that
+# library with an interoperable version of GCC.  The same mechanism can
+# be used to test the same compiler (specified twice) with two different
+# sets of options that are not expected to affect interoperability.
+#
+# See usage() for the list of options and actions, or invoke this script
+# with -h.
+#
+# Here are the applications this script builds and tests, the language
+# in which each is written, whether it is set up to do interoperability
+# testing, and how long it takes to run on a 750 MHz Pentium III
+# (i686-pc-linux-gnu) with GCC 3.2:
+#
+#   Blitz       C++     yes    15 minutes
+#   Boost       C++     yes    20 minutes
+#   GNU Emacs   C       no      5 minutes
+#   FTensor     C++     no     10 minutes
+#   LAPACK      F77     yes    30 minutes
+#   POOMA       C++     no     10 minutes
+#   Qt          C++     yes    40 minutes
+#
+# These applications can be downloaded from:
+#
+#   http://www.oonumerics.org/blitz/download/snapshots/blitz-20001213.tar.gz
+#   http://www.boost.org/boost_all.tar.gz
+#   ftp://gatekeeper.dec.com/pub/GNU/emacs/emacs-21.2.tar.gz
+#   http://www.oonumerics.org/FTensor/FTensor_gcc_integration_test.tar.gz 
+#   http://www.netlib.org/lapack/lapack.tgz
+#   ftp://gcc.gnu.org/pub/gcc/infrastructure/pooma-gcc.tar.gz
+#   ftp://ftp.trolltech.com/qt/source/qt-x11-2.3.0.tar.gz
+#
+# Disclaimer: This script has only been tested on GNU/Linux systems.
+#
+# Copyright (C) 2002 Free Software Foundation.
+# Originally by Janis Johnson <janis187@us.ibm.com>, September 2002.
+#
+# This file is part of GCC.
+#
+# GCC is free software; you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation; either version 2, or (at your option) any later
+# version.
+#
+# GCC is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING.  If not, write to the Free
+# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
+# 02111-1307, USA.
+#
+########################################################################
+
+########################################################################
+# Definitions.  These are dependent on the versions of the applications.
+########################################################################
+
+# Specify the location of the tarball for each application.  This
+# assumes they are in the same directory, which is either defined in
+# the environment as TARBALLS or passed as an argument to this script
+# with -t.
+
+BLITZ_TARBALL=blitz-20001213.tar.gz
+BOOST_TARBALL=boost_all.tar.gz
+EMACS_TARBALL=emacs-21.2.tar.gz
+FTENSOR_TARBALL=FTensor_gcc_integration_test.tar.gz
+LAPACK_TARBALL=lapack.tgz
+POOMA_TARBALL=pooma-gcc.tar.gz
+QT_TARBALL=qt-x11-2.3.0.tar.gz
+
+# These are the names of the directories from the tarballs.  If you're
+# using different versions of the applications you'll need to change
+# these names.
+
+BLITZ_BUILD=blitz-20001213
+BOOST_BUILD=boost_1_27_0
+EMACS_BUILD=emacs-21.2
+FTENSOR_BUILD=FTensor--main--1.1--patch-16
+LAPACK_BUILD=LAPACK
+POOMA_BUILD=pooma-gcc
+QT_BUILD=qt-2.3.0
+
+# If optimization flags are not specified then we default to the flags
+# with which each application is normally built.
+
+BOOST_DEFAULT_OPTS=""
+EMACS_DEFAULT_OPTS="-O2"
+FTENSOR_TEST_DEFAULT_OPTS="-g"
+FTENSOR_TIME_DEFAULT_OPTS="-O3 -finline-functions -finline-limit-1000000 -ffast-math -fno-rtti -fno-exceptions"
+LAPACK_DEFAULT_OPTS="-O2"
+QT_DEFAULT_OPTS="-pipe -O2"
+
+# Some applications use configuration files that we need to update.
+
+BOOST_CONFIG=status/compiler.cfg
+QT_CONFIG=configs/linux-g++-shared
+POOMA_CONFIG=config/arch/LINUXgcc-template.conf
+
+# Specify the complete list of Blitz tests so that they can be built and
+# run separately, allowing the rest of the tests to be run after one fails.
+
+BLITZ_TESTS="ctors initialize storage shapecheck reduce derrick-bass-1 \
+        qcd loop1 peter-nordlund-1 shape interlace promote arrayresize \
+        minmax transpose reverse extract free \
+        chris-jeffery-1 where minsumpow gary-huber-1 \
+        derrick-bass-3 constarray chris-jeffery-2 reindex Ulisses-Mello-1 \
+        peter-bienstman-1 complex peter-nordlund-3 \
+        newet peter-bienstman-3 troyer-genilloud peter-nordlund-2 \
+        peter-bienstman-2 iter contiguous exprctor Olaf-Ronneberger-1 \
+        peter-bienstman-4 tinymat wei-ku-1 \
+        theodore-papadopoulo-1 peter-bienstman-5 Adnene-Ben-Abdallah-2 \
+        Josef-Wagenhuber esler-losio"
+
+# These make targets are used for LAPACK testing.  The lists can be
+# shortened if some targets have problems.  If we're doing
+# interoperability testing, the first list is built with the alternate
+# compiler and the rest with the compiler under test.
+
+LAPACK_BUILD_LIST="install blaslib lapacklib tmglib"
+LAPACK_TEST_LIST="testing blas_testing"
+LAPACK_TIME_LIST="timing blas_timing"
+
+# These make targets are used for Qt testing.  If we're doing
+# interoperability testing, the first list is built with the alternate
+# compiler and the rest with the compiler under test.
+
+ALT_QT_TARGETS="src-moc src-mt sub-src"
+GCC_QT_TARGETS="sub-tools sub-tutorial sub-examples"
+
+# Some apps require GNU make and expect it to be called gmake.
+
+alias gmake=make
+GZIP="${GZIP-gzip}"
+DATE="${DATE-date}"
+
+########################################################################
+# Common functions.
+########################################################################
+
+# Issue a usage message explaining how to use this script.
+
+usage() {
+cat <<EOF
+usage: apps_test [options] [actions]
+       -h             Display this help information
+       -a dir         Installation directory for alternate compiler for
+                      interoperability testing (not all tests use this)
+                      (overrides environment variable ALT_INST)
+       -d dir         Compiler installation directory
+                      (overrides environment variable GCC_INST)
+       -f flags       Compiler optimization flags
+                      (overrides environment variable GCC_OPTS)
+       -g flags       Optimization flags for alternate compiler
+                      (overrides environment variable ALT_OPTS)
+       -t dir         Tarball directory
+                      (overrides environment variable TARBALLS)
+       -u             Start from scratch, unpacking the tarball
+       blitz          Build and test Blitz
+       blitz_all      Build and test Blitz and build its examples
+       boost          Build and test Boost
+       emacs          Build GNU Emacs
+       ftensor        Build, test, and time FTensor
+       ftensor_test   Build and test FTensor
+       ftensor_time   Build and time FTensor
+       lapack_build   Build LAPACK
+       lapack         Build and test LAPACK
+       lapack_time    Build, test, and benchmark LAPACK
+       pooma          Build and test POOMA
+       qt             Build Qt
+EOF
+  exit 1
+}
+
+# Issue the error message given by the argument and set a flag.
+
+error() {
+  echo "apps_test: error: ${1}"
+  ERROR=1
+}
+
+# Issue the message preceded by the current time and date.  Turn this
+# off by defining DATE to be 'true'.
+
+msg() {
+  echo "`${DATE}`  ${1}"
+}
+
+# Change to the directory given by the argument; issue an error message
+# if it fails.
+
+changedir() {
+  cd $1 || error "Could not change directory to $1"
+}
+
+# Unpack the specified tarball after removing the old directory.
+
+unpack() {
+  TARBALL="${TARBALLS}/$1"
+  BUILD="$2"
+  msg "  remove old directory and unpack tarball"
+  rm -rf ${BUILD}
+  test -f ${TARBALL} || error "${TARBALL} does not exist"
+  test ${ERROR} -ne 0 && return
+  ${GZIP} -dc < ${TARBALL} | tar xf - || error "could not unpack ${TARBALL}"
+}
+
+# Run make for a given target and set of flags.  Report failures.
+
+domake() {
+  FLAGS="$1"
+  TARGET="$2"
+  msg "  make ${TARGET}"
+  eval make ${FLAGS} ${TARGET} > make.${TARGET}.log 2>&1 \
+    || error "Could not make ${TARGET}"
+}
+
+########################################################################
+# Functions for Blitz
+########################################################################
+
+# Unpack, configure, build, and test Blitz.
+
+mk_blitz() {
+  msg "Start test build of Blitz"
+
+  if [ ${UNPACK} -ne 0 ]; then
+    changedir ${TOP}
+    unpack ${BLITZ_TARBALL} ${BLITZ_BUILD}
+    test ${ERROR} -ne 0 && return
+
+    # This check prevented the script from running automatically when
+    # the system boots up, and it isn't needed the way the tests are
+    # used here.  Replace it with something benign.
+
+    changedir ${TOP}/${BLITZ_BUILD}/compiler
+    cp bzconfig bzconfig.orig
+    sed 's/if test ! -t 0/if test ! -f bool.cpp /' < bzconfig.orig > bzconfig
+  else
+    changedir ${TOP}/${BLITZ_BUILD}
+    domake "-k" clean
+    ERROR=0 # ignore error for make clean
+  fi
+
+  # If we're doing interoperability testing then the initial
+  # configuration uses the alternate compiler; otherwise it's the
+  # compiler under test.
+
+  changedir ${TOP}/${BLITZ_BUILD}
+  msg "  configure"
+  ./configure --with-cxx="gcc:${ALT_INST}/bin/g++ ${ALT_OPTS}" \
+       --prefix=${TOP}/${BLITZ_BUILD} > configure.log 2>&1 \
+    || error "could not configure blitz"
+  test ${ERROR} -ne 0 && return
+
+  # Build the library.
+
+  changedir ${TOP}/${BLITZ_BUILD}
+  test ${ERROR} -ne 0 && return
+  domake "" lib
+  test ${ERROR} -ne 0 && return
+
+  # If we're testing interoperability, switch to the new compiler now.
+
+  if [ ${INTEROP} -ne 0 ]; then
+    changedir ${TOP}/${BLITZ_BUILD}
+    msg "  reconfigure for interoperability testing"
+     ./configure --with-cxx="gcc:${GCC_INST}/bin/g++ ${GCC_OPTS}" \
+         --prefix=${TOP}/${BLITZ_BUILD} > configure.log 2>&1 \
+      || error "could not reconfigure blitz"
+    test ${ERROR} -ne 0 && return
+  fi
+
+  changedir ${TOP}/${BLITZ_BUILD}/testsuite
+  rm -f blitz_build.log blitz_run.log
+  touch blitz_build.log blitz_run.log
+  msg "  make and run tests"
+  for i in ${BLITZ_TESTS}
+  do
+    make $i >> blitz_build.log 2>&1
+    if [ $? -ne 0 ]; then
+      error "test $i failed to build"
+      ERROR=0
+      (echo '*** build failure ***'; echo) >> blitz_build.log
+    else  
+      echo -n "${i}: " >> blitz_run.log
+      ./$i >> blitz_run.log 2>&1
+      (if [ $? -eq 0 ]; then echo PASS; else echo FAIL; fi) >> blitz_run.log
+    fi
+  done
+  grep FAIL blitz_run.log
+  if [ $? -eq 0 ]; then
+    error "runtime failures in test suite"
+    ERROR=0
+  fi
+
+  if [ ${ALL_BLITZ} -ne 0 ]; then
+    domake "" all
+  fi
+}
+
+########################################################################
+# Functions for Boost
+########################################################################
+
+# Create a template for the Boost configuration file, into which we can
+# later insert the values we want for testing.
+
+boost_config_template() {
+  mv ${BOOST_CONFIG} ${BOOST_CONFIG}.orig
+  cat <<\EOF > ${BOOST_CONFIG}.template
+linux
+gcc
+GCC 3.x
+g++ -c -w -ftemplate-depth-30 XXX_GCC_OPTS_XXX -I%include %source
+g++ -o boosttmp.exe -w -ftemplate-depth-30 -I%include %source -lrt
+GNU<br><a href="http://gcc.gnu.org/";>GCC</a><br>3.x
+EOF
+}
+
+# Insert the optimization flags into the BOOST configuration file.
+
+boost_config() {
+  OPTS="$1"
+  rm -f ${BOOST_CONFIG}
+  sed "s/XXX_GCC_OPTS_XXX/${OPTS}/g" \
+    < ${BOOST_CONFIG}.template > ${BOOST_CONFIG}
+}
+
+# Unpack, configure, build, and test Boost.
+
+mk_boost() {
+  msg "Start test build of Boost"
+  BOOST_ROOT=${TOP}/${BOOST_BUILD}
+
+  changedir ${TOP}
+  if [ ${UNPACK} -ne 0 ]; then
+    unpack ${BOOST_TARBALL} ${BOOST_BUILD}
+    test ${ERROR} -ne 0 && return
+    changedir ${BOOST_ROOT}
+    boost_config_template
+
+    # Fix a test that assumes ILP32.
+
+    changedir ${BOOST_ROOT}/libs/integer
+    mv integer_test.cpp integer_test.cpp.orig
+    sed '/PRIVATE_FIT_TESTS/s/LONG_MAX/INT_MAX/' \
+      < integer_test.cpp.orig > integer_test.cpp
+
+    # Fix a configuration check to recognize GCC 3.2 and 3.3
+
+    changedir ${BOOST_ROOT}/boost/config/compiler
+    mv gcc.hpp gcc.hpp.orig
+    sed '/__GNUC__ == 3/s/__GNUC_MINOR__ > 1/__GNUC_MINOR__ > 3/' \
+      < gcc.hpp.orig > gcc.hpp
+  fi
+
+  # If we're doing interoperability testing then the intial configure
+  # uses the alternate compiler; otherwise it's the compiler under test.
+
+  if [ "${ALT_OPTS}" = "" ]; then
+    LOCAL_ALT_OPTS="${BOOST_DEFAULT_OPTS}"
+  fi
+  changedir ${BOOST_ROOT}
+  boost_config "${LOCAL_ALT_OPTS}"
+  PATH=${ALT_INST}/bin:${OLDPATH}
+
+  changedir ${BOOST_ROOT}/tools/build/jam_src
+  test ${ERROR} -ne 0 && return
+  msg "  build Jam"
+  domake all
+  test ${ERROR} -ne 0 && return
+
+  msg "  build Boost library"
+  changedir ${BOOST_ROOT}
+  test ${ERROR} -ne 0 && return
+
+  # This is expected to fail, although most of it builds successfully,
+  # so don't check the return status.
+
+  ${BOOST_ROOT}/tools/build/jam_src/jam0 \
+    -sBOOST_ROOT=${BOOST_ROOT} -sTOOLS="gcc" > jam0.log 2>&1
+
+  # If we're testing interoperability, switch to the new compiler now.
+
+  if [ ${INTEROP} -ne 0 ]; then
+    msg "  reconfigure for interoperability testing"
+    if [ "${GCC_OPTS}" = "" ]; then
+      LOCAL_GCC_OPTS="${BOOST_DEFAULT_OPTS}"
+    fi
+    changedir ${BOOST_ROOT}
+    boost_config "${LOCAL_GCC_OPTS}"
+    PATH=${GCC_INST}/bin:${OLDPATH}
+  fi
+
+  msg "  build regression test"
+  changedir ${BOOST_ROOT}/status
+  g++ -I ${BOOST_ROOT} -o regression regression.cpp \
+    || error "build of regression test failed"
+  test ${ERROR} -ne 0 && return
+
+  msg "  run regression tests"
+  changedir ${BOOST_ROOT}/status
+  ${BOOST_ROOT}/status/regression > regression.log 2>&1 \
+    || error "run regression tests failed"
+  ERROR=0
+
+  changedir ${BOOST_ROOT}/status
+  BOOST_PASS=`grep '^Pass$' regression.log | wc | awk '{ print $2 }'`
+  BOOST_FAIL=`grep '^Fail$' regression.log | wc | awk '{ print $2 }'`
+  if [ ${BOOST_FAIL} -eq 0 ]; then
+    msg "  pass: ${BOOST_PASS}; no failures"
+  else
+    msg "  TEST FAILURES: ${BOOST_FAIL}; pass: ${BOOST_PASS}"
+  fi
+}
+
+########################################################################
+# Functions for GNU Emacs
+########################################################################
+
+# Unpack, configure, and build GNU Emacs.
+
+mk_emacs() {
+  msg "Start test build of GNU Emacs"
+  if [ ${INTEROP} -ne 0 ]; then
+    msg "  Note: not set up for interoperability testing"
+  fi
+  changedir ${TOP}
+  if [ ${UNPACK} -ne 0 ]; then
+    unpack ${EMACS_TARBALL} ${EMACS_BUILD}
+    test ${ERROR} -ne 0 && return
+  else
+    changedir ${EMACS_BUILD}
+    test ${ERROR} -ne 0 && return
+    domake "" distclean
+    ERROR=0 # ignore error for make clean
+  fi
+
+  if [ "${GCC_OPTS}" = "" ]; then
+    LOCAL_GCC_OPTS="${EMACS_DEFAULT_OPTS}"
+  fi
+  changedir ${TOP}/${EMACS_BUILD}
+  test ${ERROR} -ne 0 && return
+  CFLAGS="${LOCAL_GCC_OPTS}" \
+  ./configure --prefix=${TOP}/emacs_install > configure.log 2>&1 \
+    || error "Could not configure emacs"
+  test ${ERROR} -ne 0 && return
+
+  domake "" all
+}
+
+########################################################################
+# Functions for FTensor
+########################################################################
+
+# Unpack, build, and test FTensor.
+
+mk_ftensor() {
+  msg "Start test build of FTensor"
+  if [ ${INTEROP} -ne 0 ]; then
+    msg "  Note: not set up for interoperability testing"
+  fi
+  if [ ${UNPACK} -ne 0 ]; then
+    changedir ${TOP}
+    unpack ${FTENSOR_TARBALL} ${FTENSOR_BUILD}
+    test ${ERROR} -ne 0 && return
+  else
+    changedir ${TOP}/${FTENSOR_BUILD}/tests/conformance
+    test ${ERROR} -ne 0 && return
+    domake "" clean
+    ERROR=0 # ignore error for make clean
+    changedir ${TOP}/${FTENSOR_BUILD}/tests/speed
+    test ${ERROR} -ne 0 && return
+    domake "" clean
+    ERROR=0 # ignore error for make clean
+  fi
+ 
+  # Build and run conformance tests.
+ 
+  if [ ${TEST_FTENSOR} -ne 0 ]; then
+    if [ "${GCC_OPTS}" = "" ]; then
+      LOCAL_GCC_OPTS="${FTENSOR_TEST_DEFAULT_OPTS}"
+    fi
+    changedir ${TOP}/${FTENSOR_BUILD}/tests/conformance
+    test ${ERROR} -ne 0 && return
+    domake "CXXOPTIMIZE=\"${LOCAL_GCC_OPTS}\"" test_compiler
+    test ${ERROR} -ne 0 && return
+    msg "  run compiler tests"
+    ./test_compiler > test_compiler.out
+    test ${ERROR} -ne 0 && return
+
+    FTENSOR_RESULTS=`cat test_compiler.out | awk '
+BEGIN		{
+		  passes=0
+		  failures=0
+		  expected_passes=1533
+		  expected_failures=0
+		}
+/^PASS/		{ passes++ }
+/^FAIL/		{ failures++ }
+END		{
+		  if (failures == expected_failures &&
+		      passes == expected_passes)
+		    printf ("PASSED\n");
+		  else
+		    printf ("FAILURES=%d, PASSES=%d (expected %d)\n",
+		      failures, passes, expected_passes)
+		}
+'`
+    if [ "${FTENSOR_RESULTS}" = "PASSED" ]; then
+      msg "  tests passed"
+    else
+      grep '^FAIL' test_compiler.out
+      error "${FTENSOR_RESULTS}"
+    fi
+  fi
+
+  # Build and run performance tests.
+
+  if [ ${TIME_FTENSOR} -ne 0 ]; then
+    changedir ${TOP}/${FTENSOR_BUILD}/tests/speed
+    test ${ERROR} -ne 0 && return
+    if [ "${GCC_OPTS}" = "" ]; then
+      LOCAL_GCC_OPTS="${FTENSOR_TIME_DEFAULT_OPTS}"
+    fi
+    domake "CXXOPTIMIZE=\"${LOCAL_GCC_OPTS}\"" one_over
+    test ${ERROR} -ne 0 && return
+    domake "CXXOPTIMIZE=\"${LOCAL_GCC_OPTS}\"" one_over_fast
+    test ${ERROR} -ne 0 && return
+    msg "  run performance tests"
+    ./one_over_script > one_over_script.log 2>&1
+    test ${ERROR} -ne 0 && return
+
+    ## CHECK THAT PERFORMANCE TESTS RAN SUCCESSFULLY
+
+  fi
+}
+
+########################################################################
+# Functions for LAPACK
+########################################################################
+
+# Modify the original LAPACK configuration file to create a template
+# with values that are appropriate for use with GCC and that can be
+# updated easily for a new compiler installation directory and
+# optimization flags.  The RANLIB value should be changed to "true"
+# here for systems that don't use ranlib.
+
+lapack_config_template() {
+  sed -e 's/^PLAT *=.*/PLAT = G77/' \
+      -e 's/^FORTRAN *=.*/FORTRAN  = XXX_GCC_DIR_XXX\/bin\/g77/' \
+      -e 's/^OPTS *=.*/OPTS     = XXX_GCC_OPTS_XXX/' \
+      -e 's/^NOOPT *=.*/NOOPT    = -g/' \
+      -e 's/^LOADER *=.*/LOADER   = $(FORTRAN)/' \
+      -e 's/^LOADOPTS *=.*/LOADOPTS = /' \
+      -e 's/^RANLIB *=.*/RANLIB   = ranlib/' \
+      -e 's/^BLASLIB =*.*/BLASLIB      = ..\/..\/blas$(PLAT).a/' \
+    < make.inc > make.inc.template
+  mv make.inc make.inc.orig
+}
+
+# Insert the current values for the compiler installation directory and
+# optimization flags into the LAPACK configuration file.
+
+lapack_config() {
+  INST="$1"
+  OPTS="$2"
+
+  rm -f make.inc
+  sed -e "s,XXX_GCC_DIR_XXX,${INST},g" \
+      -e "s/XXX_GCC_OPTS_XXX/${OPTS}/g" \
+    < make.inc.template > make.inc
+}
+
+# Unpack, configure, build, and test LAPACK.
+
+mk_lapack() {
+  msg "Start test build of LAPACK"
+  TARGET_LIST=""
+  test ${TEST_LAPACK} -ne 0 && TARGET_LIST="${TARGET_LIST} ${LAPACK_TEST_LIST}"
+  test ${TIME_LAPACK} -ne 0 && TARGET_LIST="${TARGET_LIST} ${LAPACK_TIME_LIST}"
+
+  changedir ${TOP}
+  if [ ${UNPACK} -ne 0 ]; then
+    unpack ${LAPACK_TARBALL} ${LAPACK_BUILD}
+    test ${ERROR} -ne 0 && return
+    changedir ${TOP}/${LAPACK_BUILD}
+    lapack_config_template
+  fi
+
+  changedir ${TOP}/${LAPACK_BUILD}
+  test ${ERROR} -ne 0 && return
+
+  # If we're doing interoperability testing then the intial configure
+  # uses the alternate compiler; otherwise it's the compiler under test.
+
+  if [ "${ALT_OPTS}" = "" ]; then
+    LOCAL_ALT_OPTS="${LAPACK_DEFAULT_OPTS}"
+  fi
+  lapack_config ${ALT_INST} "${LOCAL_ALT_OPTS}"
+  test ${ERROR} -ne 0 && return
+
+  if [ $UNPACK -eq 0 ]; then
+    domake "-k" clean
+    ERROR=0 # ignore error for make clean
+    find . -name \*.SUMM -exec rm -f {} \;
+  fi
+
+  # Build the libraries that will later be used in the tests.
+
+  for target in ${LAPACK_BUILD_LIST}
+  do
+    domake "" $target
+    ERROR=0 # ignore ERROR for this one
+  done
+
+  # If we're doing interoperability testing, reconfigure with the
+  # compiler under test.
+
+  if [ ${INTEROP} -ne 0 ]; then
+    changedir ${TOP}/${LAPACK_BUILD}
+    test ${ERROR} -ne 0 && return
+    msg "  reconfigure for interoperability testing"
+    if [ "${GCC_OPTS}" = "" ]; then
+      LOCAL_GCC_OPTS="${LAPACK_DEFAULT_OPTS}"
+    fi
+    lapack_config ${GCC_INST} "${LOCAL_GCC_OPTS}"
+    test ${ERROR} -ne 0 && return
+  fi
+
+  # Run the functional tests and/or performance tests.
+
+  for target in ${TARGET_LIST}
+  do
+    domake "" $target
+    ERROR=0 # ignore ERROR for this one
+  done
+
+  # Compare the test failures against expected failures.
+  # This allows the number of failures seen on ia64-linux and i686-linux
+  # for GCC 3.1 using a couple of different sets of options.
+
+  cd ${TOP}/${LAPACK_BUILD}/TESTING
+  msg "  check test results"
+  grep fail *.out | awk '
+BEGIN		{
+		  CBD_expected = 1
+		  CGV_dr_expected = 66
+		  CST_expected = 2
+		  CST_dr_expected = 2
+		  DES_expected = 2
+		  DST_dr_expected = 1
+		  DSX_expected = 2
+		  DXV_dr_expected = 200
+		  SST_expected = 2
+		  SST_dr_expected = 1
+		  SXV_dr_expected = 37
+		  ZGV_dr_expected = 64
+		  ZXV_dr_expected = 24
+		  failures=0
+		}
+/CBD:/		{ if ($3 > CBD_expected) failures++; next }
+/CGV drivers:/	{ if ($4 > CGV_dr_expected) failures++; next }
+/CST:/		{ if ($3 > CST_expected) failures++; next }
+/CST drivers:/	{ if ($4 > CST_dr_expected) failures++; next }
+/DES:/		{ if ($3 > DES_expected) failures++; next }
+/DST drivers:/	{ if ($4 > DST_dr_expected) failures++; next }
+/DSX:/		{ if ($3 > DSX_expected) failures++; next }
+/DXV drivers:/	{ if ($4 > DXV_dr_expected) failures++; next }
+/SST:/		{ if ($3 > SST_expected) failures++; next }
+/SST drivers:/	{ if ($4 > SST_dr_expected) failures++; next }
+/SXV drivers:/	{ if ($4 > SXV_dr_expected) failures++; next }
+/ZGV drivers:/	{ if ($4 > ZGV_dr_expected) failures++; next }
+/ZXV drivers:/	{ if ($4 > ZXV_dr_expected) failures++; next }
+		{ print "Unexpected report: $0"; failures++ }
+END		{ printf ("FAILURES=%d\n", failures) }' \
+ | grep 'FAILURES=0' > /dev/null 2>&1 || error "  unexpected test failures"
+}
+
+########################################################################
+# Functions for POOMA
+########################################################################
+
+# Unpack, configure, build, and test POOMA.
+
+mk_pooma() {
+  msg "Start test build of POOMA"
+  if [ ${INTEROP} -ne 0 ]; then
+    msg "  Note: not set up for interoperability testing"
+  fi
+  if [ ${UNPACK} -ne 0 ]; then
+    changedir ${TOP}
+    unpack ${POOMA_TARBALL} ${POOMA_BUILD}
+    test ${ERROR} -ne 0 && return
+
+    if [ "${GCC_OPTS}" != "" ]; then
+      changedir ${TOP}/${POOMA_BUILD}
+      test -f ${POOMA_CONFIG} \
+        || error "  config file ${POOMA_CONFIG} does not exist"
+      test ${ERROR} -ne 0 && return
+      mv ${POOMA_CONFIG} ${POOMA_CONFIG}.orig
+      sed -e "/^\$copt_app/s/-O3.*\";/${GCC_OPTS}\";/" \
+          -e "/^\$cppopt_app/s/-O2.*\";/${GCC_OPTS}\";/" \
+        < ${POOMA_CONFIG}.orig > ${POOMA_CONFIG}
+    fi
+  else
+    changedir ${TOP}/${POOMA_BUILD}
+    test ${ERROR} -ne 0 && return
+    domake realcleansuite
+    ERROR=0 # ignore error for make clean
+  fi
+
+  changedir ${TOP}/${POOMA_BUILD} 
+  test ${ERROR} -ne 0 && return
+  msg "  build and test"
+  ./tester.pl ${GCC_INST} > tester.pl.log 2>&1 \
+    || error "Could not build and test POOMA"
+  test ${ERROR} -ne 0 && return
+  fgrep 'All testing succeeded.' tester.log > /dev/null 2>&1 \
+    || error "Errors detected during build or test"
+  test ${ERROR} -eq 0 && msg "  all testing succeeded"
+}
+
+########################################################################
+# Functions for Qt
+########################################################################
+
+# Modify the original Qt configuration file to create a template
+# with values that are appropriate for use with GCC and that can be
+# updated easily for a new compiler installation directory and
+# optimization flags.
+
+qt_config_template() {
+sed -e 's/^SYSCONF_CXX[ 	]*=.*/SYSCONF_CXX = XXX_GCC_DIR_XXX\/bin\/g++/' \
+    -e 's/^SYSCONF_CC[ 	]*=.*/SYSCONF_CC = XXX_GCC_DIR_XXX\/bin\/gcc/' \
+    -e 's/^SYSCONF_LINK[ 	]*=.*/SYSCONF_LINK = XXX_GCC_DIR_XXX\/bin\/g++/' \
+    -e 's/^SYSCONF_LINK_SHLIB[ 	]*=.*/SYSCONF_LINK_SHLIB = XXX_GCC_DIR_XXX\/bin\/g++/' \
+    -e 's/^SYSCONF_CXXFLAGS[ 	]*=.*/SYSCONF_CXXFLAGS = XXX_GCC_OPTS_XXX/' \
+    -e 's/^SYSCONF_CFLAGS[ 	]*=.*/SYSCONF_CFLAGS = XXX_GCC_OPTS_XXX/' \
+    < ${QT_CONFIG} > ${QT_CONFIG}.template
+  mv ${QT_CONFIG} ${QT_CONFIG}.orig
+}
+
+# Insert the current values for the compiler installation directory and
+# optimization flags into the Qt configuration file.
+
+qt_config() {
+  INST="$1"
+  OPTS="$2"
+
+  rm -f ${QT_CONFIG}
+  sed -e "s,XXX_GCC_DIR_XXX,${INST},g" \
+      -e "s/XXX_GCC_OPTS_XXX/${OPTS}/g" \
+    < ${QT_CONFIG}.template > ${QT_CONFIG}
+}
+
+# Unpack, configure, and build Qt.
+
+mk_qt() {
+  msg "Start test build of Qt"
+  if [ ${UNPACK} -ne 0 ]; then
+    changedir ${TOP}
+    unpack ${QT_TARBALL} ${QT_BUILD}
+    test ${ERROR} -ne 0 && return
+    changedir ${TOP}/${QT_BUILD}
+    qt_config_template
+  else
+    changedir ${TOP}/${QT_BUILD}
+    test ${ERROR} -ne 0 && return
+    domake "-k" clean
+    ERROR=0 # ignore error for make clean
+  fi
+
+  changedir ${TOP}/${QT_BUILD}
+  test ${ERROR} -ne 0 && return
+
+  # If we're doing interoperability testing then the intial configure
+  # uses the alternate compiler; otherwise it's the compiler under test.
+
+  if [ "${ALT_OPTS}" = "" ]; then
+    LOCAL_ALT_OPTS="${QT_DEFAULT_OPTS}"
+  fi
+  qt_config ${ALT_INST} "${LOCAL_ALT_OPTS}"
+  test ${ERROR} -ne 0 && return
+  msg "  configure"
+  echo yes | QTDIR=${TOP}/${QT_BUILD} ./configure > configure1.log 2>&1 \
+    || error "Could not configure Qt"
+  test ${ERROR} -ne 0 && return
+  for target in ${ALT_QT_TARGETS}
+  do
+    QTDIR=${TOP}/${QT_BUILD} domake "" ${target}
+  done
+
+  # For interoperability testing, reconfigure to use the new compiler.
+
+  if [ ${INTEROP} -ne 0 ]; then
+    if [ "${GCC_OPTS}" = "" ]; then
+      LOCAL_GCC_OPTS="${QT_DEFAULT_OPTS}"
+    fi
+    qt_config ${GCC_INST} "${LOCAL_GCC_OPTS}"
+    test ${ERROR} -ne 0 && return
+    msg "  reconfigure for interoperability testing"
+    echo yes | QTDIR=${TOP}/${QT_BUILD} ./configure > configure2.log 2>&1 \
+      || error "Could not reconfigure Qt"
+    test ${ERROR} -ne 0 && return
+  fi
+
+  for target in ${GCC_QT_TARGETS}
+  do
+    QTDIR=${TOP}/${QT_BUILD} domake "" ${target}
+  done
+}
+
+########################################################################
+# Main Program
+########################################################################
+
+# Initializations before argument processing.
+# Some variables can be passed in from the environment as well as from
+# arguments: GCC_INST, GCC_OPTS, ALT_INST, ALT_OPTS, and TARBALLS.
+
+INTEROP=0
+ERROR=0
+UNPACK=0
+BUILD_BLITZ=0
+ALL_BLITZ=0
+BUILD_BOOST=0
+BUILD_EMACS=0
+BUILD_FTENSOR=0
+TEST_FTENSOR=0
+TIME_FTENSOR=0
+BUILD_LAPACK=0
+TEST_LAPACK=0
+TIME_LAPACK=0
+BUILD_POOMA=0
+BUILD_QT=0
+
+# Parse the command line options.
+
+while getopts "a:d:f:g:ht:u" ARG; do
+  case $ARG in
+  a)  ALT_INST=${OPTARG};;
+  d)  GCC_INST=${OPTARG};;
+  f)  GCC_OPTS="${OPTARG}"; LOCAL_GCC_OPTS="${OPTARG}";;
+  g)  ALT_OPTS="${OPTARG}"; LOCAL_ALT_OPTS="${OPTARG}";;
+  h)  usage;;
+  t)  TARBALLS=${OPTARG};;
+  u)  UNPACK=1;;
+  *)  usage;;
+  esac
+done
+shift `expr ${OPTIND} - 1`
+
+# Record the applications to build and test.
+
+while [ $# -ne 0 ]; do
+  case $1 in
+  blitz)        BUILD_BLITZ=1;;
+  blitz_all)    BUILD_BLITZ=1; ALL_BLITZ=1;;
+  boost)        BUILD_BOOST=1;;
+  emacs)        BUILD_EMACS=1;;
+  ftensor)      BUILD_FTENSOR=1; TEST_FTENSOR=1; TIME_FTENSOR=1;;
+  ftensor_test) BUILD_FTENSOR=1; TEST_FTENSOR=1;;
+  ftensor_time) BUILD_FTENSOR=1; TIME_FTENSOR=1;;
+  lapack)       BUILD_LAPACK=1; TEST_LAPACK=1;;
+  lapack_build) BUILD_LAPACK=1;;
+  lapack_test)  BUILD_LAPACK=1; TEST_LAPACK=1;;
+  lapack_time)  BUILD_LAPACK=1; TEST_LAPACK=1; TIME_LAPACK=1;;
+  pooma)        BUILD_POOMA=1;;
+  qt)           BUILD_QT=1;;
+  *)            usage;;
+  esac
+  shift
+done
+
+# If we're unpacking tarballs, make sure TARBALLS is defined.
+
+if [ ${UNPACK} -ne 0 -a "${TARBALLS}" = "" ]; then
+  error "Define TARBALLS or use -t to specify tarball directory"
+  exit 1
+fi
+
+# If no alternate compiler is defined, use the same one all the time.
+
+if [ "${ALT_INST}" = "" ]; then
+  ALT_INST=${GCC_INST}
+  ALT_OPTS="${GCC_OPTS}"
+  LOCAL_ALT_OPTS="${LOCAL_GCC_OPTS}"
+else
+  INTEROP=1
+fi
+
+# Add the compiler installation location to PATH and LD_LIBRARY_PATH,
+# since some of the applications look for it that way.
+
+TOP=`pwd`
+OLDPATH=${PATH}
+PATH=${GCC_INST}/bin:${PATH}
+NEWPATH=${PATH}
+if [ "${ALT_INST}" != "" ]; then
+  LD_LIBRARY_PATH=${GCC_INST}/lib:${ALT_INST}/lib
+else
+  LD_LIBRARY_PATH=${GCC_INST}/lib
+fi
+export PATH LD_LIBRARY_PATH
+
+# Some of the makefiles don't define SHELL, so do it here.
+
+SHELL=/bin/sh
+export SHELL
+
+# Report information about the compiler(s) and optimizations.
+
+if [ ${INTEROP} -eq 0 ]; then
+
+  # We're using a single compiler.
+
+  ${GCC_INST}/bin/gcc -v 2>&1 | tail -1
+  if [ "${GCC_OPTS}" = "" ]; then
+    echo "default optimizations for each package"
+  else
+    echo "optimization flags: ${GCC_OPTS}"
+  fi
+else
+
+  # We're doing interoperability testing, so report on both compilers
+  # and the optimizations they're using.  This (along with other places
+  # in this script) assumes the alternate compiler is a version of GCC.
+
+  echo "alternate compiler for interoperability testing:"
+  echo " " `${ALT_INST}/bin/gcc -v 2>&1 | tail -1`
+  if [ "${ALT_OPTS}" = "" ]; then
+    echo "  default optimizations for each package"
+  else
+    echo "  optimization flags: ${ALT_OPTS}"
+  fi
+  echo "compiler under test:"
+  echo " " `${GCC_INST}/bin/gcc -v 2>&1 | tail -1`
+  if [ "${GCC_OPTS}" = "" ]; then
+    echo "  default optimizations for each package"
+  else
+    echo "  optimization flags: ${GCC_OPTS}"
+  fi
+fi
+
+echo
+
+# Build Blitz (C++).
+
+if [ ${BUILD_BLITZ} -ne 0 ]; then
+  ERROR=0
+  mk_blitz
+fi
+
+# Build Boost (C++).
+
+if [ ${BUILD_BOOST} -ne 0 ]; then
+
+  # Boost finds g++ from PATH. We want to be able to build it with two
+  # different verions of g++, so let mk_boost play with the PATH value.
+
+  mk_boost
+  ERROR=0
+  PATH=${NEWPATH}
+fi
+
+# Build GNU Emacs (C).
+
+if [ ${BUILD_EMACS} -ne 0 ]; then
+  ERROR=0
+  mk_emacs
+fi
+
+# Build and test FTensor (C++)
+
+if [ ${BUILD_FTENSOR} -ne 0 ]; then
+  ERROR=0
+  mk_ftensor
+fi
+
+# Build and test LAPACK (Fortran 77).
+
+if [ ${BUILD_LAPACK} -ne 0 ]; then
+  ERROR=0
+  mk_lapack
+fi
+
+# Build and test POOMA (C++)
+
+if [ ${BUILD_POOMA} -ne 0 ]; then
+  ERROR=0
+  mk_pooma
+fi
+
+# Build Qt (C++).
+
+if [ ${BUILD_QT} -ne 0 ]; then
+  ERROR=0
+  mk_qt
+fi
+
+msg "Done."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]