$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r49879 - trunk/tools/jam/test
From: grafikrobot_at_[hidden]
Date: 2008-11-22 20:00:17
Author: grafik
Date: 2008-11-22 20:00:17 EST (Sat, 22 Nov 2008)
New Revision: 49879
URL: http://svn.boost.org/trac/boost/changeset/49879
Log:
Unix bjam test isolation and auto-rebuild.
Text files modified: 
   trunk/tools/jam/test/test.sh |    50 +++++++++++++++++++++++++++++++++++++-- 
   1 files changed, 47 insertions(+), 3 deletions(-)
Modified: trunk/tools/jam/test/test.sh
==============================================================================
--- trunk/tools/jam/test/test.sh	(original)
+++ trunk/tools/jam/test/test.sh	2008-11-22 20:00:17 EST (Sat, 22 Nov 2008)
@@ -1,9 +1,53 @@
 #!/bin/sh
 
-#~ Copyright 2002-2005 Rene Rivera.
+#~ Copyright 2006-2008 Rene Rivera.
 #~ Distributed under the Boost Software License, Version 1.0.
 #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
 
-BJAM=`ls -1 ../src/bin.*/bjam`
+#~ BJAM=bjam
+#~ BJAM_SRC=../src
+#~ BJAM_BIN=`ls -1 ${BJAM_SRC}/bin.*/bjam`
 
-${BJAM} -f test.jam "$*"
+# Run a command, and echo before doing so. Also checks the exit
+# status and quits if there was an error.
+echo_run ()
+{
+    echo "$@"
+    $@
+    r=$?
+    if test $r -ne 0 ; then
+        exit $r
+    fi
+}
+
+# Check that a command is in the PATH.
+test_path ()
+{
+    if `command -v command 1>/dev/null 2>/dev/null`; then
+        command -v $1 1>/dev/null 2>/dev/null
+    else
+        hash $1 1>/dev/null 2>/dev/null
+    fi
+}
+
+Guess_BJAM ()
+{
+    if test_path bjam ; then BJAM=bjam
+    elif test -r ./bjam ; then BJAM=./bjam
+    elif test -r "${BJAM_BIN}" ; then BJAM="${BJAM_BIN}"
+    fi
+}
+
+Build_BJAM_To_Test ()
+{
+    cwd=`pwd`
+    if test "${BJAM_SRC}" = "" ; then BJAM_SRC=../src ; fi
+    cd "${BJAM_SRC}"
+    ./build.sh
+    if test "${BJAM_BIN}" = "" ; then BJAM_BIN=`ls -1 ${BJAM_SRC}/bin.*/bjam` ; fi
+    cd "${cwd}"
+}
+
+Build_BJAM_To_Test
+Guess_BJAM
+echo_run "${BJAM}" -f test.jam "-sBJAM=${BJAM_BIN}" "$@"