Skip to content

Commit

Permalink
CI: Series of presumed trivial suggestions by shellcheck.
Browse files Browse the repository at this point in the history
  • Loading branch information
smoe committed Oct 19, 2024
1 parent d46f876 commit 8124230
Show file tree
Hide file tree
Showing 24 changed files with 80 additions and 53 deletions.
2 changes: 1 addition & 1 deletion tests/build/ui/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
set -x
g++ -I${HEADERS} \
nml-position-logger.cc \
-L ${LIBDIR} -lnml -llinuxcnc \
-L "${LIBDIR}" -lnml -llinuxcnc \
-o /dev/null
9 changes: 4 additions & 5 deletions tests/halcompile/names/test.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/bin/bash
set -x
set -ex

# this one must succeed
rm -f names_match.c
halcompile names_match.comp
if [ $? -ne 0 ]; then

if ! halcompile names_match.comp ; then
echo 'halcompile failed to process names_match.comp'
exit 1
fi
Expand All @@ -15,8 +15,7 @@ fi

# this one must fail
rm -f names_dont_match.c
halcompile names_dont_match.comp
if [ $? -eq 0 ]; then
if ! halcompile names_dont_match.comp ; then
echo 'halcompile erroneously accepted names_dont_match.comp'
exit 1
fi
Expand Down
8 changes: 4 additions & 4 deletions tests/halcompile/personalities_mod/test.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -e

${SUDO} halcompile --personalities=2 --install lincurve_test.comp
Expand Down Expand Up @@ -28,8 +28,8 @@ for INSTALLED_FILE in "${RTLIB_DIR}"/{lincurve_test,logic_test,bitslice_test}"${
done

for HAL in *.hal; do
echo "testing $HAL"
BASE=$(basename $HAL .hal)
echo "testing '$HAL'"
BASE=$(basename "$HAL" .hal)
# use -s to avoid different user assignments in show output
halrun -s $HAL >| $BASE.result
halrun -s "$HAL" >| "$BASE".result
done
2 changes: 1 addition & 1 deletion tests/interp/compile/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -xe

g++ -o use-rs274 use-rs274.cc \
-Wall -Wextra -Wno-return-type -Wno-unused-parameter \
-I $HEADERS $PYTHON_CPPFLAGS -L $LIBDIR -Wl,-rpath,$LIBDIR $PYTHON_EXTRA_LDFLAGS $PYTHON_LIBS $PYTHON_EXTRA_LIBS -lrs274
-I $HEADERS $PYTHON_CPPFLAGS -L "$LIBDIR" -Wl,-rpath,$LIBDIR $PYTHON_EXTRA_LDFLAGS $PYTHON_LIBS $PYTHON_EXTRA_LIBS -lrs274
LD_BIND_NOW=YesPlease ./use-rs274
5 changes: 3 additions & 2 deletions tests/interp/g71-endless-loop2/test.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#!/bin/bash
#
set -e

# Demonstrate endless loop when an additional segment is added in the G71 call.
# This is a subset of a file that was supplied in
# https://github.com/LinuxCNC/linuxcnc/issues/2844 and which worked up to and
# including 2.9.1~pre1. It entered an endless loop after
# https://github.com/LinuxCNC/linuxcnc/pull/2677

rs274 -g g71-endless-loop2.ngc | awk '{$1=""; print}' > result &
rs274 -g g71-endless-loop2.ngc | awk '{"$1"=""; print}' > result &
pid=$!

# Give it 5 seconds to complete
Expand Down
2 changes: 1 addition & 1 deletion tests/interp/plug/absolute/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
rs274 -p ${LIBDIR}/linuxcnc/canterp.so -g canon | awk '{$1=""; print}'
rs274 -p "${LIBDIR}"/linuxcnc/canterp.so -g canon | awk '{$1=""; print}'
exit ${PIPESTATUS[0]}
2 changes: 2 additions & 0 deletions tests/linuxcncrsh/test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

rm -f gcode-output

