linuxcnc/tests
Sebastian Kuzminsky 9e2a8e2078 tests: add a test of stat.queued_mdi_commands
This test verifies that stat->task.queuedMDIcommands (aka
stat.queued_mdi_command in python-land) grows as we add MDI commands to
Task's MDI queue and shrinks as Task executes them.

This test currently fails because queuedMDIcommands is always 0.  I fix
Task in the following commit to set it correctly.

Signed-off-by: Sebastian Kuzminsky <seb@highlab.com>
2017-02-10 15:02:14 -07:00
..
abort/feed-rate tests: enable the abort-vs-feed-rate test created a few commits ago 2016-10-20 13:34:27 -05:00
abs.0 make this test less sensitive to variations in floating-point number display. 2007-03-16 12:51:01 +00:00
alias.0 runtests: update for .time pins 2015-02-16 21:55:42 -07:00
and-or-not-mux.0 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
basic add the beginnings of a test suite 2006-10-06 21:07:21 +00:00
biquad add a very basic test of the biquad component 2014-05-08 22:56:00 -06:00
build test: don't clutter the test directory 2013-10-28 06:51:25 -05:00
ccomp Fix bug 160: surprise motion after g41/no move/g40 2016-10-21 13:58:50 -05:00
comp Rename comp to halcompile, to avoid several kinds of confusion 2014-06-24 13:51:30 -05:00
comp-extralib tests: comp was renamed halcompile 2014-11-13 21:53:01 -06:00
counter-encoder.0 prefer net to linkxx 2009-10-22 13:57:22 -05:00
edge tests: add tests of the new "both" mode of edge.comp 2014-04-18 23:01:49 -06:00
flipflop.0 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
hal-link-unlink tests/hal-link-unlink: run with realtime started 2014-03-27 23:50:18 +01:00
halmodule.0 pyhal: Added tests for item object 2010-11-03 17:42:05 +03:00
halui tests: longer timeout in halui mdi test 2016-06-18 12:43:15 -06:00
hard-limits hard-limits test: try again to detect end-of-motion 2016-07-27 14:33:29 -06:00
hm2-idrom tests: hm2-idrom: exit early when a test fails 2016-06-17 10:46:03 -05:00
ilowpass.0 ilowpass: test for wraparound behavior 2014-03-26 11:22:45 -05:00
interp Merge remote-tracking branch 'origin/2.6' into 2.7 2016-09-18 11:54:02 -05:00
io-startup tests: add a test of io startup tool-in-spindle 2015-06-03 17:34:20 -06:00
lathe ignore generated files 2015-09-24 22:09:38 -05:00
limit3.0 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
limit3.1 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
limit3.2 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
linuxcncrsh tests: increase task/motion timeout 2013-07-19 12:34:46 -06:00
linuxcncrsh-tcp nml: implement command queue with reliable reception 2014-11-13 19:36:44 -06:00
loadrt.1 runtests: update for .time pins 2015-02-16 21:55:42 -07:00
loadrt.2 tests: add new streamer pins to loadrt test 2015-09-10 15:52:21 -06:00
m70-m73 tests/interp: isolate M73 failure to turn back on both M7 and M8 2013-09-14 21:22:51 +02:00
mdi-queue tests: increase task/motion timeout 2013-07-19 12:34:46 -06:00
mdi-queue-length tests: add a test of stat.queued_mdi_commands 2017-02-10 15:02:14 -07:00
mdi-while-queuebuster-waitflag Add mdi-while-queuebuster-waitflag regression test 2016-09-21 18:46:21 -05:00
modparam.0 Freqgen has been replaced by stepgen's velocity mode 2013-12-15 17:28:22 -06:00
module-loading Merge branch '2.6' into 2.7 2014-12-28 14:09:04 -07:00
motion tests: ignore parameter save files 2015-02-10 17:27:30 -07:00
motion-logger Merge remote-tracking branch 'origin/2.6' into 2.7 2016-10-04 11:59:35 -06:00
multiclick add a component to detect clicks, double-clicks, etc 2012-12-22 22:26:45 -07:00
mux testsuite: rehabilitate mux test 2013-06-20 11:23:53 -05:00
near.0 near: add a test for correctness 2010-10-25 11:18:12 -05:00
overrun testsuite: fix overrun test 2010-09-07 13:43:06 -05:00
oword interp/oword: add regression test for while loop handling 2011-05-26 06:37:00 +02:00
realtime-math tests: verify that the exported realtime math functions exist, except for round() 2015-12-23 11:42:13 -07:00
remap Merge branch 'remap-dup-oword-lcnc-2.6' of https://github.com/zultron/machinekit into 2.6 2016-09-24 13:36:23 -05:00
rs274ngc-startup tests: fix a cut/paste error 2016-09-03 07:56:04 -06:00
rtapi_printf.0 rtapi_vsnprintf: provide a test program 2011-08-14 18:41:18 +00:00
save.0 hal_lib: new pin,param for thread time,tmax 2015-05-25 07:33:13 -07:00
save.1 skip this test, because newinst has been disabled 2006-10-30 03:39:06 +00:00
source.0 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
startup-state tests: fix a cut/paste error 2016-09-03 07:56:04 -06:00
statbuffer-g5x-abort skip the tests that fail without the task fixes 2016-07-28 22:34:16 -06:00
stepgen.0 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
stepgen.1 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
stepgen.2 modernize hal files in testsuite 2010-10-31 21:59:11 -05:00
symbols.0 tests: fix a compiler warning that fails this test on Jessie 2015-12-27 15:46:01 -07:00
symbols.1 Rename comp to halcompile, to avoid several kinds of confusion 2014-06-24 13:51:30 -05:00
t0 tests: avoid mdi queueing after gcodes that can fail 2015-08-09 12:53:54 -05:00
threads.0 threads.0 test: report correct line number on error 2015-07-17 00:23:37 -06:00
threads.1 The "all" function only encourages users not to carefully consider the order of functions in threads. get rid of it. 2008-12-09 01:54:50 +00:00
timedelay.0 replace timedelay with a .comp version, so that we get uniform naming and automatic documentation 2007-12-31 21:50:41 +00:00
tlo tests: fix a spurious failure of the tlo test 2015-01-20 08:02:16 -07:00
toolchanger tests: add spindle unloading to m61 test 2015-10-05 09:03:34 -06:00
trajectory-planner/circular-arcs test: Added code snippets from Sam that caused violations before recent fixes 2015-08-05 07:24:33 -04:00
usercomp.0 Rename comp to halcompile, to avoid several kinds of confusion 2014-06-24 13:51:30 -05:00
.gitignore clean up ignores some more 2009-06-20 20:30:13 -05:00
README testsuite: allow tests written in scripting langs 2010-09-07 13:43:06 -05:00

