Simple Regression Tests, Failures Cause Alerts

<< Click to Display Table of Contents >>

Navigation:  eTPU Development Tool (ASH WARE, Inc.) >

Simple Regression Tests, Failures Cause Alerts

Previous pageReturn to chapter overviewNext page

Example Download

How Can I Test My Code, Play Foosball, and Drink Beer ... All at the Same Time?

Multitasking is the key to success in our global society. Plus, if you are Mounting a Comeback on the Fields of Glory, you might hit a wrong key giving invalid test results.

Open a DOS console window and navigate the the directory where the above example is has been downloaded.

Run file test.zip by typing "test" and hitting the enter key.

The eTPU simulator is launched multiple times and automatically exits. At the end of the test run, the message "all tests pass" if the tests pass.

The key is file test.bat, which is (partially) shown below.

 

set SIM=%DEV_TOOL_ETPU_BIN%\ETpuDevTool.exe

 

echo    Running MeasurePulse PULSE WIDTH Test ...

%SIM%  -p=Proj.ETpuIdeProj -s=TestPulseWidth.ETpuCommand -AutoRun -AutoBuild

if  %ERRORLEVEL% NEQ 0 ( goto errors )

 

 

echo    Running MeasurePulse PULSE ACCUMULATE Test ...

%SIM%  -p=Proj.ETpuIdeProj -s=TestPulseAccum.ETpuCommand -AutoRun -AutoBuild

if  %ERRORLEVEL% NEQ 0 ( goto errors )

 

echo ALL TESTS PASS

 

goto end

:errors

echo *************************************************

echo        YIKES, WE GOT ERRORS!!

echo *************************************************

exit /b -1

:end

A couple notes on file TEST.BAT shown above file.

The Windows' environment variable, 'DEV_TOOL_ETPU_BIN', is written when the eTPU Simulator is installed.  It allows regression tests to 'find' the simulator using the following DOS commands.

set SIM=%DEV_TOOL_ETPU_BIN%\ETpuDevTool.exe

The following -p command line option causes project file Proj.ETpuIdeProj to be loaded.

-p=Proj.ETpuIdeProj

The following -s command line option causes script file TestPulseWidth.ETpuCommand to be loaded.

-s=TestPulseWidth.ETpuCommand

The following -AutoRun command line option causes the simulator to start running automatically.

-AutoRun

The following -AutoBuild command line option causes the simulator to start running automatically.

-AutoBuild

Test of the Test

How can I exercise a failure?  In the script commands file the verification script can conditionally execute when the _FORCE_FAIL_ macro is defined.

#ifdef _FORCE_FAIL_

// Use the -d=_FORCE_FAIL_ on the command line of 'Test.bat' to view a failure

verify_chan_data24 (TEST_CHAN, _CPBA24_MyETpuFunc_PulseWidth_, 60);

#else

verify_chan_data24 (TEST_CHAN, _CPBA24_MyETpuFunc_PulseWidth_, 50);

#endif

This macro can be passed to DevTool from the command line of the test, as show below.

%SIM%  -p=Proj.ETpuIdeProj -s=TestPulseWidth.ETpuCommand -AutoRun -AutoBuild -d=_FORCE_FAIL_

In the downloadable example listed at the top of this file it is possible to exercise the failure by running Test.Bat with the following argument.  It is important to note the parentheses around the argument in order for Windows to treat the 'equals' sign as a single argument.

RegressionTestSimpleCmdLine

When this test runs the following failure is generated.

RegressionTestSimpleFailure

See Also