Skip to content

Commit f64b490

Browse files
authored
Merge pull request #4463 from grandixximo/tcl-skip-detect-fix
tests: detect Tcl HAL extensions functionally in skip scripts
2 parents fe18b8a + 9e60cf8 commit f64b490

3 files changed

Lines changed: 16 additions & 16 deletions

File tree

tests/tclsh-extensions/skip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
#!/bin/bash
2-
# This test exercises the Tcl HAL extensions (tcl/hal.so,
3-
# tcl/linuxcnc.so), which are only built in GUI builds (BUILD_GUI);
4-
# skip in headless builds. The tcl dir is taken from TCLLIBPATH
5-
# (exported by rip-environment).
2+
# This test needs the Tcl HAL extensions, only built in GUI builds.
3+
# Ask tclsh to load them like the test does; works for run-in-place
4+
# (TCLLIBPATH) and installed packages (auto_path). catch is needed
5+
# because tclsh reads stdin interactively and exits 0 even on error.
66
set -u
77

88
if ! command -v tclsh >/dev/null 2>&1; then
99
echo "skip: tclsh not installed" >&2
1010
exit 1
1111
fi
1212

13-
read -r tcldir _ <<< "${TCLLIBPATH:-}"
14-
if ! [ -f "${tcldir:-/nonexistent}/linuxcnc.so" ]; then
13+
if ! echo 'exit [catch {package require Linuxcnc
14+
package require Hal}]' | tclsh >/dev/null 2>&1; then
1515
echo "skip: Tcl HAL extensions not built (headless build)" >&2
1616
exit 1
1717
fi

tests/twopass-personality/skip

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
2-
# haltcl needs the Tcl HAL extension (tcl/hal.so), which is only built
3-
# in GUI builds (BUILD_GUI); skip in headless builds. The tcl dir is
4-
# taken from TCLLIBPATH (exported by rip-environment).
2+
# haltcl needs the Tcl HAL extension, only built in GUI builds. Ask
3+
# tclsh to load it like the test does; works for run-in-place
4+
# (TCLLIBPATH) and installed packages (auto_path). catch is needed
5+
# because tclsh reads stdin interactively and exits 0 even on error.
56
set -u
67

78
if ! command -v tclsh >/dev/null 2>&1; then
89
echo "skip: tclsh not installed" >&2
910
exit 1
1011
fi
1112

12-
read -r tcldir _ <<< "${TCLLIBPATH:-}"
13-
if ! [ -f "${tcldir:-/nonexistent}/hal.so" ]; then
13+
if ! echo 'exit [catch {package require Hal}]' | tclsh >/dev/null 2>&1; then
1414
echo "skip: Tcl HAL extension not built (headless build)" >&2
1515
exit 1
1616
fi

tests/twopass/skip

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
#!/bin/bash
2-
# haltcl needs the Tcl HAL extension (tcl/hal.so), which is only built
3-
# in GUI builds (BUILD_GUI); skip in headless builds. The tcl dir is
4-
# taken from TCLLIBPATH (exported by rip-environment).
2+
# haltcl needs the Tcl HAL extension, only built in GUI builds. Ask
3+
# tclsh to load it like the test does; works for run-in-place
4+
# (TCLLIBPATH) and installed packages (auto_path). catch is needed
5+
# because tclsh reads stdin interactively and exits 0 even on error.
56
set -u
67

78
if ! command -v tclsh >/dev/null 2>&1; then
89
echo "skip: tclsh not installed" >&2
910
exit 1
1011
fi
1112

12-
read -r tcldir _ <<< "${TCLLIBPATH:-}"
13-
if ! [ -f "${tcldir:-/nonexistent}/hal.so" ]; then
13+
if ! echo 'exit [catch {package require Hal}]' | tclsh >/dev/null 2>&1; then
1414
echo "skip: Tcl HAL extension not built (headless build)" >&2
1515
exit 1
1616
fi

0 commit comments

Comments
 (0)