Import LinuxCNC source tree
This commit is contained in:
10
tests/remap/variable-injection/README
Normal file
10
tests/remap/variable-injection/README
Normal file
@@ -0,0 +1,10 @@
|
||||
this regression tests whether:
|
||||
|
||||
(1)
|
||||
- variables inserted in a prolog can be references properly in the NGC procedure
|
||||
- changes to variables in the NGC procedure can be properly retrieved in the epilog
|
||||
|
||||
(2)
|
||||
- variables inserted in a prolog, NGC procedure or epilog are deleted on the end of a remap
|
||||
- (1) also works for several remaps in a block
|
||||
|
||||
15
tests/remap/variable-injection/expected
Normal file
15
tests/remap/variable-injection/expected
Normal file
@@ -0,0 +1,15 @@
|
||||
executing
|
||||
1 N..... USE_LENGTH_UNITS(CANON_UNITS_MM)
|
||||
2 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
3 N..... SET_G92_OFFSET(0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
4 N..... SET_XY_ROTATION(0.0000)
|
||||
5 N..... SET_FEED_REFERENCE(CANON_XYZ)
|
||||
6 N..... ON_RESET()
|
||||
7 N..... SET_G5X_OFFSET(1, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000)
|
||||
8 N..... SET_XY_ROTATION(0.0000)
|
||||
9 N..... SET_FEED_MODE(0, 0)
|
||||
10 N..... SET_FEED_RATE(0.0000)
|
||||
11 N..... STOP_SPINDLE_TURNING(0)
|
||||
12 N..... SET_SPINDLE_MODE(0 0.0000)
|
||||
13 N..... PROGRAM_END()
|
||||
14 N..... ON_RESET()
|
||||
58
tests/remap/variable-injection/remap.py
Normal file
58
tests/remap/variable-injection/remap.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# This is a component of LinuxCNC
|
||||
# Copyright 2011 Michael Haberler <git@mah.priv.at>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
from interpreter import *
|
||||
|
||||
|
||||
def prolog405(self, **words):
|
||||
self.params["foo405"] = 42
|
||||
return INTERP_OK
|
||||
|
||||
# rm405 will bump foo405 by 1
|
||||
|
||||
def epilog405(self, **words):
|
||||
if self.params["foo405"] != 43:
|
||||
self.set_errormsg("foo405 != 43 in epilog405")
|
||||
return INTERP_ERROR
|
||||
return INTERP_OK
|
||||
|
||||
|
||||
def prolog406(self, **words):
|
||||
self.params["foo406"] = 42
|
||||
return INTERP_OK
|
||||
|
||||
# rm406 will bump foo406 by 1
|
||||
|
||||
def epilog406(self, **words):
|
||||
if self.params["foo406"] != 43:
|
||||
self.set_errormsg("foo406 != 43 in epilog406")
|
||||
return INTERP_ERROR
|
||||
return INTERP_OK
|
||||
|
||||
|
||||
def prolog407(self, **words):
|
||||
self.params["foo407"] = 42
|
||||
return INTERP_OK
|
||||
|
||||
# rm407 will bump foo407 by 1
|
||||
|
||||
def epilog407(self, **words):
|
||||
if self.params["foo407"] != 43:
|
||||
self.set_errormsg("foo407 != 43 in epilog407")
|
||||
return INTERP_ERROR
|
||||
return INTERP_OK
|
||||
|
||||
9
tests/remap/variable-injection/rm405.ngc
Normal file
9
tests/remap/variable-injection/rm405.ngc
Normal file
@@ -0,0 +1,9 @@
|
||||
o<rm405> sub
|
||||
o100 if [#<foo405> NE 42]
|
||||
(abort,rm405: foo405=#<foo405>)
|
||||
o100 endif
|
||||
; bump by 1 and check in epilog whether change is visible
|
||||
#<foo405> = [#<foo405> + 1]
|
||||
o<rm405> endsub
|
||||
m2
|
||||
%
|
||||
14
tests/remap/variable-injection/rm406.ngc
Normal file
14
tests/remap/variable-injection/rm406.ngc
Normal file
@@ -0,0 +1,14 @@
|
||||
o<rm406> sub
|
||||
|
||||
o50 if [EXISTS[#<foo405>]]
|
||||
(abort,WHOA! foo405 visible in rm406: foo405=#<foo405>)
|
||||
o50 endif
|
||||
|
||||
o100 if [#<foo406> NE 42]
|
||||
(abort,rm406: foo406=#<foo406>)
|
||||
o100 endif
|
||||
; bump by 1 and check in epilog whether change is visible
|
||||
#<foo406> = [#<foo406> + 1]
|
||||
o<rm406> endsub
|
||||
m2
|
||||
%
|
||||
18
tests/remap/variable-injection/rm407.ngc
Normal file
18
tests/remap/variable-injection/rm407.ngc
Normal file
@@ -0,0 +1,18 @@
|
||||
o<rm407> sub
|
||||
|
||||
o50 if [EXISTS[#<foo405>]]
|
||||
(abort,WHOA! foo405 visible in rm407: foo405=#<foo405>)
|
||||
o50 endif
|
||||
|
||||
o70 if [EXISTS[#<foo406>]]
|
||||
(abort,WHOA! foo406 visible in rm407: foo406=#<foo406>)
|
||||
o70 endif
|
||||
|
||||
o100 if [#<foo407> NE 42]
|
||||
(abort,rm407: foo407=#<foo407>)
|
||||
o100 endif
|
||||
; bump by 1 and check in epilog whether change is visible
|
||||
#<foo407> = [#<foo407> + 1]
|
||||
o<rm407> endsub
|
||||
m2
|
||||
%
|
||||
21
tests/remap/variable-injection/subs.py
Normal file
21
tests/remap/variable-injection/subs.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# This is a component of LinuxCNC
|
||||
# Copyright 2011 Michael Haberler <git@mah.priv.at>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
import remap
|
||||
|
||||
|
||||
|
||||
17
tests/remap/variable-injection/test.ini
Normal file
17
tests/remap/variable-injection/test.ini
Normal file
@@ -0,0 +1,17 @@
|
||||
[EMC]
|
||||
DEBUG=0
|
||||
LOG_LEVEL=0
|
||||
|
||||
[PYTHON]
|
||||
PATH_PREPEND=.
|
||||
TOPLEVEL=subs.py
|
||||
LOG_LEVEL=0
|
||||
|
||||
[RS274NGC]
|
||||
SUBROUTINE_PATH = .
|
||||
|
||||
REMAP=M405 modalgroup=5 prolog=prolog405 ngc=rm405 epilog=epilog405
|
||||
REMAP=M406 modalgroup=6 prolog=prolog406 ngc=rm406 epilog=epilog406
|
||||
REMAP=M407 modalgroup=7 prolog=prolog407 ngc=rm407 epilog=epilog407
|
||||
|
||||
|
||||
6
tests/remap/variable-injection/test.ngc
Normal file
6
tests/remap/variable-injection/test.ngc
Normal file
@@ -0,0 +1,6 @@
|
||||
m405
|
||||
m406
|
||||
m407
|
||||
m405 m406 m407
|
||||
|
||||
m2
|
||||
2
tests/remap/variable-injection/test.sh
Executable file
2
tests/remap/variable-injection/test.sh
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
exec rs274 -i test.ini -g test.ngc 2>&1
|
||||
Reference in New Issue
Block a user