<< Click to Display Table of Contents >> Simple Regression Tests, Failures Logged to File |
Click here to download this example
This is an example of test results being logged to a file. This allows an entire test suite to be run to conclusion with no human intervention regardless of whether or not any failures are encountered.
This is done using the -d=_FORCE_FAIL_ option that passes in the _FORCE_FAIL_ as a #define to the script command file. This _FORCE_FAIL_ modifies the test slightly such that a failure results.
File "Test.Bat" is the "big banana" in that it fires up and runs the multiple tests that comprise the test suite. See below. One key is the -lf5MyTest.Log option which instructs ls the simulator to log all messages to a file, instead of the default which is to log them to a dialog box.
The second key is the "is_error" environment variable that is maintained to indicate failure of any test. Instead of halting the tests (which is seen in many other situations) this environment variable is used to report at the end of all tests, the failure of any test(s).
set SIM=%DEV_TOOL_ETPU_BIN%\ETpuDevTool.exe
set options=-AutoRun -AutoBuild -lf5=MyTest.Log -q %1
set is_error=0
del MyTest.Log
echo Running MeasurePulse PULSE WIDTH Test ...
%SIM% -p=Proj.ETpuIdeProj -s=TestPulseWidth.ETpuCommand "-tn=Pulse Width Test" %options%
if %ERRORLEVEL% NEQ 0 ( set is_error=1 )
echo Running MeasurePulse PULSE ACCUMULATE Test ...
%SIM% -p=Proj.ETpuIdeProj -s=TestPulseAccum.ETpuCommand "-tn=Pulse Accumulate Test" %options%
if %ERRORLEVEL% NEQ 0 ( set is_error=1 )
if %is_error% NEQ 0 ( goto errors )
echo ALL TESTS PASS
goto end
:errors
type MyTest.Log
echo *************************************************
echo YIKES, WE GOT ERRORS!!
echo *************************************************
exit /b -1
:end