Import LinuxCNC source tree
This commit is contained in:
0
tests/halcompile/command_line_flags/expected
Normal file
0
tests/halcompile/command_line_flags/expected
Normal file
21
tests/halcompile/command_line_flags/flags.c
Normal file
21
tests/halcompile/command_line_flags/flags.c
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
flags.c
|
||||
To test command line compiler flags to halcompile
|
||||
|
||||
Copyright (C) 2023 Andy Pugh
|
||||
*/
|
||||
|
||||
|
||||
#ifndef ULAPI
|
||||
#error This is intended as a userspace component only.
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <readline.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char* res;
|
||||
rl_initialize();
|
||||
return 0;
|
||||
}
|
||||
33
tests/halcompile/command_line_flags/test.sh
Executable file
33
tests/halcompile/command_line_flags/test.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/sh
|
||||
if [ -e flags ]
|
||||
then
|
||||
rm flags
|
||||
fi
|
||||
halcompile --userspace --compile flags.c > /dev/null
|
||||
if [ -e flags ]
|
||||
then
|
||||
echo "No flags, compile succeeded but should fail"
|
||||
exit 1
|
||||
fi
|
||||
halcompile --userspace --compile --extra-compile-args="-I/usr/include/readline" flags.c > /dev/null
|
||||
if [ -e flags ]
|
||||
then
|
||||
echo "Linker flags only, compile succeeded but should fail"
|
||||
exit 1
|
||||
fi
|
||||
halcompile --userspace --compile --extra-link-args="-lm -lreadline" flags.c > /dev/null
|
||||
if [ -e flags ]
|
||||
then
|
||||
echo "Compiler flags only, compile succeeded but should fail"
|
||||
exit 1
|
||||
fi
|
||||
halcompile --userspace --compile --extra-compile-args="-I/usr/include/readline" --extra-link-args="-lm -lreadline" flags.c > /dev/null
|
||||
if [ -e flags ]
|
||||
then
|
||||
rm flags
|
||||
exit 0
|
||||
else
|
||||
echo "Compile failed but should succeed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
1
tests/halcompile/extralib/.gitignore
vendored
Normal file
1
tests/halcompile/extralib/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
extralib_test
|
||||
2
tests/halcompile/extralib/checkresult
Executable file
2
tests/halcompile/extralib/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -x "$(dirname "$1")/extralib_test" ]
|
||||
13
tests/halcompile/extralib/extralib_test.comp
Normal file
13
tests/halcompile/extralib/extralib_test.comp
Normal file
@@ -0,0 +1,13 @@
|
||||
component extralib_test;
|
||||
pin in float theta;
|
||||
pin out float sin_;
|
||||
license "GPL";
|
||||
option userspace;
|
||||
option extra_link_args "-lm";
|
||||
;;
|
||||
#include <math.h>
|
||||
void user_mainloop(void) {
|
||||
while(1) {
|
||||
FOR_ALL_INSTS() sin_ = sin(theta);
|
||||
}
|
||||
}
|
||||
3
tests/halcompile/extralib/test.sh
Executable file
3
tests/halcompile/extralib/test.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
halcompile --compile extralib_test.comp
|
||||
1
tests/halcompile/names/.gitignore
vendored
Normal file
1
tests/halcompile/names/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
names_match.c
|
||||
0
tests/halcompile/names/expected
Normal file
0
tests/halcompile/names/expected
Normal file
6
tests/halcompile/names/names_dont_match.comp
Normal file
6
tests/halcompile/names/names_dont_match.comp
Normal file
@@ -0,0 +1,6 @@
|
||||
component wrong_name;
|
||||
license "GPL";
|
||||
pin out bit out;
|
||||
function _;
|
||||
;;
|
||||
FUNCTION(_) {}
|
||||
6
tests/halcompile/names/names_match.comp
Normal file
6
tests/halcompile/names/names_match.comp
Normal file
@@ -0,0 +1,6 @@
|
||||
component names_match;
|
||||
license "GPL";
|
||||
pin out bit out;
|
||||
function _;
|
||||
;;
|
||||
FUNCTION(_) {}
|
||||
25
tests/halcompile/names/test.sh
Executable file
25
tests/halcompile/names/test.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# this one must succeed
|
||||
rm -f names_match.c
|
||||
if ! halcompile names_match.comp; then
|
||||
echo 'halcompile failed to process names_match.comp'
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f names_match.c ]; then
|
||||
echo 'halcompile failed to produce names_match.c'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# this one must fail
|
||||
rm -f names_dont_match.c
|
||||
if halcompile names_dont_match.comp; then
|
||||
echo 'halcompile erroneously accepted names_dont_match.comp'
|
||||
exit 1
|
||||
fi
|
||||
if [ -f names_dont_match.c ]; then
|
||||
echo 'halcompile erroneously produced names_dont_match.c'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
3
tests/halcompile/personalities_mod/.gitignore
vendored
Normal file
3
tests/halcompile/personalities_mod/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
bitslice_test.comp
|
||||
lincurve_test.comp
|
||||
logic_test.comp
|
||||
100
tests/halcompile/personalities_mod/4count_2pers.expected
Normal file
100
tests/halcompile/personalities_mod/4count_2pers.expected
Normal file
@@ -0,0 +1,100 @@
|
||||
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_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
|
||||
|
||||
10
tests/halcompile/personalities_mod/4count_2pers.hal
Normal file
10
tests/halcompile/personalities_mod/4count_2pers.hal
Normal file
@@ -0,0 +1,10 @@
|
||||
# personalities are used modulo the number of
|
||||
# halcompiled personalities
|
||||
|
||||
# 4 count, 2 personalities
|
||||
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
|
||||
100
tests/halcompile/personalities_mod/4names_2pers.expected
Normal file
100
tests/halcompile/personalities_mod/4names_2pers.expected
Normal file
@@ -0,0 +1,100 @@
|
||||
bitslice_test u32 IN 0 bs1.in
|
||||
bitslice_test bit OUT FALSE bs1.out-00
|
||||
bitslice_test bit OUT FALSE bs1.out-01
|
||||
bitslice_test s32 OUT 0 bs1.time
|
||||
bitslice_test u32 IN 0 bs2.in
|
||||
bitslice_test bit OUT FALSE bs2.out-00
|
||||
bitslice_test bit OUT FALSE bs2.out-01
|
||||
bitslice_test bit OUT FALSE bs2.out-02
|
||||
bitslice_test s32 OUT 0 bs2.time
|
||||
bitslice_test u32 IN 0 bs3.in
|
||||
bitslice_test bit OUT FALSE bs3.out-00
|
||||
bitslice_test bit OUT FALSE bs3.out-01
|
||||
bitslice_test s32 OUT 0 bs3.time
|
||||
bitslice_test u32 IN 0 bs4.in
|
||||
bitslice_test bit OUT FALSE bs4.out-00
|
||||
bitslice_test bit OUT FALSE bs4.out-01
|
||||
bitslice_test bit OUT FALSE bs4.out-02
|
||||
bitslice_test s32 OUT 0 bs4.time
|
||||
lincurve_test float IN 0 lc1.in
|
||||
lincurve_test float OUT 0 lc1.out
|
||||
lincurve_test float I/O 0 lc1.out-io
|
||||
lincurve_test s32 OUT 0 lc1.time
|
||||
lincurve_test float IN 0 lc2.in
|
||||
lincurve_test float OUT 0 lc2.out
|
||||
lincurve_test float I/O 0 lc2.out-io
|
||||
lincurve_test s32 OUT 0 lc2.time
|
||||
lincurve_test float IN 0 lc3.in
|
||||
lincurve_test float OUT 0 lc3.out
|
||||
lincurve_test float I/O 0 lc3.out-io
|
||||
lincurve_test s32 OUT 0 lc3.time
|
||||
lincurve_test float IN 0 lc4.in
|
||||
lincurve_test float OUT 0 lc4.out
|
||||
lincurve_test float I/O 0 lc4.out-io
|
||||
lincurve_test s32 OUT 0 lc4.time
|
||||
logic_test bit OUT FALSE lg1.and
|
||||
logic_test bit IN FALSE lg1.in-00
|
||||
logic_test bit IN FALSE lg1.in-01
|
||||
logic_test s32 OUT 0 lg1.time
|
||||
logic_test bit IN FALSE lg2.in-00
|
||||
logic_test bit IN FALSE lg2.in-01
|
||||
logic_test bit IN FALSE lg2.in-02
|
||||
logic_test bit IN FALSE lg2.in-03
|
||||
logic_test bit OUT FALSE lg2.or
|
||||
logic_test s32 OUT 0 lg2.time
|
||||
logic_test bit OUT FALSE lg3.and
|
||||
logic_test bit IN FALSE lg3.in-00
|
||||
logic_test bit IN FALSE lg3.in-01
|
||||
logic_test s32 OUT 0 lg3.time
|
||||
logic_test bit IN FALSE lg4.in-00
|
||||
logic_test bit IN FALSE lg4.in-01
|
||||
logic_test bit IN FALSE lg4.in-02
|
||||
logic_test bit IN FALSE lg4.in-03
|
||||
logic_test bit OUT FALSE lg4.or
|
||||
logic_test s32 OUT 0 lg4.time
|
||||
|
||||
bitslice_test s32 RW 0 bs1.tmax
|
||||
bitslice_test bit RO FALSE bs1.tmax-increased
|
||||
bitslice_test s32 RW 0 bs2.tmax
|
||||
bitslice_test bit RO FALSE bs2.tmax-increased
|
||||
bitslice_test s32 RW 0 bs3.tmax
|
||||
bitslice_test bit RO FALSE bs3.tmax-increased
|
||||
bitslice_test s32 RW 0 bs4.tmax
|
||||
bitslice_test bit RO FALSE bs4.tmax-increased
|
||||
lincurve_test s32 RW 0 lc1.tmax
|
||||
lincurve_test bit RO FALSE lc1.tmax-increased
|
||||
lincurve_test float RW 0 lc1.x-val-00
|
||||
lincurve_test float RW 0 lc1.x-val-01
|
||||
lincurve_test float RW 0 lc1.y-val-00
|
||||
lincurve_test float RW 0 lc1.y-val-01
|
||||
lincurve_test s32 RW 0 lc2.tmax
|
||||
lincurve_test bit RO FALSE lc2.tmax-increased
|
||||
lincurve_test float RW 0 lc2.x-val-00
|
||||
lincurve_test float RW 0 lc2.x-val-01
|
||||
lincurve_test float RW 0 lc2.x-val-02
|
||||
lincurve_test float RW 0 lc2.y-val-00
|
||||
lincurve_test float RW 0 lc2.y-val-01
|
||||
lincurve_test float RW 0 lc2.y-val-02
|
||||
lincurve_test s32 RW 0 lc3.tmax
|
||||
lincurve_test bit RO FALSE lc3.tmax-increased
|
||||
lincurve_test float RW 0 lc3.x-val-00
|
||||
lincurve_test float RW 0 lc3.x-val-01
|
||||
lincurve_test float RW 0 lc3.y-val-00
|
||||
lincurve_test float RW 0 lc3.y-val-01
|
||||
lincurve_test s32 RW 0 lc4.tmax
|
||||
lincurve_test bit RO FALSE lc4.tmax-increased
|
||||
lincurve_test float RW 0 lc4.x-val-00
|
||||
lincurve_test float RW 0 lc4.x-val-01
|
||||
lincurve_test float RW 0 lc4.x-val-02
|
||||
lincurve_test float RW 0 lc4.y-val-00
|
||||
lincurve_test float RW 0 lc4.y-val-01
|
||||
lincurve_test float RW 0 lc4.y-val-02
|
||||
logic_test s32 RW 0 lg1.tmax
|
||||
logic_test bit RO FALSE lg1.tmax-increased
|
||||
logic_test s32 RW 0 lg2.tmax
|
||||
logic_test bit RO FALSE lg2.tmax-increased
|
||||
logic_test s32 RW 0 lg3.tmax
|
||||
logic_test bit RO FALSE lg3.tmax-increased
|
||||
logic_test s32 RW 0 lg4.tmax
|
||||
logic_test bit RO FALSE lg4.tmax-increased
|
||||
|
||||
10
tests/halcompile/personalities_mod/4names_2pers.hal
Normal file
10
tests/halcompile/personalities_mod/4names_2pers.hal
Normal file
@@ -0,0 +1,10 @@
|
||||
# personalities are used modulo the number of
|
||||
# halcompiled personalities
|
||||
|
||||
# 4 names, 2 personalities
|
||||
loadrt logic_test names=lg1,lg2,lg3,lg4 personality=0x102,0x204
|
||||
loadrt lincurve_test names=lc1,lc2,lc3,lc4 personality=2,3
|
||||
loadrt bitslice_test names=bs1,bs2,bs3,bs4 personality=2,3
|
||||
|
||||
show pin
|
||||
show parameter
|
||||
8
tests/halcompile/personalities_mod/README
Normal file
8
tests/halcompile/personalities_mod/README
Normal file
@@ -0,0 +1,8 @@
|
||||
Verify that personalities are used modulo 2 when
|
||||
using halcompile --personalities=2
|
||||
|
||||
Test in-tree components:
|
||||
lincurve
|
||||
logic
|
||||
bitslice
|
||||
|
||||
10
tests/halcompile/personalities_mod/checkresult
Executable file
10
tests/halcompile/personalities_mod/checkresult
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
cd "$(dirname "$1")" || exit
|
||||
RETVAL=0
|
||||
for EXPECTED in *.expected ; do
|
||||
BASE=$(basename "$EXPECTED" .expected)
|
||||
RESULT=$BASE.result
|
||||
diff -u "$EXPECTED" "$RESULT" || RETVAL=1
|
||||
done
|
||||
exit $RETVAL
|
||||
|
||||
1
tests/halcompile/personalities_mod/control
Normal file
1
tests/halcompile/personalities_mod/control
Normal file
@@ -0,0 +1 @@
|
||||
Restrictions: sudo
|
||||
35
tests/halcompile/personalities_mod/test.sh
Executable file
35
tests/halcompile/personalities_mod/test.sh
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
${SUDO} halcompile --personalities=2 --install lincurve_test.comp
|
||||
${SUDO} halcompile --personalities=2 --install logic_test.comp
|
||||
${SUDO} halcompile --personalities=2 --install bitslice_test.comp
|
||||
|
||||
# This tells us the expected filename extension ${MODULE_EXT} of realtime
|
||||
# modules.
|
||||
if [[ -f "${EMC2_HOME}/scripts/rtapi.conf" ]]; then
|
||||
source "${EMC2_HOME}/scripts/rtapi.conf"
|
||||
else
|
||||
source "/etc/linuxcnc/rtapi.conf"
|
||||
fi
|
||||
|
||||
for INSTALLED_FILE in "${RTLIB_DIR}"/{lincurve_test,logic_test,bitslice_test}"${MODULE_EXT}"; do
|
||||
if [[ ! -f "${INSTALLED_FILE}" ]]; then
|
||||
echo "'halcompile --install' did not install '${INSTALLED_FILE}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MODE=$(stat --printf '%#03a\n' "${INSTALLED_FILE}")
|
||||
if [[ $((MODE & 0111)) != '0' ]]; then
|
||||
echo "installed file '${INSTALLED_FILE}' has incorrect permissions"
|
||||
echo "expected no execute bits, got ${MODE}"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
for HAL in *.hal; do
|
||||
echo "testing '$HAL'"
|
||||
BASE=$(basename "$HAL" .hal)
|
||||
# use -s to avoid different user assignments in show output
|
||||
halrun -s "$HAL" >| "$BASE".result
|
||||
done
|
||||
1
tests/halcompile/relative-header-user/.gitignore
vendored
Normal file
1
tests/halcompile/relative-header-user/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
relative_header
|
||||
2
tests/halcompile/relative-header-user/checkresult
Executable file
2
tests/halcompile/relative-header-user/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -e "$(dirname "$1")/relative_header" ]
|
||||
1
tests/halcompile/relative-header-user/control
Normal file
1
tests/halcompile/relative-header-user/control
Normal file
@@ -0,0 +1 @@
|
||||
Restrictions: sudo
|
||||
1
tests/halcompile/relative-header-user/local.h
Normal file
1
tests/halcompile/relative-header-user/local.h
Normal file
@@ -0,0 +1 @@
|
||||
#define X 1
|
||||
10
tests/halcompile/relative-header-user/relative_header.comp
Normal file
10
tests/halcompile/relative-header-user/relative_header.comp
Normal file
@@ -0,0 +1,10 @@
|
||||
component relative_header;
|
||||
pin out bit out;
|
||||
include "local.h";
|
||||
license "GPL";
|
||||
option userspace yes;
|
||||
;;
|
||||
void user_mainloop(void) {
|
||||
FOR_ALL_INSTS() { out = ! out; }
|
||||
rtapi_delay(100 * 1000 * 1000);
|
||||
}
|
||||
4
tests/halcompile/relative-header-user/test.sh
Executable file
4
tests/halcompile/relative-header-user/test.sh
Executable file
@@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
rm -f relative_header
|
||||
halcompile --compile relative_header.comp
|
||||
2
tests/halcompile/relative-header/.gitignore
vendored
Normal file
2
tests/halcompile/relative-header/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
relative_header.so
|
||||
relative_header.ko
|
||||
2
tests/halcompile/relative-header/checkresult
Executable file
2
tests/halcompile/relative-header/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -e "$(dirname "$1")/relative_header.so" ] || [ -e "$(dirname "$1")/relative_header.ko" ]
|
||||
1
tests/halcompile/relative-header/local.h
Normal file
1
tests/halcompile/relative-header/local.h
Normal file
@@ -0,0 +1 @@
|
||||
#define X 1
|
||||
7
tests/halcompile/relative-header/relative_header.comp
Normal file
7
tests/halcompile/relative-header/relative_header.comp
Normal file
@@ -0,0 +1,7 @@
|
||||
component relative_header;
|
||||
pin out bit out;
|
||||
include "local.h";
|
||||
function _;
|
||||
license "GPL";
|
||||
;;
|
||||
out = X;
|
||||
3
tests/halcompile/relative-header/test.sh
Executable file
3
tests/halcompile/relative-header/test.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
halcompile --compile relative_header.comp
|
||||
3
tests/halcompile/serial-out-of-tree/.gitignore
vendored
Normal file
3
tests/halcompile/serial-out-of-tree/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
mesa_uart_test.comp
|
||||
mesa_uart_test.so
|
||||
mesa_uart_test.ko
|
||||
2
tests/halcompile/serial-out-of-tree/checkresult
Executable file
2
tests/halcompile/serial-out-of-tree/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -e "$(dirname "$1")/mesa_uart_test.so" ] || [ -e "$(dirname "$1")/mesa_uart_test.ko" ]
|
||||
3
tests/halcompile/serial-out-of-tree/test.sh
Executable file
3
tests/halcompile/serial-out-of-tree/test.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
halcompile --compile mesa_uart_test.comp
|
||||
2
tests/halcompile/userspace-count-names/.gitignore
vendored
Normal file
2
tests/halcompile/userspace-count-names/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
*.result
|
||||
userspace_count_names
|
||||
2
tests/halcompile/userspace-count-names/both.hal
Normal file
2
tests/halcompile/userspace-count-names/both.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
loadusr -W userspace_count_names count=3 names=no,way
|
||||
list pin
|
||||
9
tests/halcompile/userspace-count-names/checkresult
Executable file
9
tests/halcompile/userspace-count-names/checkresult
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
cd "$(dirname "$1")" || { echo "E: Could not change directory to '$(dirname "$1")'"; exit 1; }
|
||||
RETVAL=0
|
||||
for EXPECTED in *.expected ; do
|
||||
BASE=$(basename "$EXPECTED" .expected)
|
||||
RESULT=$BASE.result
|
||||
diff -u "$EXPECTED" "$RESULT" || RETVAL=1
|
||||
done
|
||||
exit $RETVAL
|
||||
@@ -0,0 +1,26 @@
|
||||
count=2
|
||||
argc=2
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=zip
|
||||
argv[2]=(null)
|
||||
userspace-count-names.0.out
|
||||
userspace-count-names.1.out
|
||||
|
||||
count=2
|
||||
argc=3
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=zip
|
||||
argv[2]=zap
|
||||
argv[3]=(null)
|
||||
userspace-count-names.0.out
|
||||
userspace-count-names.1.out
|
||||
|
||||
count=2
|
||||
argc=3
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=zap
|
||||
argv[2]=zoot
|
||||
argv[3]=(null)
|
||||
userspace-count-names.0.out
|
||||
userspace-count-names.1.out
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
loadusr -W userspace_count_names count=2 zip
|
||||
list pin
|
||||
unloadusr userspace_count_names
|
||||
waitusr userspace_count_names
|
||||
|
||||
loadusr -W userspace_count_names zip count=2 zap
|
||||
list pin
|
||||
unloadusr userspace_count_names
|
||||
waitusr userspace_count_names
|
||||
|
||||
loadusr -W userspace_count_names zap zoot count=2
|
||||
list pin
|
||||
unloadusr userspace_count_names
|
||||
waitusr userspace_count_names
|
||||
|
||||
8
tests/halcompile/userspace-count-names/count=3.expected
Normal file
8
tests/halcompile/userspace-count-names/count=3.expected
Normal file
@@ -0,0 +1,8 @@
|
||||
count=3
|
||||
argc=1
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=(null)
|
||||
userspace-count-names.0.out
|
||||
userspace-count-names.1.out
|
||||
userspace-count-names.2.out
|
||||
|
||||
2
tests/halcompile/userspace-count-names/count=3.hal
Normal file
2
tests/halcompile/userspace-count-names/count=3.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
loadusr -W userspace_count_names count=3
|
||||
list pin
|
||||
@@ -0,0 +1,33 @@
|
||||
count=0
|
||||
names[0]=swim
|
||||
names[1]=swish
|
||||
argc=3
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=slap
|
||||
argv[2]=slop
|
||||
argv[3]=(null)
|
||||
swim.out
|
||||
swish.out
|
||||
|
||||
count=0
|
||||
names[0]=swat
|
||||
names[1]=swap
|
||||
argc=4
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=slam
|
||||
argv[2]=slalom
|
||||
argv[3]=slap
|
||||
argv[4]=(null)
|
||||
swap.out
|
||||
swat.out
|
||||
|
||||
count=0
|
||||
names[0]=sock
|
||||
names[1]=slack
|
||||
argc=2
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=slip
|
||||
argv[2]=(null)
|
||||
slack.out
|
||||
sock.out
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
loadusr -W userspace_count_names names=swim,swish slap slop
|
||||
list pin
|
||||
unloadusr userspace_count_names
|
||||
waitusr userspace_count_names
|
||||
|
||||
loadusr -W userspace_count_names slam slalom names=swat,swap slap
|
||||
list pin
|
||||
unloadusr userspace_count_names
|
||||
waitusr userspace_count_names
|
||||
|
||||
loadusr -W userspace_count_names slip names=sock,slack
|
||||
list pin
|
||||
unloadusr userspace_count_names
|
||||
waitusr userspace_count_names
|
||||
|
||||
9
tests/halcompile/userspace-count-names/names.expected
Normal file
9
tests/halcompile/userspace-count-names/names.expected
Normal file
@@ -0,0 +1,9 @@
|
||||
count=0
|
||||
names[0]=bibble
|
||||
names[1]=bobble
|
||||
argc=1
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=(null)
|
||||
bibble.out
|
||||
bobble.out
|
||||
|
||||
2
tests/halcompile/userspace-count-names/names.hal
Normal file
2
tests/halcompile/userspace-count-names/names.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
loadusr -W userspace_count_names names=bibble,bobble
|
||||
list pin
|
||||
6
tests/halcompile/userspace-count-names/no-args.expected
Normal file
6
tests/halcompile/userspace-count-names/no-args.expected
Normal file
@@ -0,0 +1,6 @@
|
||||
count=0
|
||||
argc=1
|
||||
argv[0]=userspace_count_names
|
||||
argv[1]=(null)
|
||||
userspace-count-names.0.out
|
||||
|
||||
2
tests/halcompile/userspace-count-names/no-args.hal
Normal file
2
tests/halcompile/userspace-count-names/no-args.hal
Normal file
@@ -0,0 +1,2 @@
|
||||
loadusr -W userspace_count_names
|
||||
list pin
|
||||
23
tests/halcompile/userspace-count-names/test.sh
Executable file
23
tests/halcompile/userspace-count-names/test.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
${SUDO} halcompile --install userspace_count_names.comp
|
||||
|
||||
INSTALLED_FILE="${EMC2_HOME}/bin/userspace_count_names"
|
||||
if [[ ! -f "${INSTALLED_FILE}" ]]; then
|
||||
echo "'halcompile --install' did not install '${INSTALLED_FILE}'"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MODE=$(stat --printf '%#03a\n' "${INSTALLED_FILE}")
|
||||
if [[ $((MODE & 0111)) == '0' ]]; then
|
||||
echo "installed file '${INSTALLED_FILE}' has incorrect permissions"
|
||||
echo "expected *some* execute bit, got ${MODE}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for HAL in *.hal; do
|
||||
echo "testing $HAL"
|
||||
BASE=$(basename "$HAL" .hal)
|
||||
halrun "$HAL" | tr ' ' '\n' >| "$BASE".result
|
||||
done
|
||||
@@ -0,0 +1,35 @@
|
||||
component userspace_count_names;
|
||||
option userspace;
|
||||
option userinit;
|
||||
|
||||
pin out signed out = 42;
|
||||
license "GPL";
|
||||
;;
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void exit_handler(int signo) {
|
||||
;
|
||||
}
|
||||
|
||||
void userinit(int argc, char **argv) {
|
||||
int i;
|
||||
printf("count=%d\n", count);
|
||||
for (i = 0; i < 16; i ++) {
|
||||
if (names[i] != NULL) {
|
||||
printf("names[%d]=%s\n", i, names[i]);
|
||||
}
|
||||
}
|
||||
printf("argc=%d\n", argc);
|
||||
for (i = 0; i <= argc; i ++) {
|
||||
printf("argv[%d]=%s\n", i, argv[i]);
|
||||
}
|
||||
signal(SIGTERM, exit_handler);
|
||||
fflush(NULL);
|
||||
}
|
||||
|
||||
void user_mainloop(void) {
|
||||
pause();
|
||||
}
|
||||
|
||||
2
tests/halcompile/userspace/.gitignore
vendored
Normal file
2
tests/halcompile/userspace/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
rand_test
|
||||
rand_test.comp
|
||||
2
tests/halcompile/userspace/checkresult
Executable file
2
tests/halcompile/userspace/checkresult
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
[ -x "$(dirname "$1")/rand_test" ]
|
||||
15
tests/halcompile/userspace/rand.comp
Normal file
15
tests/halcompile/userspace/rand.comp
Normal file
@@ -0,0 +1,15 @@
|
||||
component rand;
|
||||
option userspace;
|
||||
|
||||
pin out float out;
|
||||
license "GPL";
|
||||
;;
|
||||
#include <unistd.h>
|
||||
|
||||
void user_mainloop(void) {
|
||||
while(1) {
|
||||
usleep(1000);
|
||||
FOR_ALL_INSTS() out = drand48();
|
||||
}
|
||||
}
|
||||
|
||||
2
tests/halcompile/userspace/test.sh
Executable file
2
tests/halcompile/userspace/test.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
halcompile --compile rand_test.comp
|
||||
Reference in New Issue
Block a user