Skip to content

Commit 5521da1

Browse files
committed
mb2hal tests: accept any comp id
uspace and RTAI assign different component ids at component load-time. This test used to verify that the mb2hal component got a specific component id, which means it only worked on uspace, and always failed on RTAI. This commit makes the tests ignore the component ids, but still verify everything they actually care about.
1 parent 8f0e6c6 commit 5521da1

4 files changed

Lines changed: 51 additions & 25 deletions

File tree

tests/mb2hal/mb2hal.1a/checkresult

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
TESTDIR=$(dirname $1)
5+
cd "${TESTDIR}"
6+
7+
# HAL assigns each component a unique component ID at load-time.
8+
# The RTAI and uspace HAL implementations assign different component IDs,
9+
# so remove all mentions of specific component IDs from the result file,
10+
# so that a single `expected` file works for both.
11+
sed --in-place --regexp-extended --expression='s/^(.*unloading HAL module \[)[0-9]+(.*)$/\1(ignored comp id)\2/' result
12+
13+
diff -u expected result

tests/mb2hal/mb2hal.1a/expected

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,6 @@ mb2hal main OK: Link thread loop and logic 0 created OK
126126
mb2hal main OK: mb2hal is running
127127
mb2hal quit_signal DEBUG: signal [15] received
128128
mb2hal quit_cleanup DEBUG: started
129-
mb2hal quit_cleanup DEBUG: unloading HAL module [4] ret[0]
129+
mb2hal quit_cleanup DEBUG: unloading HAL module [(ignored comp id)] ret[0]
130130
mb2hal quit_cleanup DEBUG: done OK
131131
mb2hal main OK: going to exit!

tests/mb2hal/mb2hal.1b/checkresult

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
set -e
3+
4+
TESTDIR=$(dirname $1)
5+
cd "${TESTDIR}"
6+
7+
# HAL assigns each component a unique component ID at load-time.
8+
# The RTAI and uspace HAL implementations assign different component IDs,
9+
# so remove all mentions of specific component IDs from the result file,
10+
# so that a single `expected` file works for both.
11+
sed --in-place --regexp-extended --expression='s/^( *)[0-9]+(.*mb2hal.Modbus_fnct_.*)$/\1(ignored comp id)\2/' result
12+
13+
diff -u expected result

tests/mb2hal/mb2hal.1b/expected

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
Component Pins:
22
Owner Type Dir Value Name
3-
4 bit OUT FALSE mb2hal.Modbus_fnct_02.00
4-
4 bit OUT FALSE mb2hal.Modbus_fnct_02.01
5-
4 bit OUT FALSE mb2hal.Modbus_fnct_02.02
6-
4 bit OUT FALSE mb2hal.Modbus_fnct_02.03
3+
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.00
4+
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.01
5+
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.02
6+
(ignored comp id) bit OUT FALSE mb2hal.Modbus_fnct_02.03
77

88
Component Pins:
99
Owner Type Dir Value Name
10-
4 float OUT 0 mb2hal.Modbus_fnct_03.00.float
11-
4 s32 OUT 0 mb2hal.Modbus_fnct_03.00.int
12-
4 float OUT 0 mb2hal.Modbus_fnct_03.01.float
13-
4 s32 OUT 0 mb2hal.Modbus_fnct_03.01.int
14-
4 float OUT 0 mb2hal.Modbus_fnct_03.02.float
15-
4 s32 OUT 0 mb2hal.Modbus_fnct_03.02.int
16-
4 float OUT 0 mb2hal.Modbus_fnct_03.03.float
17-
4 s32 OUT 0 mb2hal.Modbus_fnct_03.03.int
10+
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.00.float
11+
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.00.int
12+
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.01.float
13+
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.01.int
14+
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.02.float
15+
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.02.int
16+
(ignored comp id) float OUT 0 mb2hal.Modbus_fnct_03.03.float
17+
(ignored comp id) s32 OUT 0 mb2hal.Modbus_fnct_03.03.int
1818

1919
Component Pins:
2020
Owner Type Dir Value Name
21-
4 float IN 0 mb2hal.Modbus_fnct_06.00
22-
4 float IN 0 mb2hal.Modbus_fnct_06.01
23-
4 float IN 0 mb2hal.Modbus_fnct_06.02
24-
4 float IN 0 mb2hal.Modbus_fnct_06.03
21+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.00
22+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.01
23+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.02
24+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_06.03
2525

2626
Component Pins:
2727
Owner Type Dir Value Name
28-
4 bit IN FALSE mb2hal.Modbus_fnct_15.00
29-
4 bit IN FALSE mb2hal.Modbus_fnct_15.01
30-
4 bit IN FALSE mb2hal.Modbus_fnct_15.02
31-
4 bit IN FALSE mb2hal.Modbus_fnct_15.03
28+
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.00
29+
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.01
30+
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.02
31+
(ignored comp id) bit IN FALSE mb2hal.Modbus_fnct_15.03
3232

3333
Component Pins:
3434
Owner Type Dir Value Name
35-
4 float IN 0 mb2hal.Modbus_fnct_16.00
36-
4 float IN 0 mb2hal.Modbus_fnct_16.01
37-
4 float IN 0 mb2hal.Modbus_fnct_16.02
38-
4 float IN 0 mb2hal.Modbus_fnct_16.03
35+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.00
36+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.01
37+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.02
38+
(ignored comp id) float IN 0 mb2hal.Modbus_fnct_16.03
3939

0 commit comments

Comments
 (0)