if nc -z localhost 5007; then
Expand Down
2 changes: 1 addition & 1 deletion tests/m70-m73/m73-flood-mist-restore.0/test.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
rs274 -g test.ngc | awk '{$1=""; print}'
rs274 -g test.ngc | awk '{"$1"=""; print}'
exit ${PIPESTATUS[0]}
6 changes: 3 additions & 3 deletions tests/motion-logger/basic/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
rm -f out.motion-logger*

for SRC in *.in; do
DEST=$(basename ${SRC} .in)
rm -f ${DEST}
egrep -v '(^ *$)|(^ *#)' ${SRC} > ${DEST}
DEST=$(basename "${SRC}" .in)
rm -f "${DEST}"
grep -E -v '(^ *$)|(^ *#)' "${SRC}" > "${DEST}"
done

linuxcnc -r test.ini
Expand Down
8 changes: 5 additions & 3 deletions tests/motion-logger/startup-gcode-abort/test.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#!/bin/bash

set -e

rm -f out.motion-logger*

for SRC in *.in; do
DEST=$(basename ${SRC} .in)
rm -f ${DEST}
egrep -v '(^ *$)|(^ *#)' ${SRC} > ${DEST}
DEST=$(basename "${SRC}" .in)
rm -f "${DEST}"
grep -E -v '(^ *$)|(^ *#)' "${SRC}" > "${DEST}"
done

linuxcnc -r test.ini
Expand Down
4 changes: 2 additions & 2 deletions tests/remap/remap-io/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash -e
export PYTHONUNBUFFERED=1
do_test() {
INI=$1
linuxcnc -r $INI | grep -i m6
INI="$1"
linuxcnc -r "$INI" | grep -i m6
}

echo "********** Testing python remaps"
Expand Down
6 changes: 3 additions & 3 deletions tests/t0/shared-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ fi
(
function introspect() {
SEQUENCE_NUMBER=$1
echo set wait done
echo 'set wait done'
echo "set mdi m100 P6 Q$SEQUENCE_NUMBER" # sequence number
echo 'set mdi m100 P0 Q#5420' # X
echo 'set mdi m100 P1 Q#5421' # Y
echo 'set mdi m100 P2 Q#5422' # Z
echo 'set mdi m100 P3 Q#5400' # toolno
echo 'set mdi m100 P4 Q#5403' # TLO z
echo 'set mdi m100 P5' # blank line
echo set wait done
echo 'set wait done'
}

echo hello EMC mt 1.0
Expand Down Expand Up @@ -660,7 +660,7 @@ fi


# give linuxcnc a second to finish
echo set wait done
echo 'set wait done'

echo shutdown
) | nc localhost 5007
Expand Down
5 changes: 4 additions & 1 deletion tests/trajectory-planner/circular-arcs/build-debug.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#/bin/bash
#!/bin/bash

set -e

cd ../../../src
#Ugly way to force rebuild of kinematics, which assumes that tp_debug isn't
#used anywhere else...
Expand Down
5 changes: 4 additions & 1 deletion tests/trajectory-planner/circular-arcs/build-profile.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#/bin/bash
#!/bin/bash

set -e

cd ../../../src
#Ugly way to force rebuild of kinematics, which assumes that tp_debug isn't
#used anywhere else...
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
ln -sf ../../../../configs/sim/core_sim.hal
ln -sf ../../../../configs/sim/axis_manualtoolchange.hal
ln -sf ../../../../configs/sim/sim_spindle_encoder.hal
#!/bin/bash

set -e

ln -sf ../../../../configs/sim/core_sim.hal .
ln -sf ../../../../configs/sim/axis_manualtoolchange.hal .
ln -sf ../../../../configs/sim/sim_spindle_encoder.hal .
5 changes: 3 additions & 2 deletions tests/trajectory-planner/circular-arcs/process_runlog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
#===============================================================================

set -o nounset # Treat unset variables as an error
set -e

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/total movement/ {print $2,$6,$9}' $1 > movement.log
awk '/total movement/ {print $2,$6,$9}' "$1" > movement.log
fi
4 changes: 3 additions & 1 deletion tests/trajectory-planner/circular-arcs/profile-run.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