The HAL test suite
~~~~~~~~~~~~~~~~~~~
The tests in these directories serve to test the behavior of HAL components.

Each subdirectory of this directory may contain a test item.  The runtests
script recurses through the directory structure, so multiple tests could
be structured as
	tests/
		xyz.0
		xyz.1
		xyz.2
or
	tests/
		xyz/
			0	
			1	
			2	


Two types of tests are supported: Regression tests, in which the output is
tested against a "known good" output, and functional tests, in which the
output is fed to a program that can determine whether it is correct or not


Running the tests
~~~~~~~~~~~~~~~~~
Currently, tests only work with the "run in place" configuration.  They
can be run by executing (from the top emc2 directory)
	scripts/runtests tests
A subset of the tests can also be run:
	scripts/runtests tests/xyz tests/a*
The directories named on the commandline are searched recursively for
'test.hal' or 'test.sh' files, and a directory with such a file is
assumed to contain a regression test or a functional test.

Tests may contain files other than the ones specified below.  For instance,
when using 'streamer' data as test input, a shell script with
"halstreamer<<EOF" and a "here document" will generally be present.
(see and-or-not-mux.0/runstreamer for an example)

Regression Tests
~~~~~~~~~~~~~~~~
A regression test should consist of these three files:
	README
		A human-readable file describing the test
	test.hal *or* test.sh *or* test
		The test script to execute.  test.hal is executed with
		'halrun -f', test.sh is executed with 'bash -x', and
		test is executed as ./test
	expected
		A file whose contents are compared with the stdout of
			halrun -f test.hal

A typical regression test will load several components, usually including
'threads' and 'sampler', and often including 'streamer', then collect samples
from some number of calls to the realtime thread, then exit.

Regression test "test.hal" files will almost always include the line
	setexact_for_test_suite_only
which causes HAL to act as though the requested base_period was available.
Otherwise, results will differ slightly depending on the actual base_period
and regression tests will fail.

The test passes if the expected and actual output are identical.
Otherwise, the test fails.


Functional Tests
~~~~~~~~~~~~~~~~
A functional test should consist of three files:
	README
		A human-readable file describing the test
	test.hal *or* test.sh *or* test
		The test script to execute.  test.hal is executed with
		'halrun -f', test.sh is executed with 'bash -x', and
		test is executed as ./test
	checkresult
		An executable file (such as a shell or python script)
		which determines if the stdout of
			halrun -f test.hal
		indicates success or failure

Regression test "test.hal" files will often include the line
	setexact_for_test_suite_only
which causes HAL to act as though the requested base_period was available.
Otherwise, results will differ slightly depending on the actual base_period,
which could affect whether 'checkresult' gives an accurate result.

A typical regression test will load several components, usually including
'threads' and 'sample', then collect samples from some number of calls
to the realtime thread, then exit.  'checkresult' will look at the output
and see if it indicates success.

The test passes if the command "checkresult actual" returns a shell
success value (exit code 0).  Otherwise, the test fails.