From ca8a2e67c602621551ea3f33851dbd2beb4628d0 Mon Sep 17 00:00:00 2001 From: Steven Watanabe Date: Fri, 9 Dec 2011 01:36:04 +0000 Subject: [PATCH] Fix tests using sleep on Windows. [SVN r75871] --- v2/test/core_option_l.py | 31 +++++++++++--------- v2/test/core_parallel_actions.py | 12 +++++--- v2/test/core_parallel_multifile_actions_1.py | 20 +++++++++++-- v2/test/core_parallel_multifile_actions_2.py | 18 ++++++++++-- 4 files changed, 58 insertions(+), 23 deletions(-) diff --git a/v2/test/core_option_l.py b/v2/test/core_option_l.py index 574eb1ab7..e05e9a951 100755 --- a/v2/test/core_option_l.py +++ b/v2/test/core_option_l.py @@ -11,14 +11,27 @@ t = BoostBuild.Tester(pass_toolset=0) 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 @@ echo 002 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() diff --git a/v2/test/core_parallel_actions.py b/v2/test/core_parallel_actions.py index c1b1a5cf7..dedf9b118 100755 --- a/v2/test/core_parallel_actions.py +++ b/v2/test/core_parallel_actions.py @@ -11,7 +11,11 @@ t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) 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 @@ t.write("file.jam", """ 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 diff --git a/v2/test/core_parallel_multifile_actions_1.py b/v2/test/core_parallel_multifile_actions_1.py index a62665d35..9d995dbca 100755 --- a/v2/test/core_parallel_multifile_actions_1.py +++ b/v2/test/core_parallel_multifile_actions_1.py @@ -11,13 +11,27 @@ t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) 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 @@ echo 003 } rule .use.2 { DEPENDS $(<) : $(>) ; } actions .use.2 { -sleep 1 +$(SLEEP) 1 echo 004 } diff --git a/v2/test/core_parallel_multifile_actions_2.py b/v2/test/core_parallel_multifile_actions_2.py index d7519918c..aae0fe26e 100755 --- a/v2/test/core_parallel_multifile_actions_2.py +++ b/v2/test/core_parallel_multifile_actions_2.py @@ -23,13 +23,27 @@ t = BoostBuild.Tester(pass_toolset=0, pass_d0=False) 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 }