Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75871 - trunk/tools/build/v2/test
From: steven_at_[hidden]
Date: 2011-12-08 20:36:06


Author: steven_watanabe
Date: 2011-12-08 20:36:04 EST (Thu, 08 Dec 2011)
New Revision: 75871
URL: http://svn.boost.org/trac/boost/changeset/75871

Log:
Fix tests using sleep on Windows.
Text files modified:
   trunk/tools/build/v2/test/core_option_l.py | 31 +++++++++++++++++--------------
   trunk/tools/build/v2/test/core_parallel_actions.py | 12 ++++++++----
   trunk/tools/build/v2/test/core_parallel_multifile_actions_1.py | 20 +++++++++++++++++---
   trunk/tools/build/v2/test/core_parallel_multifile_actions_2.py | 18 ++++++++++++++++--
   4 files changed, 58 insertions(+), 23 deletions(-)

Modified: trunk/tools/build/v2/test/core_option_l.py
==============================================================================
--- trunk/tools/build/v2/test/core_option_l.py (original)
+++ trunk/tools/build/v2/test/core_option_l.py 2011-12-08 20:36:04 EST (Thu, 08 Dec 2011)
@@ -11,14 +11,27 @@
 
 t.write("sleep.bat","""@setlocal
 @echo off
-timeout /T %1 /NOBREAK >nul
+@REM timeout /T %1 /NOBREAK >nul
+ping 127.0.0.1 -n 2 -w 1000 >nul
+ping 127.0.0.1 -n %1 -w 1000 >nul
+@endlocal
+@exit /B 0
 """)
 
 t.write("file.jam", """
 
+if $(NT)
+{
+ SLEEP = @call sleep.bat ;
+}
+else
+{
+ SLEEP = sleep ;
+}
+
 actions .a. {
 echo 001
-sleep 4
+$(SLEEP) 4
 echo 002
 }
 
@@ -27,18 +40,8 @@
 DEPENDS all : sleeper ;
 """)
 
-t.run_build_system("-ffile.jam -d1 -l2", status=1, stdout="""...found 2 targets...
-...updating 1 target...
-.a. sleeper
-2 second time limit exceeded
-001
+t.run_build_system("-ffile.jam -d1 -l2", status=1)
 
-echo 001
-sleep 4
-echo 002
-
-...failed .a. sleeper...
-...failed updating 1 target...
-""")
+t.expect_output_line("2 second time limit exceeded")
 
 t.cleanup()

Modified: trunk/tools/build/v2/test/core_parallel_actions.py
==============================================================================
--- trunk/tools/build/v2/test/core_parallel_actions.py (original)
+++ trunk/tools/build/v2/test/core_parallel_actions.py 2011-12-08 20:36:04 EST (Thu, 08 Dec 2011)
@@ -11,7 +11,11 @@
 
 t.write("sleep.bat","""@setlocal
 @echo off
-timeout /T %1 /NOBREAK >nul
+@REM timeout /T %1 /NOBREAK >nul
+ping 127.0.0.1 -n 2 -w 1000 >nul
+ping 127.0.0.1 -n %1 -w 1000 >nul
+@endlocal
+@exit /B 0
 """)
 
 t.write("file.jam", """
@@ -20,11 +24,11 @@
         actions sleeper
         {
 echo [$(<:S)] 0
-sleep 1
+@call sleep.bat 1
 echo [$(<:S)] 1
-sleep 1
+@call sleep.bat 1
 echo [$(<:S)] 2
-sleep $(<:B)
+@call sleep.bat $(<:B)
         }
     }
     else

Modified: trunk/tools/build/v2/test/core_parallel_multifile_actions_1.py
==============================================================================
--- trunk/tools/build/v2/test/core_parallel_multifile_actions_1.py (original)
+++ trunk/tools/build/v2/test/core_parallel_multifile_actions_1.py 2011-12-08 20:36:04 EST (Thu, 08 Dec 2011)
@@ -11,13 +11,27 @@
 
 t.write("sleep.bat","""@setlocal
 @echo off
-timeout /T %1 /NOBREAK >nul
+@REM timeout /T %1 /NOBREAK >nul
+ping 127.0.0.1 -n 2 -w 1000 >nul
+ping 127.0.0.1 -n %1 -w 1000 >nul
+@endlocal
+@exit /B 0
 """)
 
 t.write("file.jam", """
+
+ if $(NT)
+ {
+ SLEEP = @call sleep.bat ;
+ }
+ else
+ {
+ SLEEP = sleep ;
+ }
+
     actions .gen. {
 echo 001
-sleep 4
+$(SLEEP) 4
 echo 002
 }
     rule .use.1 { DEPENDS $(<) : $(>) ; }
@@ -26,7 +40,7 @@
 }
     rule .use.2 { DEPENDS $(<) : $(>) ; }
     actions .use.2 {
-sleep 1
+$(SLEEP) 1
 echo 004
 }
 

Modified: trunk/tools/build/v2/test/core_parallel_multifile_actions_2.py
==============================================================================
--- trunk/tools/build/v2/test/core_parallel_multifile_actions_2.py (original)
+++ trunk/tools/build/v2/test/core_parallel_multifile_actions_2.py 2011-12-08 20:36:04 EST (Thu, 08 Dec 2011)
@@ -23,13 +23,27 @@
 
 t.write("sleep.bat","""@setlocal
 @echo off
-timeout /T %1 /NOBREAK >nul
+@REM timeout /T %1 /NOBREAK >nul
+ping 127.0.0.1 -n 2 -w 1000 >nul
+ping 127.0.0.1 -n %1 -w 1000 >nul
+@endlocal
+@exit /B 0
 """)
 
 t.write("file.jam", """
+
+ if $(NT)
+ {
+ SLEEP = @call sleep.bat ;
+ }
+ else
+ {
+ SLEEP = sleep ;
+ }
+
     actions link
     {
- sleep 1
+ $(SLEEP) 1
         echo 001 - linked
     }
 


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