function say_done {
espeak "done" 2> /dev/null
}
Expand All @@ -15,7 +17,7 @@ operf rtapi_app > profile.log &
linuxcnc -r circular_arcs.ini &
LOCAL_LCNC_PID=$!
echo $LOCAL_LCNC_PID
(./machine_setup.py $1 && say_done) || say_failed
(./machine_setup.py "$1" && say_done) || say_failed
#fg
#End profiling
pkill -9 axis
Expand Down
2 changes: 1 addition & 1 deletion tests/trajectory-planner/circular-arcs/test-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ then
fi
cp position.blank position.txt
#Assume build without TP debug logging enabled
linuxcnc $1 > test.log &
linuxcnc "$1" > test.log &
python3 run_all_tests.py
fg
6 changes: 4 additions & 2 deletions tests/trajectory-planner/circular-arcs/test-debug.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
#!/bin/bash
set -o monitor
set -e

./build-debug.sh
cp position.blank configs/position.txt
rm configs/constraints.log
linuxcnc $1 > test.log &
./machine_setup.py $2
linuxcnc "$1" > test.log &
./machine_setup.py "$2"
fg
./process_runlog.sh test.log
#if [ -a movement.log ]
Expand Down
4 changes: 3 additions & 1 deletion tests/trajectory-planner/circular-arcs/test-optimization.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/bin/bash

set -e

function say_done {
espeak "done" 2> /dev/null
}
Expand All @@ -8,7 +10,7 @@ set -o monitorA
./build-debug.sh
cp position.blank position.txt
linuxcnc -r circular_arcs.ini > test.log &
./machine_setup.py $1 && say_done
./machine_setup.py "$1" && say_done
fg
./save_activate.sh test.log
exit $1
9 changes: 6 additions & 3 deletions tests/trajectory-planner/circular-arcs/test-release.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
#!/bin/bash
set -o monitor
set -e

#./build-release.sh
cp position.blank configs/position.txt
rm configs/constraints.log
linuxcnc $1 > test.log &
rm -f configs/constraints.log

linuxcnc "$1" > test.log &
if [ -f "$2" ]
then
FILENAME="../"$2
fi
./machine_setup.py $FILENAME
./machine_setup.py "$FILENAME"
fg
./process_runlog.sh test.log
#if [ -a movement.log ]
Expand Down
5 changes: 3 additions & 2 deletions tests/trajectory-planner/circular-arcs/util/save_activate.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
set -o nounset # Treat unset variables as an error
set -e

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/Activate tc/ {print $5,$8,$11,$14}' $1 > segment_data.log
awk '/Activate tc/ {print $5,$8,$11,$14}' "$1" > segment_data.log
fi
17 changes: 9 additions & 8 deletions tests/trajectory-planner/circular-arcs/util/save_arc_data.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
#!/bin/bash
set -o nounset # Treat unset variables as an error
set -e

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/tangent angle/ {print $4}' $1 > tangent_data.txt
awk '/tangent angle/ {print $4}' "$1" > tangent_data.txt
fi

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/circ[12] angle/ {print $4}' $1 > angle_data.txt
awk '/circ[12] angle/ {print $4}' "$1" > angle_data.txt
fi

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/circ[12] spiral/ {print $4}' $1 > spiral_data.txt
awk '/circ[12] spiral/ {print $4}' "$1" > spiral_data.txt
fi

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/circ[12] spiral/ {print $4}' $1 > spiral_data.txt
awk '/circ[12] spiral/ {print $4}' "$1" > spiral_data.txt
fi
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/bin/bash
set -o nounset # Treat unset variables as an error
set -e

if [ -a $1 ]
if [ -a "$1" ]
then
awk '/tangent angle/ {print $4}' $1 > tangent_data.log
awk '/tangent angle/ {print $4}' "$1" > tangent_data.log
fi

0 comments on commit 8124230

Please sign in to comment.