Import LinuxCNC source tree

This commit is contained in:
Wang Dequan
2026-08-20 06:17:39 +08:00
commit 2c814634c3
9429 changed files with 10556013 additions and 0 deletions

21
tests/tooledit/expected Normal file
View File

@@ -0,0 +1,21 @@
T1 P1 Z123 D3 ;3mm end mill
T2 P4 Z123 D1.5 ;1.5mm end mill
T3 P3 Z123 D5 ;5mm tap drill
T4 P2 Z123.456 D16 ;16 mm Schaftfräser
T5 P5 Z0.1 D25 ;25'er Fräser
T6 P6 Z0.001 D6 ;tool 6
T7 P7 Z0.0001 D7 ;7
T8 P8 Z12345.6789 D8 ;8
T9 P9 Z12345 D9 ;9
T10 P10 Z1234.12346 D10 ;10
T11 P11 Z12345.1235 D11 ;11
T12 P12 Z123456.123 D12 ;12
T13 P13 Z1234567.12 D13 ;13
T14 P14 Z12345678.1 D14 ;14
T15 P15 Z123456789 D15 ;15
T16 P16 Z1.01 D16 ;16
T17 P17 Z1.001 D17 ;17
T18 P18 Z1.0001 D18 ;18
T19 P19 Z1.00001 D19 ;19
T20 P20 Z1.000001 D20 ;20
T21 P21 Z1.0000001 D21 ;21

27
tests/tooledit/skip Executable file
View File

@@ -0,0 +1,27 @@
#!/bin/bash
# tooledit is a Tk/BWidget application; headless builds (--disable-gui)
# do not build or run any of the Tk tooling. Skip when the required
# Tcl environment is unavailable. BWidget pulls in Tk on load, which
# needs a display, so probe under xvfb-run; the explicit exit is needed
# because 'package require' errors do not reliably set tclsh's exit
# code when reading commands from stdin. Probe on server number 95:
# xvfb-run's default is 99, and test.sh's plain xvfb-run would race a
# lingering Xvfb on the same display.
set -u
if ! command -v xvfb-run >/dev/null 2>&1; then
echo "skip: xvfb-run not installed" >&2
exit 1
fi
if ! command -v tclsh >/dev/null 2>&1; then
echo "skip: tclsh not installed" >&2
exit 1
fi
if ! xvfb-run -a --server-num=95 tclsh <<< 'exit [catch {package require BWidget}]'; then
echo "skip: Tk/BWidget not available (headless build)" >&2
exit 1
fi
exit 0

30
tests/tooledit/test.sh Executable file
View File

@@ -0,0 +1,30 @@
#!/bin/bash
# test if floating point numbers are formatted correctly
if ! command -v xvfb-run &> /dev/null; then
echo "W: xvfb-run could not be found, we assume everything works" > /dev/stderr
cat expected
exit 0
fi
#create temporary files so we don't write into write access problems
infile=$(mktemp)
outfile=$(mktemp)
cat test.tbl > "$infile"
# run the test
xvfb-run "${LINUXCNC_EMCSH/wish/tclsh}" test.tcl "$infile" "$outfile" 2> tclerror.log;
if [ "$(wc -l < tclerror.log)" -ne 0 ]; then
cat tclerror.log
exit 1
fi
# write the resulting tool table to stdout so the test framework can evaluate it
cat "$outfile"
# remove the temporary files
rm "$infile" "$outfile" "$outfile".bak
exit 0

21
tests/tooledit/test.tbl Normal file
View File

@@ -0,0 +1,21 @@
T1 P1 Z123 D3 ;3mm end mill
T2 P4 Z123.0 D1.5 ;1.5mm end mill
T3 P3 Z123.000 D5 ;5mm tap drill
T4 P2 Z123.456 D16 ;16 mm Schaftfräser
T5 P5 Z0.1 D25 ;25'er Fräser
T6 P6 Z0.001 D6 ;tool 6
T7 P7 Z0.0001 D7 ;7
T8 P8 Z12345.6789 D8 ;8
T9 P9 Z12345.0 D9 ;9
T10 P10 Z1234.123456 D10 ;10
T11 P11 Z12345.123456 D11 ;11
T12 P12 Z123456.123456 D12 ;12
T13 P13 Z1234567.123456 D13 ;13
T14 P14 Z12345678.123456 D14 ;14
T15 P15 Z123456789.123456 D15 ;15
T16 P16 Z1.01 D16 ;16
T17 P17 Z1.001 D17 ;17
T18 P18 Z1.0001 D18 ;18
T19 P19 Z1.00001 D19 ;19
T20 P20 Z1.000001 D20 ;20
T21 P21 Z1.0000001 D21 ;21

13
tests/tooledit/test.tcl Normal file
View File

@@ -0,0 +1,13 @@
source ../../tcl/tooledit.tcl
set infile [lindex $argv 0]
set outfile [lindex $argv 1]
# get rid of the default window
wm withdraw .
# run tooledit using the test.tbl
tooledit::tooledit $infile {x y z a b c u v w diam front back orien}
# write the test.tbl to result.tbl
tooledit::writefile $outfile
# finish up
exit 0