|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r49878 - trunk/tools/jam/test
From: grafikrobot_at_[hidden]
Date: 2008-11-22 19:58:07
Author: grafik
Date: 2008-11-22 19:58:07 EST (Sat, 22 Nov 2008)
New Revision: 49878
URL: http://svn.boost.org/trac/boost/changeset/49878
Log:
Isolate running of bjam tests to individual bjam instances to prevent possible spillover errors from one test affecting another test. Separate the bjam used to run the tests vs. the bjam being tested. And add automatic re-building of the bjam being tested. (windows changes, unix changes to follow).
Text files modified:
trunk/tools/jam/test/test.bat | 50 +++++++++++++++--
trunk/tools/jam/test/test.jam | 115 ++++++++++++++++++++++++----------------
2 files changed, 113 insertions(+), 52 deletions(-)
Modified: trunk/tools/jam/test/test.bat
==============================================================================
--- trunk/tools/jam/test/test.bat (original)
+++ trunk/tools/jam/test/test.bat 2008-11-22 19:58:07 EST (Sat, 22 Nov 2008)
@@ -1,14 +1,52 @@
@ECHO OFF
-REM ~ Copyright 2006 Rene Rivera.
+REM ~ Copyright 2006-2008 Rene Rivera.
REM ~ Distributed under the Boost Software License, Version 1.0.
REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
-set BJAM=..\src\bin.ntx86\bjam
-REM ~ set BJAM=..\src\bin.ntx86.debug\bjam
-REM ~ set BJAM=bjam-3_1_14
REM ~ set BJAM=bjam
+REM ~ set BJAM_SRC=..\src
+REM ~ set BJAM_BIN=..\src\bin.ntx86\bjam.exe
-_at_ECHO ON
+setlocal
+goto Start
+
+:Test_Path
+REM Tests for the given file(executable) presence in the directories in the PATH
+REM environment variable. Additionaly sets FOUND_PATH to the path of the
+REM found file.
+setlocal & endlocal
+setlocal
+set test=%~$PATH:1
+endlocal
+if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
+goto :eof
+
+:Guess_BJAM
+setlocal & endlocal
+if NOT "_%BJAM%_" == "__" goto :eof
+call :Test_Path bjam.exe
+if not errorlevel 1 (
+ set BJAM=bjam.exe
+ goto :eof)
+if "_%BJAM%_" == "__" (
+ set BJAM=%BJAM_BIN%
+ goto :eof)
+setlocal & endlocal
+goto :eof
-%BJAM% -f test.jam
+:Build_BJAM_To_Test
+setlocal & endlocal
+if "_%BJAM_SRC%_" == "__" set BJAM_SRC=..\src
+PUSHD %BJAM_SRC%
+call build.bat
+@ECHO OFF
+POPD
+set BJAM_BIN=%BJAM_SRC%\bin.ntx86\bjam.exe
+goto :eof
+
+:Start
+call :Build_BJAM_To_Test
+call :Guess_BJAM
+@ECHO ON
+%BJAM% -f test.jam "-sBJAM=%BJAM_BIN%"
Modified: trunk/tools/jam/test/test.jam
==============================================================================
--- trunk/tools/jam/test/test.jam (original)
+++ trunk/tools/jam/test/test.jam 2008-11-22 19:58:07 EST (Sat, 22 Nov 2008)
@@ -1,67 +1,90 @@
-#~ Copyright 2006-2007 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)
-fail-count = 0 ;
-pass-count = 0 ;
+TESTS =
+ action_status
+ actions_quietly
+ builtin_normalize_path
+ builtin_shell
+ builtin_w32_getregnames
+ option_d2
+ option_l
+ option_n
+ parallel_actions
+ parallel_multifile_actions_1
+ parallel_multifile_actions_2
+ stress_var_expand
+ target_var
+ var_expand
+ ;
+BJAM ?= bjam ;
-rule message ( message * )
-{
- local b = [ BACKTRACE ] ;
- ECHO "$(b[-4]):$(b[-3]):" $(message) ;
-}
-
+#############################################################################
-rule fail ( message * )
+if $(BJAM_RUN_TEST)
{
- fail-count = [ CALC $(fail-count) + 1 ] ;
- message "error:" [FAILED] $(message) ;
-}
-
+ fail-count = 0 ;
+ pass-count = 0 ;
-rule pass ( message * )
-{
- pass-count = [ CALC $(pass-count) + 1 ] ;
- if --verbose in $(ARGV)
+ rule message ( message * )
{
- message "info:" [PASSED] $(message) ;
+ local b = [ BACKTRACE ] ;
+ ECHO "$(b[-4]):$(b[-3]):" $(message) ;
}
-}
-rule assert ( expected * : test ? : obtained * )
-{
- test ?= "(==)" ;
- local r = 0 ;
- if $(test) = "(==)" && "*$(expected)*" != "*$(obtained)*"
+ rule fail ( message * )
{
- fail '$(expected)' $(test) '$(obtained)' ;
+ fail-count = [ CALC $(fail-count) + 1 ] ;
+ message "error:" [FAILED] $(message) ;
}
- else if $(test) = "(!=)" && "*$(expected)*" = "*$(obtained)*"
+
+
+ rule pass ( message * )
{
- fail '$(expected)' $(test) '$(obtained)' ;
+ pass-count = [ CALC $(pass-count) + 1 ] ;
+ if --verbose in $(ARGV)
+ {
+ message "info:" [PASSED] $(message) ;
+ }
}
- else
+
+
+ rule assert ( expected * : test ? : obtained * )
{
- pass '$(expected)' $(test) '$(obtained)' ;
+ test ?= "(==)" ;
+ local r = 0 ;
+ if $(test) = "(==)" && "*$(expected)*" != "*$(obtained)*"
+ {
+ fail '$(expected)' $(test) '$(obtained)' ;
+ }
+ else if $(test) = "(!=)" && "*$(expected)*" = "*$(obtained)*"
+ {
+ fail '$(expected)' $(test) '$(obtained)' ;
+ }
+ else
+ {
+ pass '$(expected)' $(test) '$(obtained)' ;
+ }
}
+
+ include $(BJAM_RUN_TEST).jam ;
+
+ EXIT --- $(BJAM_RUN_TEST): PASSED($(pass-count)) *FAILED($(fail-count))* : $(fail-count) ;
}
+else
+{
+ ECHO "Testing: $(BJAM)" ;
+ fail-count = 0 ;
+ for local test in $(TESTS)
+ {
+ local result = [ SHELL "\"$(BJAM)\" -f test.jam -sBJAM_RUN_TEST=$(test)" : exit-status ] ;
+ fail-count = [ CALC $(fail-count) + $(result[1]) ] ;
+ ECHO $(result[0]) ;
+ }
-include action_status.jam ;
-include actions_quietly.jam ;
-include builtin_normalize_path.jam ;
-include builtin_shell.jam ;
-include builtin_w32_getregnames.jam ;
-include option_d2.jam ;
-include option_l.jam ;
-include option_n.jam ;
-include parallel_actions.jam ;
-include parallel_multifile_actions_1.jam ;
-include parallel_multifile_actions_2.jam ;
-include stress_var_expand.jam ;
-include target_var.jam ;
-include var_expand.jam ;
-
-EXIT --- Complete: PASSED($(pass-count)) *FAILED($(fail-count))* : $(fail-count) ;
+ EXIT --- Complete: *FAILED($(fail-count))* : $(fail-count) ;
+}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk