Skip to content

Commit

Permalink
Fix halcompile and uspace tests against system install
Browse files Browse the repository at this point in the history
These tests refer to files outside the `tests` directory.  To make the
tests function disembodied from the source tree and against a system
install, add rules to the build to copy the needed files in place, and
adjust the tests to work properly.

Also, the `personalities_mod` test did something funky:  it overwrote
standard comps with modified versions, then replaced those when the
test finished.  This patch undoes that, and instead renames the comps.
  • Loading branch information
zultron committed Jun 10, 2020
1 parent 96ccb4f commit 9616c89
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 221 deletions.
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
linuxcnc
linuxcnc-checklink
linuxcnc-python
linuxcnc_info
rip-environment
Expand Down
2 changes: 2 additions & 0 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ SUBDIRS := \
po \
\
../docs/src ../docs/src/source-highlight \
\
../tests \



Expand Down
37 changes: 37 additions & 0 deletions tests/Submakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Prepare tests to run even when separated from the rest of
# the sources

userspace: test-inputs

PERSONALITIES_MOD_COMPS = \
$(patsubst %,../tests/halcompile/personalities_mod/%_test.comp,\
lincurve logic bitslice)
$(PERSONALITIES_MOD_COMPS): ../tests/halcompile/personalities_mod/%_test.comp: \
hal/components/%.comp
$(ECHO) Copying test input $<
$(Q)sed $< -e "1 s/$(*)/$(*)_test/" > $@


../tests/halcompile/serial-out-of-tree/mesa_uart_test.comp: \
hal/drivers/mesa_uart.comp
sed $< -e "1 s/mesa_uart/mesa_uart_test/" > $@

../tests/halcompile/userspace/rand_test.comp: \
../docs/src/hal/rand.comp
sed $< -e "1 s/rand/rand_test/" > $@

../tests/uspace/spawnv-root/rtapi.conf: ../scripts/rtapi.conf
cp $< $@

test-inputs: $(PERSONALITIES_MOD_COMPS) \
../tests/halcompile/serial-out-of-tree/mesa_uart_test.comp \
../tests/halcompile/userspace/rand_test.comp \
../tests/uspace/spawnv-root/rtapi.conf

clean: test-inputs-clean

test-inputs-clean:
rm -f $(PERSONALITIES_MOD_COMPS) \
../tests/halcompile/serial-out-of-tree/mesa_uart_test.comp \
../tests/halcompile/userspace/rand_test.comp \
../tests/uspace/spawnv-root/rtapi.conf
3 changes: 3 additions & 0 deletions tests/halcompile/personalities_mod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
bitslice_test.comp
lincurve_test.comp
logic_test.comp
196 changes: 98 additions & 98 deletions tests/halcompile/personalities_mod/4count_2pers.expected
Original file line number Diff line number Diff line change
@@ -1,100 +1,100 @@
bitslice u32 IN 0 bitslice.0.in
bitslice bit OUT FALSE bitslice.0.out-00
bitslice bit OUT FALSE bitslice.0.out-01
bitslice s32 OUT 0 bitslice.0.time
bitslice u32 IN 0 bitslice.1.in
bitslice bit OUT FALSE bitslice.1.out-00
bitslice bit OUT FALSE bitslice.1.out-01
bitslice bit OUT FALSE bitslice.1.out-02
bitslice s32 OUT 0 bitslice.1.time
bitslice u32 IN 0 bitslice.2.in
bitslice bit OUT FALSE bitslice.2.out-00
bitslice bit OUT FALSE bitslice.2.out-01
bitslice s32 OUT 0 bitslice.2.time
bitslice u32 IN 0 bitslice.3.in
bitslice bit OUT FALSE bitslice.3.out-00
bitslice bit OUT FALSE bitslice.3.out-01
bitslice bit OUT FALSE bitslice.3.out-02
bitslice s32 OUT 0 bitslice.3.time
lincurve float IN 0 lincurve.0.in
lincurve float OUT 0 lincurve.0.out
lincurve float I/O 0 lincurve.0.out-io
lincurve s32 OUT 0 lincurve.0.time
lincurve float IN 0 lincurve.1.in
lincurve float OUT 0 lincurve.1.out
lincurve float I/O 0 lincurve.1.out-io
lincurve s32 OUT 0 lincurve.1.time
lincurve float IN 0 lincurve.2.in
lincurve float OUT 0 lincurve.2.out
lincurve float I/O 0 lincurve.2.out-io
lincurve s32 OUT 0 lincurve.2.time
lincurve float IN 0 lincurve.3.in
lincurve float OUT 0 lincurve.3.out
lincurve float I/O 0 lincurve.3.out-io
lincurve s32 OUT 0 lincurve.3.time
logic bit OUT FALSE logic.0.and
logic bit IN FALSE logic.0.in-00
logic bit IN FALSE logic.0.in-01
logic s32 OUT 0 logic.0.time
logic bit IN FALSE logic.1.in-00
logic bit IN FALSE logic.1.in-01
logic bit IN FALSE logic.1.in-02
logic bit IN FALSE logic.1.in-03
logic bit OUT FALSE logic.1.or
logic s32 OUT 0 logic.1.time
logic bit OUT FALSE logic.2.and
logic bit IN FALSE logic.2.in-00
logic bit IN FALSE logic.2.in-01
logic s32 OUT 0 logic.2.time
logic bit IN FALSE logic.3.in-00
logic bit IN FALSE logic.3.in-01
logic bit IN FALSE logic.3.in-02
logic bit IN FALSE logic.3.in-03
logic bit OUT FALSE logic.3.or
logic s32 OUT 0 logic.3.time
bitslice_test u32 IN 0 bitslice-test.0.in
bitslice_test bit OUT FALSE bitslice-test.0.out-00
bitslice_test bit OUT FALSE bitslice-test.0.out-01
bitslice_test s32 OUT 0 bitslice-test.0.time
bitslice_test u32 IN 0 bitslice-test.1.in
bitslice_test bit OUT FALSE bitslice-test.1.out-00
bitslice_test bit OUT FALSE bitslice-test.1.out-01
bitslice_test bit OUT FALSE bitslice-test.1.out-02
bitslice_test s32 OUT 0 bitslice-test.1.time
bitslice_test u32 IN 0 bitslice-test.2.in
bitslice_test bit OUT FALSE bitslice-test.2.out-00
bitslice_test bit OUT FALSE bitslice-test.2.out-01
bitslice_test s32 OUT 0 bitslice-test.2.time
bitslice_test u32 IN 0 bitslice-test.3.in
bitslice_test bit OUT FALSE bitslice-test.3.out-00
bitslice_test bit OUT FALSE bitslice-test.3.out-01
bitslice_test bit OUT FALSE bitslice-test.3.out-02
bitslice_test s32 OUT 0 bitslice-test.3.time
lincurve_test float IN 0 lincurve-test.0.in
lincurve_test float OUT 0 lincurve-test.0.out
lincurve_test float I/O 0 lincurve-test.0.out-io
lincurve_test s32 OUT 0 lincurve-test.0.time
lincurve_test float IN 0 lincurve-test.1.in
lincurve_test float OUT 0 lincurve-test.1.out
lincurve_test float I/O 0 lincurve-test.1.out-io
lincurve_test s32 OUT 0 lincurve-test.1.time
lincurve_test float IN 0 lincurve-test.2.in
lincurve_test float OUT 0 lincurve-test.2.out
lincurve_test float I/O 0 lincurve-test.2.out-io
lincurve_test s32 OUT 0 lincurve-test.2.time
lincurve_test float IN 0 lincurve-test.3.in
lincurve_test float OUT 0 lincurve-test.3.out
lincurve_test float I/O 0 lincurve-test.3.out-io
lincurve_test s32 OUT 0 lincurve-test.3.time
logic_test bit OUT FALSE logic-test.0.and
logic_test bit IN FALSE logic-test.0.in-00
logic_test bit IN FALSE logic-test.0.in-01
logic_test s32 OUT 0 logic-test.0.time
logic_test bit IN FALSE logic-test.1.in-00
logic_test bit IN FALSE logic-test.1.in-01
logic_test bit IN FALSE logic-test.1.in-02
logic_test bit IN FALSE logic-test.1.in-03
logic_test bit OUT FALSE logic-test.1.or
logic_test s32 OUT 0 logic-test.1.time
logic_test bit OUT FALSE logic-test.2.and
logic_test bit IN FALSE logic-test.2.in-00
logic_test bit IN FALSE logic-test.2.in-01
logic_test s32 OUT 0 logic-test.2.time
logic_test bit IN FALSE logic-test.3.in-00
logic_test bit IN FALSE logic-test.3.in-01
logic_test bit IN FALSE logic-test.3.in-02
logic_test bit IN FALSE logic-test.3.in-03
logic_test bit OUT FALSE logic-test.3.or
logic_test s32 OUT 0 logic-test.3.time

bitslice s32 RW 0 bitslice.0.tmax
bitslice bit RO FALSE bitslice.0.tmax-increased
bitslice s32 RW 0 bitslice.1.tmax
bitslice bit RO FALSE bitslice.1.tmax-increased
bitslice s32 RW 0 bitslice.2.tmax
bitslice bit RO FALSE bitslice.2.tmax-increased
bitslice s32 RW 0 bitslice.3.tmax
bitslice bit RO FALSE bitslice.3.tmax-increased
lincurve s32 RW 0 lincurve.0.tmax
lincurve bit RO FALSE lincurve.0.tmax-increased
lincurve float RW 0 lincurve.0.x-val-00
lincurve float RW 0 lincurve.0.x-val-01
lincurve float RW 0 lincurve.0.y-val-00
lincurve float RW 0 lincurve.0.y-val-01
lincurve s32 RW 0 lincurve.1.tmax
lincurve bit RO FALSE lincurve.1.tmax-increased
lincurve float RW 0 lincurve.1.x-val-00
lincurve float RW 0 lincurve.1.x-val-01
lincurve float RW 0 lincurve.1.x-val-02
lincurve float RW 0 lincurve.1.y-val-00
lincurve float RW 0 lincurve.1.y-val-01
lincurve float RW 0 lincurve.1.y-val-02
lincurve s32 RW 0 lincurve.2.tmax
lincurve bit RO FALSE lincurve.2.tmax-increased
lincurve float RW 0 lincurve.2.x-val-00
lincurve float RW 0 lincurve.2.x-val-01
lincurve float RW 0 lincurve.2.y-val-00
lincurve float RW 0 lincurve.2.y-val-01
lincurve s32 RW 0 lincurve.3.tmax
lincurve bit RO FALSE lincurve.3.tmax-increased
lincurve float RW 0 lincurve.3.x-val-00
lincurve float RW 0 lincurve.3.x-val-01
lincurve float RW 0 lincurve.3.x-val-02
lincurve float RW 0 lincurve.3.y-val-00
lincurve float RW 0 lincurve.3.y-val-01
lincurve float RW 0 lincurve.3.y-val-02
logic s32 RW 0 logic.0.tmax
logic bit RO FALSE logic.0.tmax-increased
logic s32 RW 0 logic.1.tmax
logic bit RO FALSE logic.1.tmax-increased
logic s32 RW 0 logic.2.tmax
logic bit RO FALSE logic.2.tmax-increased
logic s32 RW 0 logic.3.tmax
logic bit RO FALSE logic.3.tmax-increased
bitslice_test s32 RW 0 bitslice-test.0.tmax
bitslice_test bit RO FALSE bitslice-test.0.tmax-increased
bitslice_test s32 RW 0 bitslice-test.1.tmax
bitslice_test bit RO FALSE bitslice-test.1.tmax-increased
bitslice_test s32 RW 0 bitslice-test.2.tmax
bitslice_test bit RO FALSE bitslice-test.2.tmax-increased
bitslice_test s32 RW 0 bitslice-test.3.tmax
bitslice_test bit RO FALSE bitslice-test.3.tmax-increased
lincurve_test s32 RW 0 lincurve-test.0.tmax
lincurve_test bit RO FALSE lincurve-test.0.tmax-increased
lincurve_test float RW 0 lincurve-test.0.x-val-00
lincurve_test float RW 0 lincurve-test.0.x-val-01
lincurve_test float RW 0 lincurve-test.0.y-val-00
lincurve_test float RW 0 lincurve-test.0.y-val-01
lincurve_test s32 RW 0 lincurve-test.1.tmax
lincurve_test bit RO FALSE lincurve-test.1.tmax-increased
lincurve_test float RW 0 lincurve-test.1.x-val-00
lincurve_test float RW 0 lincurve-test.1.x-val-01
lincurve_test float RW 0 lincurve-test.1.x-val-02
lincurve_test float RW 0 lincurve-test.1.y-val-00
lincurve_test float RW 0 lincurve-test.1.y-val-01
lincurve_test float RW 0 lincurve-test.1.y-val-02
lincurve_test s32 RW 0 lincurve-test.2.tmax
lincurve_test bit RO FALSE lincurve-test.2.tmax-increased
lincurve_test float RW 0 lincurve-test.2.x-val-00
lincurve_test float RW 0 lincurve-test.2.x-val-01
lincurve_test float RW 0 lincurve-test.2.y-val-00
lincurve_test float RW 0 lincurve-test.2.y-val-01
lincurve_test s32 RW 0 lincurve-test.3.tmax
lincurve_test bit RO FALSE lincurve-test.3.tmax-increased
lincurve_test float RW 0 lincurve-test.3.x-val-00
lincurve_test float RW 0 lincurve-test.3.x-val-01
lincurve_test float RW 0 lincurve-test.3.x-val-02
lincurve_test float RW 0 lincurve-test.3.y-val-00
lincurve_test float RW 0 lincurve-test.3.y-val-01
lincurve_test float RW 0 lincurve-test.3.y-val-02
logic_test s32 RW 0 logic-test.0.tmax
logic_test bit RO FALSE logic-test.0.tmax-increased
logic_test s32 RW 0 logic-test.1.tmax
logic_test bit RO FALSE logic-test.1.tmax-increased
logic_test s32 RW 0 logic-test.2.tmax
logic_test bit RO FALSE logic-test.2.tmax-increased
logic_test s32 RW 0 logic-test.3.tmax
logic_test bit RO FALSE logic-test.3.tmax-increased

6 changes: 3 additions & 3 deletions tests/halcompile/personalities_mod/4count_2pers.hal
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
# halcompiled personalities

# 4 count, 2 personalities
loadrt logic count=4 personality=0x102,0x204
loadrt lincurve count=4 personality=2,3
loadrt bitslice count=4 personality=2,3
loadrt logic_test count=4 personality=0x102,0x204
loadrt lincurve_test count=4 personality=2,3
loadrt bitslice_test count=4 personality=2,3

show pin
show parameter
Loading

0 comments on commit 9616c89

Please sign in to comment.