From 18b8d572bde670a91049467e05b6c3c568887b43 Mon Sep 17 00:00:00 2001 From: Dan Mihai Date: Fri, 16 Jun 2017 07:41:45 -0700 Subject: [PATCH] build: Windows: Work around coap.h race Build coap.h before everything else, to work around an apparent multi-threaded build race condition. Bug: https://jira.iotivity.org/browse/IOT-2376 Change-Id: Ic112cfea42dfa1ac12735b4af882dc45a74c853d Signed-off-by: Dan Mihai Reviewed-on: https://gerrit.iotivity.org/gerrit/20891 Reviewed-by: Phil Coval Reviewed-by: Ibrahim Esmat Tested-by: jenkins-iotivity Reviewed-by: Omar Maabreh --- run.bat | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/run.bat b/run.bat index a988c92..01eec87 100644 --- a/run.bat +++ b/run.bat @@ -200,7 +200,22 @@ if "!RUN_ARG!"=="server" ( echo THREAD_COUNT=%THREAD_COUNT% echo AUTOMATIC_UPDATE=%AUTOMATIC_UPDATE% - REM First: just build, but don't run tests. + REM First step: + REM - Generate coap.h, to avoid race conditions during second step below (see IOT-2376). + REM - Other SCons Config headers get generated during this step too, as a side effect. + echo.============================================================== + echo.run.bat : Generating Config header files... + echo.scons.bat -j 1 VERBOSE=1 TEST=0 %BUILD_OPTIONS% extlibs\libcoap\libcoap\include\coap\coap.h + call scons.bat -j 1 VERBOSE=1 TEST=0 %BUILD_OPTIONS% extlibs\libcoap\libcoap\include\coap\coap.h + if ERRORLEVEL 1 ( + echo SCons failed - exiting run.bat with code 5 + exit /B 5 + ) + + REM Second step: + REM - Compile everything, but don't run tests yet. + echo.============================================================== + echo.run.bat : Compiling... echo.scons.bat -j %THREAD_COUNT% VERBOSE=1 TEST=0 %BUILD_OPTIONS% call scons.bat -j %THREAD_COUNT% VERBOSE=1 TEST=0 %BUILD_OPTIONS% if ERRORLEVEL 1 ( @@ -208,10 +223,11 @@ if "!RUN_ARG!"=="server" ( exit /B 3 ) - REM Second: run tests if needed, using a single SCons thread. + REM Third step: + REM - Run tests if needed, using a single SCons thread. if "!TEST!"=="1" ( - echo. - echo Running Tests + echo.============================================================== + echo.run.bat : Running tests... echo.scons.bat -j 1 VERBOSE=1 TEST=1 %BUILD_OPTIONS% call scons.bat -j 1 VERBOSE=1 TEST=1 %BUILD_OPTIONS% if ERRORLEVEL 1 ( -- 2.7.4