summaryrefslogtreecommitdiffstats
path: root/tests/700-hardware/linuxcnc/linuxcnc.sh
blob: 330c20969a72e0bddeb8681e0799ac3f90fe98b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# LinuxCNC hardware module test

__run_awlsim_linuxcnc_hal()
{
	local interpreter="$1"
	local test_dir="$2"
	local awl_file="$3"
	shift 3

	export EXTRA_PYTHONPATH="$rootdir/libs/linuxcnc_fake_hal"
	setup_test_environment "$interpreter"
	local interpreter="$RET"

	FAKEHAL_HALFILE="${test_dir}/linuxcnc.hal" \
		"$interpreter" ./awlsim-linuxcnc-hal \
		--input-base 0 --input-size 32 \
		--output-base 0 --output-size 32 \
		--watchdog off --extended-insns \
		--listen localhost:$(get_port) \
		"$@" \
		"$awl_file" >/dev/null ||\
			test_failed "LinuxCNC test '$(basename "$awl_file")' failed"

	cleanup_test_environment
}

sh_test()
{
	local interpreter="$1"
	local test_dir="$2"
	local test_name="$3"

	cd "$rootdir" || die "Failed to change to rootdir '$rootdir'"

	infomsg
	for testfile in "000-base/empty.awl"\
			"000-base/shutdown.awl"\
			"000-base/EXAMPLE.awlpro"; do
		infomsg "    Running linuxcnc test with: $testfile"

		__run_awlsim_linuxcnc_hal "$interpreter" "$test_dir" \
			"$rootdir/tests/$testfile" \
			--max-runtime 1.0
	done

	infomsg "    Running I/O test"
	__run_awlsim_linuxcnc_hal "$interpreter" "$test_dir" \
		"$test_dir/linuxcnc-iotest.awl__"
}
bues.ch cgit interface