linuxcnc/tests
2023-01-12 19:09:44 -08:00
..
abort src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
abs.0
alias.0 runtests: update for .time pins 2015-02-16 21:55:42 -07:00
and-or-not-mux.0
basic
biquad
build Fix tests compiling against system install 2020-06-10 13:54:39 +08:00
ccomp src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
classicladder/estop skip the classicladder test 2022-11-27 18:51:00 -06:00
counter-encoder.0
edge
flipflop.0
hal-backslash Add a test of halcmd with backslash continuations 2022-08-21 10:39:53 -05:00
hal-link-unlink Use exec instead of exit $? in tests 2022-08-14 09:42:21 +02:00
halcompile halcompile: Add command line arguments to provide compile and link flags 2023-01-10 21:50:07 +00:00
halmodule.0 use python3 in all #!python lines 2021-09-02 18:32:58 -05:00
halmodule.1 use python3 in all #!python lines 2021-09-02 18:32:58 -05:00
halrun-getopt-reset tests: test for the getopt reset bug 2016-06-18 15:10:07 -05:00
halrun-lock halcmd: fix "tune" command locking. 2020-10-29 20:51:54 +13:00
halui Use exec instead of exit $? in tests 2022-08-14 09:42:21 +02:00
hard-limits use python3 in all #!python lines 2021-09-02 18:32:58 -05:00
hm2-idrom hm2-idrom test: show actual output if it is unexpected 2022-02-05 15:50:01 -07:00
ilowpass tests: add a test of ilowpass with low gain 2017-04-10 11:50:52 -06:00
interp clean up handling of canterp 2023-01-03 19:26:46 -07:00
io-startup Use exec instead of exit $? in tests 2022-08-14 09:42:21 +02:00
lathe Use exec instead of exit $? in tests 2022-08-14 09:42:21 +02:00
limit3 Fix various typos 2022-02-16 11:17:29 -05:00
linuxcncrsh src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
linuxcncrsh-tcp src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
loadrt.1 halcmd: support line extends with backslash (\) 2019-02-16 09:10:25 -07:00
loadrt.2 tests: add new streamer pins to loadrt test 2015-09-10 15:52:21 -06:00
lowlevel/mutex Fix tests compiling against system install 2020-06-10 13:54:39 +08:00
m70-m73 Merge branch '2.7' into 2.8 2019-08-16 00:06:22 -05:00
matrixkins matrixkins: Add calibrated 3-axis kinematics HAL component 2022-12-04 12:46:11 +02:00
mdi-queue src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
mdi-queue-length src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
mdi-while-queuebuster-waitflag src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
modparam.0
module-loading Added runtests option -u to skip test requiring sudo access 2022-07-16 09:43:34 +02:00
motion git ignore files generated by the tests 2022-11-01 12:10:55 -06:00
motion-logger Re-enable tests/motion-logger/startup-gcode-abort and make it more robust 2022-07-28 08:03:23 +02:00
multiclick
mux mux-generic: Fix the mux test results to suit the new, more functional, 2018-12-05 23:01:17 +00:00
near.0
overrun tests/overrun: Fix run against system install 2020-06-10 13:54:39 +08:00
oword Merge branch '2.7' into 2.8 2019-08-16 00:06:22 -05:00
pyhal use python3 in all #!python lines 2021-09-02 18:32:58 -05:00
raster Rewrote raster test to clean up on failures. 2022-12-09 07:12:17 +01:00
realtime-math Fix typos 2022-08-08 12:15:07 -04:00
remap Merge remote-tracking branch 'origin/2.8' into 2.9 2023-01-09 09:52:01 -07:00
rs274ngc-startup src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
rtapi-shmem Added runtests option -u to skip test requiring sudo access 2022-07-16 09:43:34 +02:00
rtapi_printf.0 tests/rtapi_printf.0: placate older compilers 2020-07-01 16:41:02 -05:00
save.0 Fix tests calling realtime script running against system install 2020-06-10 13:57:51 +08:00
save.1
single-step use python3 in all #!python lines 2021-09-02 18:32:58 -05:00
source.0
startup-state src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
statbuffer-g5x-abort src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
stepgen.0
stepgen.1 make failure more verbose 2015-12-23 16:18:06 -06:00
stepgen.2
symbols.0 Added runtests option -u to skip test requiring sudo access 2022-07-16 09:43:34 +02:00
symbols.1 Added runtests option -u to skip test requiring sudo access 2022-07-16 09:43:34 +02:00
t0 linuxcncrsh: check for errors when creating listening socket 2022-02-14 20:12:46 -07:00
tclsh-extensions Fix tests calling realtime script running against system install 2020-06-10 13:57:51 +08:00
threads.0 use python3 in all #!python lines 2021-09-02 18:32:58 -05:00
threads.1
timedelay.0
tlo src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
tool-info tooldata_common.cc revamp tool init values 2022-11-18 18:05:44 -07:00
toolchanger toolchanger test: add a missing wait for stat buffer 2022-12-16 09:54:27 -07:00
trajectory-planner/circular-arcs src: s/ini/INI/ 2022-10-11 19:04:38 +02:00
twopass twopass.tcl: improve conflict word handling 2020-04-21 18:25:22 -07:00
twopass-personality twopass.tcl: improve conflict word handling 2020-04-21 18:25:22 -07:00
uspace/spawnv-root Added runtests option -u to skip test requiring sudo access 2022-07-16 09:43:34 +02:00
.gitignore Implement G52 offsets 2015-12-23 15:52:56 -06:00
README Added runtests option -u to skip test requiring sudo access 2022-07-16 09:43:34 +02:00
Submakefile Fix halcompile and uspace tests against system install 2020-06-10 15:35:19 +08: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*

To only run the tests that do not require root or sudo access, use the
-u option:

	scripts/runtests -u tests

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.

Tests requiring root or sudo access are flagged by creating a file
named control in the test directory, with the 'sudo' flag in the
Restrictions field:

  Restrictions: sudo

Other restrictions might be added in the future