summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2020-09-25 11:22:34 +1000
committerChris Johns <chrisj@rtems.org>2020-09-26 10:49:27 +1000
commit87262b429d633420402e735a770f6d6cfedecf9a (patch)
tree6c9ee3464198f2d307b127d41060657565d2d34b
parent9fcc20789367ef476eb9ffbc6e2f9fabf686e10f (diff)
downloadrtems-tools-87262b429d633420402e735a770f6d6cfedecf9a.tar.bz2
Move all python commands to use env python
- If you host does not provide a python command consult the User manual for ways you can run the python commands. - Full package paths are being used to avoid namespace pollution and crosstalk.
-rw-r--r--[-rwxr-xr-x]misc/__init__.py (renamed from tester/rt/cmd-run.py)18
-rwxr-xr-xmisc/rtems-boot-image31
-rwxr-xr-xmisc/rtems-tftp-proxy31
-rw-r--r--[-rwxr-xr-x]misc/tools/__init__.py (renamed from misc/tools/cmd-boot-image.py)18
-rw-r--r--misc/tools/boot.py2
-rwxr-xr-xmisc/tools/cmd-tftpproxy.py44
-rw-r--r--misc/tools/tftpproxy.py6
-rw-r--r--misc/wscript8
-rwxr-xr-xrtemstoolkit/rtems.py9
-rw-r--r--[-rwxr-xr-x]tester/__init__.py (renamed from tester/rt/cmd-bsp-builder.py)19
-rwxr-xr-xtester/rt/cmd-test.py45
-rw-r--r--tester/rt/config.py30
-rw-r--r--tester/rt/console.py8
-rw-r--r--tester/rt/coverage.py2
-rw-r--r--tester/rt/gdb.py14
-rw-r--r--tester/rt/run.py30
-rw-r--r--tester/rt/test.py50
-rw-r--r--tester/rt/tftp.py14
-rwxr-xr-xtester/rtems-bsp-builder31
-rwxr-xr-xtester/rtems-run31
-rwxr-xr-xtester/rtems-test31
-rwxr-xr-xtester/rtems-tftp-server12
-rw-r--r--tester/wscript8
23 files changed, 182 insertions, 310 deletions
diff --git a/tester/rt/cmd-run.py b/misc/__init__.py
index 221c3f8..6ff279c 100755..100644
--- a/tester/rt/cmd-run.py
+++ b/misc/__init__.py
@@ -1,6 +1,5 @@
-#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2017 Chris Johns (chrisj@rtems.org)
+# Copyright 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,17 +27,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-from __future__ import print_function
-
-import sys, os
-
-base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-rtems = os.path.dirname(base)
-sys.path = [rtems] + sys.path
-
-try:
- import run
- run.run(sys.argv[1:], command_path = base)
-except ImportError:
- print("Incorrect RTEMS Tools installation", file = sys.stderr)
- sys.exit(1)
+all = []
diff --git a/misc/rtems-boot-image b/misc/rtems-boot-image
index aa23b2e..7f7ac0d 100755
--- a/misc/rtems-boot-image
+++ b/misc/rtems-boot-image
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chrisj@rtems.org)
+# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-set -e
-base=$(dirname $(dirname $0))
-cmd=misc/tools/cmd-boot-image.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/${cmd}
- . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/share/rtems/${cmd}
- . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, please report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+ import misc.tools.boot
+ misc.tools.boot.run()
+except ImportError:
+ print("Incorrect RTEMS Tools installation", file = sys.stderr)
+ sys.exit(1)
diff --git a/misc/rtems-tftp-proxy b/misc/rtems-tftp-proxy
index 213311d..2125662 100755
--- a/misc/rtems-tftp-proxy
+++ b/misc/rtems-tftp-proxy
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chrisj@rtems.org)
+# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-set -e
-base=$(dirname $(dirname $0))
-cmd=misc/tools/cmd-tftpproxy.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/${cmd}
- . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/share/rtems/${cmd}
- . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, please report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+ import misc.tools.tftpproxy
+ misc.tools.tftpproxy.run(sys.argv)
+except ImportError:
+ print("Incorrect RTEMS Tools installation", file = sys.stderr)
+ sys.exit(1)
diff --git a/misc/tools/cmd-boot-image.py b/misc/tools/__init__.py
index f17a91e..6ad687a 100755..100644
--- a/misc/tools/cmd-boot-image.py
+++ b/misc/tools/__init__.py
@@ -1,6 +1,5 @@
-#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chrisj@rtems.org)
+# Copyright 2013-2014 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,17 +27,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-from __future__ import print_function
-
-import sys, os
-
-base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-rtems = os.path.dirname(base)
-sys.path = [rtems] + sys.path
-
-try:
- import boot
- boot.run(sys.argv[1:], command_path = base)
-except ImportError:
- print("Incorrect RTEMS Tools installation", file = sys.stderr)
- sys.exit(1)
+all = ['boot']
diff --git a/misc/tools/boot.py b/misc/tools/boot.py
index 265d1b3..6e8065a 100644
--- a/misc/tools/boot.py
+++ b/misc/tools/boot.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chrisj@rtems.org)
+# Copyright 2019, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
diff --git a/misc/tools/cmd-tftpproxy.py b/misc/tools/cmd-tftpproxy.py
deleted file mode 100755
index 9f66a76..0000000
--- a/misc/tools/cmd-tftpproxy.py
+++ /dev/null
@@ -1,44 +0,0 @@
-#
-# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chrisj@rtems.org)
-# All rights reserved.
-#
-# This file is part of the RTEMS Tools package in 'rtems-tools'.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-from __future__ import print_function
-
-import sys, os
-
-base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-rtems = os.path.dirname(base)
-sys.path = [rtems] + sys.path
-
-try:
- import tftpproxy
- tftpproxy.run(sys.argv[1:], command_path = base)
-except ImportError:
- print("Incorrect RTEMS Tools installation", file = sys.stderr)
- sys.exit(1)
diff --git a/misc/tools/tftpproxy.py b/misc/tools/tftpproxy.py
index a815584..c0aebb0 100644
--- a/misc/tools/tftpproxy.py
+++ b/misc/tools/tftpproxy.py
@@ -1,5 +1,5 @@
#
-# Copyright 2019 Chris Johns (chris@contemporary.software)
+# Copyright 2019, 2020 Chris Johns (chris@contemporary.software)
# All rights reserved.
#
# Permission to use, copy, modify, and/or distribute this software for any
@@ -39,7 +39,7 @@ from rtemstoolkit import error
from rtemstoolkit import log
from rtemstoolkit import version
-import getmac
+import misc.tools.getmac
def host_port_split(ip_port):
ips = ip_port.split(':')
@@ -226,7 +226,7 @@ class udp_handler(socketserver.BaseRequestHandler):
client,
host))
else:
- mac = getmac.get_mac_address(ip = client_ip)
+ mac = misc.tools.getmac.get_mac_address(ip = client_ip)
log.trace(' . request: host not found: %s (%s)' % (client, mac))
class udp_server(socketserver.ThreadingMixIn, socketserver.UDPServer):
diff --git a/misc/wscript b/misc/wscript
index b3faf7b..521eddf 100644
--- a/misc/wscript
+++ b/misc/wscript
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2014-2016 Chris Johns (chrisj@rtems.org)
+# Copyright 2014, 2020 Chris Johns (chrisj@rtems.org)
# Copyright 2018 embedded brains GmbH
# All rights reserved.
#
@@ -74,9 +74,9 @@ def build(bld):
# Install the boot image code.
#
bld(features = 'py',
- source = ['tools/boot.py',
- 'tools/cmd-boot-image.py',
- 'tools/cmd-tftpproxy.py',
+ source = ['__init__.py',
+ 'tools/__init__.py',
+ 'tools/boot.py',
'tools/tftpproxy.py',
'tools/getmac/__init__.py',
'tools/getmac/getmac.py'],
diff --git a/rtemstoolkit/rtems.py b/rtemstoolkit/rtems.py
index 30c8c16..c7dcd9c 100755
--- a/rtemstoolkit/rtems.py
+++ b/rtemstoolkit/rtems.py
@@ -71,10 +71,7 @@ def configuration_path(prog = None):
2. Ok to directly call os.path.
'''
if prog is None:
- if len(sys.argv) == 1:
- exec_name = sys.argv[0]
- else:
- exec_name = sys.argv[1]
+ exec_name = sys.argv[0]
else:
exec_name = prog
exec_name = os.path.abspath(exec_name)
@@ -157,8 +154,10 @@ class configuration:
for arch in profile['archs']:
bsps = 'bsps_%s' % (arch)
profile[bsps] = self.config.comma_list(profile['name'], bsps)
- self.profiles[profile['name']] = profile
+ self.profiles[profile['name']] = dict(profile)
+ profile = None
invalid_chars = re.compile(r'[^a-zA-Z0-9_-]')
+ archs = sorted(list(set(archs)))
for a in set(archs):
if len(invalid_chars.findall(a)) != 0:
raise error.general('invalid character(s) in arch name: %s' % (a))
diff --git a/tester/rt/cmd-bsp-builder.py b/tester/__init__.py
index c94aeaf..6ff279c 100755..100644
--- a/tester/rt/cmd-bsp-builder.py
+++ b/tester/__init__.py
@@ -1,7 +1,5 @@
-#! /usr/bin/env python
-#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2016 Chris Johns (chrisj@rtems.org)
+# Copyright 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -29,17 +27,4 @@
# POSSIBILITY OF SUCH DAMAGE.
#
-from __future__ import print_function
-
-import sys, os
-
-base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-rtems = os.path.dirname(base)
-sys.path = [rtems] + sys.path
-
-try:
- import check
- check.run(sys.argv[1:])
-except ImportError:
- print("Incorrect RTEMS Tools installation", file = sys.stderr)
- sys.exit(1)
+all = []
diff --git a/tester/rt/cmd-test.py b/tester/rt/cmd-test.py
deleted file mode 100755
index 93e480f..0000000
--- a/tester/rt/cmd-test.py
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /usr/bin/env python
-#
-# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013, 2015 Chris Johns (chrisj@rtems.org)
-# All rights reserved.
-#
-# This file is part of the RTEMS Tools package in 'rtems-tools'.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are met:
-#
-# 1. Redistributions of source code must retain the above copyright notice,
-# this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright notice,
-# this list of conditions and the following disclaimer in the documentation
-# and/or other materials provided with the distribution.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-from __future__ import print_function
-
-import sys, os
-
-base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-rtems = os.path.dirname(base)
-sys.path = [rtems] + sys.path
-
-try:
- import test
- test.run(sys.argv[1:], command_path = base)
-except ImportError:
- print("Incorrect RTEMS Tools installation", file = sys.stderr)
- sys.exit(1)
diff --git a/tester/rt/config.py b/tester/rt/config.py
index bc9263a..2c36e14 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -48,10 +48,10 @@ from rtemstoolkit import path
from rtemstoolkit import stacktraces
-import console
-import exe
-import gdb
-import tftp
+import tester.rt.console
+import tester.rt.exe
+import tester.rt.gdb
+import tester.rt.tftp
timeout = 15
@@ -212,7 +212,7 @@ class file(config.file):
console_trace = trace = self.exe_trace('console')
if not self.opts.dry_run():
if data[0] == 'stdio':
- self.console = console.stdio(trace = console_trace)
+ self.console = tester.rt.console.stdio(trace = console_trace)
elif data[0] == 'tty':
if len(data) < 2 or len(data) >3:
raise error.general(self._name_line_msg('no tty configuration provided'))
@@ -220,15 +220,15 @@ class file(config.file):
settings = data[2]
else:
settings = None
- self.console = console.tty(data[1],
- output = self.capture,
- setup = settings,
- trace = console_trace)
+ self.console = tester.rt.console.tty(data[1],
+ output = self.capture,
+ setup = settings,
+ trace = console_trace)
else:
raise error.general(self._name_line_msg('invalid console type'))
def _dir_execute(self, data, total, index, rexe, bsp_arch, bsp):
- self.process = exe.exe(bsp_arch, bsp, trace = self.exe_trace('exe'))
+ self.process = tester.rt.exe.exe(bsp_arch, bsp, trace = self.exe_trace('exe'))
if not self.in_error:
if self.console:
self.console.open()
@@ -247,9 +247,9 @@ class file(config.file):
def _dir_gdb(self, data, total, index, exe, bsp_arch, bsp):
if len(data) < 3 or len(data) > 4:
raise error.general('invalid %gdb arguments')
- self.process = gdb.gdb(bsp_arch, bsp,
- trace = self.exe_trace('gdb'),
- mi_trace = self.exe_trace('gdb-mi'))
+ self.process = tester.rt.gdb.gdb(bsp_arch, bsp,
+ trace = self.exe_trace('gdb'),
+ mi_trace = self.exe_trace('gdb-mi'))
script = self.expand('%%{%s}' % data[2])
if script:
script = [l.strip() for l in script.splitlines()]
@@ -277,8 +277,8 @@ class file(config.file):
raise error.general('invalid %tftp port')
self.kill_on_end = True
if not self.opts.dry_run():
- self.process = tftp.tftp(bsp_arch, bsp,
- trace = self.exe_trace('tftp'))
+ self.process = tester.rt.tftp.tftp(bsp_arch, bsp,
+ trace = self.exe_trace('tftp'))
if not self.in_error:
if self.console:
self.console.open()
diff --git a/tester/rt/console.py b/tester/rt/console.py
index ef35a0e..7e09bb9 100644
--- a/tester/rt/console.py
+++ b/tester/rt/console.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2014 Chris Johns (chrisj@rtems.org)
+# Copyright 2013-2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -41,13 +41,13 @@ import time
from rtemstoolkit import path
-import telnet
+import tester.rt.telnet
#
# Not available on Windows. Not sure what this means.
#
if os.name != 'nt':
- import stty
+ import tester.rt.stty as stty
else:
stty = None
@@ -127,7 +127,7 @@ class tty(console):
if stty and path.exists(self.dev):
self.tty = stty.tty(self.dev)
else:
- self.tty = telnet.tty(self.dev)
+ self.tty = tester.rt.telnet.tty(self.dev)
self.tty.set(self.setup)
self.tty.on()
self.read_thread = threading.Thread(target = _readthread,
diff --git a/tester/rt/coverage.py b/tester/rt/coverage.py
index 31e2cd7..0f225a9 100644
--- a/tester/rt/coverage.py
+++ b/tester/rt/coverage.py
@@ -48,8 +48,6 @@ from rtemstoolkit import macros
from rtemstoolkit import version
-import options
-
class summary:
def __init__(self, p_summary_dir):
self.summary_file_path = path.join(p_summary_dir, 'summary.txt')
diff --git a/tester/rt/gdb.py b/tester/rt/gdb.py
index d0cf504..4abbca5 100644
--- a/tester/rt/gdb.py
+++ b/tester/rt/gdb.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013,2014,2020 Chris Johns (chrisj@rtems.org)
+# Copyright 2013, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -50,14 +50,13 @@ from rtemstoolkit import execute
from rtemstoolkit import options
from rtemstoolkit import path
-import console
-import pygdb
+import tester.rt.pygdb
class gdb(object):
'''RTEMS Testing GDB base.'''
def __init__(self, bsp_arch, bsp, trace = False, mi_trace = False):
- self.session = pygdb.mi_parser.session()
+ self.session = tester.rt.pygdb.mi_parser.session()
self.trace = trace
self.mi_trace = mi_trace
self.lock_trace = False
@@ -356,7 +355,8 @@ class gdb(object):
self.output(line)
if __name__ == "__main__":
- stdtty = console.save()
+ import tester.rt.console
+ stdtty = tester.rt.console.save()
try:
def output(text):
print(']', text)
@@ -376,7 +376,7 @@ if __name__ == "__main__":
g = gdb('sparc', 'sis', mi_trace = True)
g.open('sparc-rtems4.11-gdb', executable, output, gdb_console, script)
except:
- console.restore(stdtty)
+ tester.rt.console.restore(stdtty)
raise
finally:
- console.restore(stdtty)
+ tester.rt.console.restore(stdtty)
diff --git a/tester/rt/run.py b/tester/rt/run.py
index ff95091..ea32a23 100644
--- a/tester/rt/run.py
+++ b/tester/rt/run.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2017 Chris Johns (chrisj@rtems.org)
+# Copyright 2013, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -42,11 +42,11 @@ from rtemstoolkit import path
from rtemstoolkit import stacktraces
from rtemstoolkit import version
-import bsps
-import config
-import console
-import options
-import report
+import tester.rt.bsps
+import tester.rt.config
+import tester.rt.console
+import tester.rt.options
+import tester.rt.report
class test(object):
def __init__(self, index, total, report, executable, rtems_tools, bsp, bsp_config, opts):
@@ -68,7 +68,7 @@ class test(object):
if not path.isdir(rtems_tools_bin):
raise error.general('cannot find RTEMS tools path: %s' % (rtems_tools_bin))
self.opts.defaults['rtems_tools'] = rtems_tools_bin
- self.config = config.file(index, total, self.report, self.bsp_config, self.opts, '')
+ self.config = tester.rt.config.file(index, total, self.report, self.bsp_config, self.opts, '')
def run(self):
if self.config:
@@ -94,9 +94,9 @@ def list_bsps(opts):
log.notice(' %s' % (path.basename(bsp[:-3])))
raise error.exit()
-def run(args, command_path = None):
+def run(args):
tests = []
- stdtty = console.save()
+ stdtty = tester.rt.console.save()
opts = None
default_exefilter = '*.exe'
try:
@@ -106,12 +106,10 @@ def run(args, command_path = None):
'--list-bsps': 'List the supported BSPs',
'--debug-trace': 'Debug trace based on specific flags',
'--stacktrace': 'Dump a stack trace on a user termination (^C)' }
- opts = options.load(args,
- optargs = optargs,
- command_path = command_path)
+ opts = tester.rt.options.load(args, optargs = optargs)
log.notice('RTEMS Testing - Run, %s' % (version.string()))
if opts.find_arg('--list-bsps'):
- bsps.list(opts)
+ tester.rt.bsps.list(opts)
opts.log_info()
log.output('Host: ' + host.label(mode = 'all'))
debug_trace = opts.find_arg('--debug-trace')
@@ -133,13 +131,13 @@ def run(args, command_path = None):
bsp = opts.find_arg('--rtems-bsp')
if bsp is None or len(bsp) != 2:
raise error.general('RTEMS BSP not provided or an invalid option')
- bsp = config.load(bsp[1], opts)
+ bsp = tester.rt.config.load(bsp[1], opts)
bsp_config = opts.defaults.expand(opts.defaults['tester'])
executables = find_executables(opts.params())
if len(executables) != 1:
raise error.general('one executable required, found %d' % (len(executables)))
opts.defaults['test_disable_header'] = '1'
- reports = report.report(1)
+ reports = tester.rt.report.report(1)
start_time = datetime.datetime.now()
opts.defaults['exe_trace'] = debug_trace
tst = test(1, 1, reports, executables[0], rtems_tools, bsp, bsp_config, opts)
@@ -165,7 +163,7 @@ def run(args, command_path = None):
log.notice('abort: user terminated')
sys.exit(1)
finally:
- console.restore(stdtty)
+ tester.rt.console.restore(stdtty)
sys.exit(0)
if __name__ == "__main__":
diff --git a/tester/rt/test.py b/tester/rt/test.py
index 3ecadf9..fa9ddf5 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2018 Chris Johns (chrisj@rtems.org)
+# Copyright 2013, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -50,12 +50,12 @@ from rtemstoolkit import stacktraces
from rtemstoolkit import version
from rtemstoolkit import check
-import bsps
-import config
-import console
-import options
-import report
-import coverage
+import tester.rt.bsps
+import tester.rt.config
+import tester.rt.console
+import tester.rt.options
+import tester.rt.report
+import tester.rt.coverage
class log_capture(object):
def __init__(self):
@@ -108,7 +108,7 @@ class test(object):
if not path.isdir(rtems_tools_bin):
raise error.general('cannot find RTEMS tools path: %s' % (rtems_tools_bin))
self.opts.defaults['rtems_tools'] = rtems_tools_bin
- self.config = config.file(index, total, self.report, self.bsp_config, self.opts)
+ self.config = tester.rt.config.file(index, total, self.report, self.bsp_config, self.opts)
def run(self):
if self.config:
@@ -351,10 +351,10 @@ def check_report_formats(report_formats, report_location):
% report_format)
-def run(args, command_path = None):
+def run(args):
import sys
tests = []
- stdtty = console.save()
+ stdtty = tester.rt.console.save()
opts = None
default_exefilter = '*.exe'
try:
@@ -371,9 +371,7 @@ def run(args, command_path = None):
'--stacktrace': 'Dump a stack trace on a user termination (^C)',
'--coverage': 'Perform coverage analysis of test executables.'}
mailer.append_options(optargs)
- opts = options.load(args,
- optargs = optargs,
- command_path = command_path)
+ opts = tester.rt.options.load(args, optargs = optargs)
mail = None
output = None
if opts.find_arg('--mail'):
@@ -401,7 +399,7 @@ def run(args, command_path = None):
report_formats = []
log.notice('RTEMS Testing - Tester, %s' % (version.string()))
if opts.find_arg('--list-bsps'):
- bsps.list(opts)
+ tester.rt.bsps.list(opts)
exe_filter = opts.find_arg('--filter')
if exe_filter:
exe_filter = exe_filter[1]
@@ -430,22 +428,22 @@ def run(args, command_path = None):
bsp = opts.find_arg('--rtems-bsp')
if bsp is None or len(bsp) != 2:
raise error.general('RTEMS BSP not provided or an invalid option')
- bsp = config.load(bsp[1], opts)
+ bsp = tester.rt.config.load(bsp[1], opts)
bsp_config = opts.defaults.expand(opts.defaults['tester'])
coverage_enabled = opts.find_arg('--coverage')
if coverage_enabled:
cov_trace = 'cov' in debug_trace.split(',')
if len(coverage_enabled) == 2:
- coverage_runner = coverage.coverage_run(opts.defaults,
- executables,
- rtems_tools,
- symbol_set = coverage_enabled[1],
- trace = cov_trace)
+ coverage_runner = tester.rt.coverage.coverage_run(opts.defaults,
+ executables,
+ rtems_tools,
+ symbol_set = coverage_enabled[1],
+ trace = cov_trace)
else:
- coverage_runner = coverage.coverage_run(opts.defaults,
- executables,
- rtems_tools,
- trace = cov_trace)
+ coverage_runner = tester.rt.coverage.coverage_run(opts.defaults,
+ executables,
+ rtems_tools,
+ trace = cov_trace)
log_mode = opts.find_arg('--log-mode')
if log_mode:
if log_mode[1] != 'failures' and \
@@ -459,7 +457,7 @@ def run(args, command_path = None):
raise error.general('no executables supplied')
start_time = datetime.datetime.now()
total = len(executables)
- reports = report.report(total)
+ reports = tester.rt.report.report(total)
reporting = 1
jobs = int(opts.jobs(opts.defaults['_ncpus']))
exe = 0
@@ -556,7 +554,7 @@ def run(args, command_path = None):
killall(tests)
sys.exit(1)
finally:
- console.restore(stdtty)
+ tester.rt.console.restore(stdtty)
sys.exit(0)
if __name__ == "__main__":
diff --git a/tester/rt/tftp.py b/tester/rt/tftp.py
index 7829e8f..af5029a 100644
--- a/tester/rt/tftp.py
+++ b/tester/rt/tftp.py
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2017 Chris Johns (chrisj@rtems.org)
+# Copyright 2013, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -43,7 +43,7 @@ import sys
from rtemstoolkit import error
from rtemstoolkit import reraise
-import tftpserver
+import tester.rt.tftpserver
class tftp(object):
'''RTEMS Testing TFTP base.'''
@@ -138,11 +138,11 @@ class tftp(object):
exe = self.exe
self.exe = None
self._unlock('_listener')
- self.server = tftpserver.tftp_server(host = 'all',
- port = self.port,
- timeout = 1,
- forced_file = exe,
- sessions = 1)
+ self.server = tester.rt.tftpserver.tftp_server(host = 'all',
+ port = self.port,
+ timeout = 1,
+ forced_file = exe,
+ sessions = 1)
try:
self.server.start()
self.server.run()
diff --git a/tester/rtems-bsp-builder b/tester/rtems-bsp-builder
index 4901ff0..4f47ea6 100755
--- a/tester/rtems-bsp-builder
+++ b/tester/rtems-bsp-builder
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2018 Chris Johns (chrisj@rtems.org)
+# Copyright 2016, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-set -e
-base=$(dirname $(dirname $0))
-cmd=tester/rt/cmd-bsp-builder.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/${cmd}
- . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/share/rtems/${cmd}
- . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, plrease report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+ import tester.rt.check
+ tester.rt.check.run(sys.argv)
+except ImportError:
+ print("Incorrect RTEMS Tools installation", file = sys.stderr)
+ sys.exit(1)
diff --git a/tester/rtems-run b/tester/rtems-run
index cf5f263..8c8b87d 100755
--- a/tester/rtems-run
+++ b/tester/rtems-run
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2018 Chris Johns (chrisj@rtems.org)
+# Copyright 2017, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-set -e
-base=$(dirname $(dirname $0))
-cmd=tester/rt/cmd-run.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/${cmd}
- . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/share/rtems/${cmd}
- . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, plrease report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+ import tester.rt.run
+ tester.rt.run.run(sys.argv)
+except ImportError:
+ print("Incorrect RTEMS Tools installation", file = sys.stderr)
+ sys.exit(1)
diff --git a/tester/rtems-test b/tester/rtems-test
index 520366a..ed7e0fb 100755
--- a/tester/rtems-test
+++ b/tester/rtems-test
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2018 Chris Johns (chrisj@rtems.org)
+# Copyright 2013, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
-set -e
-base=$(dirname $(dirname $0))
-cmd=tester/rt/cmd-test.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/${cmd}
- . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
- PYTHON_CMD=${base}/share/rtems/${cmd}
- . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, please report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+ import tester.rt.test
+ tester.rt.test.run(sys.argv)
+except ImportError:
+ print("Incorrect RTEMS Tools installation", file = sys.stderr)
+ sys.exit(1)
diff --git a/tester/rtems-tftp-server b/tester/rtems-tftp-server
index a3764ff..b255121 100755
--- a/tester/rtems-tftp-server
+++ b/tester/rtems-tftp-server
@@ -33,15 +33,13 @@ from __future__ import print_function
import os
import sys
-base = os.path.dirname(os.path.abspath(sys.argv[0]))
-prefix = os.path.dirname(base)
-rtems = os.path.join(prefix, 'share', 'rtems')
-tester = os.path.join(rtems, 'tester')
-sys.path = [prefix, rtems, tester] + sys.path
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
try:
- import rt.tftpserver
- rt.tftpserver.run(sys.argv)
+ import tester.rt.tftpserver
+ tester.rt.tftpserver.run(sys.argv)
except ImportError:
print("Incorrect RTEMS Tools installation", file=sys.stderr)
sys.exit(1)
diff --git a/tester/wscript b/tester/wscript
index ad1cf2d..674c4fb 100644
--- a/tester/wscript
+++ b/tester/wscript
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2016 Chris Johns (chrisj@rtems.org)
+# Copyright 2013, 2020 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -51,12 +51,10 @@ def build(bld):
# Install the tester code.
#
bld(features = 'py',
- source = ['rt/__init__.py',
+ source = ['__init__.py',
+ 'rt/__init__.py',
'rt/bsps.py',
'rt/check.py',
- 'rt/cmd-bsp-builder.py',
- 'rt/cmd-run.py',
- 'rt/cmd-test.py',
'rt/config.py',
'rt/console.py',
'rt/coverage.py',