Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/emc/ini/linuxcnc_check_ini.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ def main():
if o in ("-e", "--error"):
global error_on_warning
error_on_warning = True
if o in ("-h", "--help"):
elif o in ("-h", "--help"):
usage() # no return from here
else:
print("Unhandled option: '{}'".format(o), file=sys.stderr);
Expand Down
5 changes: 5 additions & 0 deletions tests/linuxcnc_check_ini/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Test the exit value of linuxcnc_check_ini with the -e/--error option.

warn.ini contains only a warning (duplicate entry). Without -e the exit
value must be 0, with -e or --error warnings are treated as errors and the
exit value must be 1.
8 changes: 8 additions & 0 deletions tests/linuxcnc_check_ini/expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
warn.ini -> 0
1
-e warn.ini -> 1
1
--error warn.ini -> 1
1
-h -> 2
0
15 changes: 15 additions & 0 deletions tests/linuxcnc_check_ini/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
# Check the exit value of linuxcnc_check_ini with and without -e/--error on
# an INI file that only produces warnings.

run() {
msgs=$(linuxcnc_check_ini "$@" 2>&1 > /dev/null)
echo "$* -> $?"
echo "$msgs" | grep -c ": warning: "
}

run warn.ini
run -e warn.ini
run --error warn.ini
run -h
exit 0
13 changes: 13 additions & 0 deletions tests/linuxcnc_check_ini/warn.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Valid configuration except for one duplicated joint entry, which makes
# linuxcnc_check_ini emit a warning (but no error).
[KINS]
KINEMATICS = genhexkins
JOINTS = 1

[TRAJ]
LINEAR_UNITS = mm
ANGULAR_UNITS = degree

[JOINT_0]
MAX_VELOCITY = 1.0
MAX_VELOCITY = 2.0
Loading