Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

Regarding .bat file #1088

chetangeo ·
Hi Robin,
I am trying to build .bat file from Shell/Batch Command step,this batch build is failing but QB2.1 gives it as successful build.
While log file shows following error
20:34:15,766 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 40>MWAddin.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) void __cdecl InsertOperation2(enum MWInsertOperationMode_e,enum MWInsertOperation_OperationGroup_e,enum MWInsertOperation_OperationType_e)" (__imp_?InsertOperation2@@YAXW4MWInsertOperationMode_e@@W4MWInsertOperation_OperationGroup_e@@W4MWInsertOperation_OperationType_e@@@Z) referenced in function "public: virtual long __stdcall MWAddin::OnInsert2AxisRoughMillOperation(void)" (?OnInsert2AxisRoughMillOperation@MWAddin@@UAGJXZ)
20:34:15,766 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 40>./../../../sldworks/bin.nt/i386/Release/apps/CAMWorks_vc80/CWAddinu.dll : fatal error LNK1120: 1 unresolved externals
20:34:15,891 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 40>Build log was saved at "file://e:\QuickBuild\quickbuild-2.1.21-windows-x86-32\workspace\root\mwproj\32BitBuild\mchworks\bin.nt\vc8\x86\intermed_Release\mwaddin\BuildLog.htm"

In above all log messages are actually error but QB2.1 consider it as Info,can you explain it ?
I am also collecting errorlevel at the end .bat file which is returned as '1' in log file of QB2.1,but still QB2.1 show it as successful build instead of Fail.
If errorlevel is nonzero as then it is considered failed in QB2.1, but in this case it is giving as successful build.
Same thing in QB1.2 gives failed build.
  • replies 11
  • views 5655
  • stars 0
robinshen ADMIN ·
Have you enabled error detection for this command build step? If enabled, QuickBuild will ignore return code of the batch command. Error messages are displayed as INFO level since they are printed to standard output instead of standard error. You may capture them as errors in QuickBuild by specifying proper error detection patterns.
tim ·
I was having a similar problem with QB3 beta where an error wasn't getting detected when running in a .bat file. It doesn't look like QB checks the ERRORLEVEL environment variable on Windows builds. Here was the workaround I used for my Shell/Batch Command rule:

cmd /v:on /c buildme.bat && exit !ERRORLEVEL!


It would be nice if QB would check the ERRORLEVEL environment variable. I haven't tried just running the batch file using the QB3 release yet to see if it detects the error. Is there any way to get QB to check the environment variable directly or is there a better way to run the batch file than using cmd as above?

Thanks!
-Tim
robinshen ADMIN ·
QB3 beta only respects ERRORLEVEL environment if error detection is NOT specified. If it is specified, QuickBuild assumes that the user himself knows how to detect errors by specifying proper patterns, and will not check return code since it might be used for other purposes other than signaling a command failure.

If you find that QuickBuild
chetangeo ·
Hi Robin,
No I am not using error detection,QB must capture this error as Build failed error without use of Error detection pattern.
robinshen ADMIN ·
This is odd. Can you try a simple enough test.bat like below to see if it works?
case 1:
set test.bat to below content:
dir c:\

This command returns 0 and the step should be successful.

case 2:
set test.bat to below content:
dir some_non_existent_directory

This command returns 1 and the step should be failed.
chetangeo ·
Hi,
where will I get information about error patterns? are there any sample error patterns for reference?
chetangeo ·
Hi,
Why this is not working in QB2.1 and was working in QB1.2.13?
robinshen ADMIN ·
I have the impression that you are not using the error detection pattern, and just relies on return code of the batch command. If error detection pattern is specified, QB will no longer respect return code, and fail the step only if error pattern is detected in command output. For example, you may specify the error pattern as ".*Error.*" to detect occurrence of the "Error" word.
chetangeo ·
The error code returned is non-zero, then why should we focus on customization, below given are the extracted lines from quickbuild log (complete log is attached herewith) where it shows the error, still it is labeled as "INFO", that's something weird.


---------------------------------------------------------------------------------------------
ivkrupa:8080] INFO - 21>..\..\src\MW3AxisTlpGen\StdAfx.cpp(5) : fatal error C1083: Cannot open precompiled header file: './../../bin.nt/vc8/x86/intermed_Release/MW3AxisTlpGen/MW3AxisTlpGen.pch': No such file or directory
08:24:18,075 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>MWUIDialog.cpp
08:24:18,075 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>..\..\src\MW3AxisTlpGen\MWUIDialog.cpp(21) : fatal error C1083: Cannot open precompiled header file: './../../bin.nt/vc8/x86/intermed_Release/MW3AxisTlpGen/MW3AxisTlpGen.pch': No such file or directory
08:24:18,091 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>MW3AxisToolpathGen.cpp
08:24:18,091 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>..\..\src\MW3AxisTlpGen\MW3AxisToolpathGen.cpp(21) : fatal error C1083: Cannot open precompiled header file: './../../bin.nt/vc8/x86/intermed_Release/MW3AxisTlpGen/MW3AxisTlpGen.pch': No such file or directory
08:24:18,091 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>MW3AxisTlpGen.cpp
08:24:18,107 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>..\..\src\MW3AxisTlpGen\MW3AxisTlpGen.cpp(4) : fatal error C1083: Cannot open precompiled header file: './../../bin.nt/vc8/x86/intermed_Release/MW3AxisTlpGen/MW3AxisTlpGen.pch': No such file or directory
08:24:18,107 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>Build log was saved at "file://e:\QuickBuild\quickbuild-2.1.21-windows-x86-32\workspace\root\mwproj\DailyBuild\mchworks\bin.nt\vc8\x86\intermed_Release\MW3AxisTlpGen\BuildLog.htm"
08:24:18,122 [32bit CW build_batch@mum-shivkrupa:8080] INFO - 21>MW3AxisTlpGen - 4 error(s), 0 warning(s)
---------------------------------------------------------------------------------------------
robinshen ADMIN ·
QuickBuild does not know which outputs are errors until you tell it. This is why error detection comes into play. For this output, you may specify start pattern of error detection as .*error.*
chetangeo ·
Got the solution. There was exit /b in batch file due to which the errorlevel was not stored in environment. When I removed /b the batch file returned non zero code.