summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2015-02-08 17:12:04 +1100
committerChris Johns <chrisj@rtems.org>2015-02-08 17:12:04 +1100
commitb7d48ef5a4a09010305a5981f64005161a34409d (patch)
treed67a781bd460bfc367d1e038ed9f3a8d870884fd
parentRemove warning on Linux. (diff)
downloadrtems-tools-b7d48ef5a4a09010305a5981f64005161a34409d.tar.bz2
Install the rtems-test command.
This installs the Python RTEMS Toolkit. The copmiler has been switched from forcing gcc to allowing waf to detect the host's tool chain.
-rw-r--r--linkers/wscript8
-rw-r--r--rtemstoolkit/macros.py25
-rw-r--r--rtemstoolkit/wscript31
-rw-r--r--tester/rt/options.py23
-rw-r--r--tester/rt/test.py2
-rwxr-xr-xtester/rtems-test3
-rw-r--r--tester/rtems/testing/defaults.mc1
-rw-r--r--tester/wscript45
-rw-r--r--tools/gdb/python/wscript8
9 files changed, 119 insertions, 27 deletions
diff --git a/linkers/wscript b/linkers/wscript
index d48ce47..b1a99c6 100644
--- a/linkers/wscript
+++ b/linkers/wscript
@@ -8,12 +8,12 @@ version_minor = 0
version_revision = 0
def options(opt):
- opt.load("g++")
- opt.load("gcc")
+ opt.load('compiler_c')
+ opt.load('compiler_cxx')
def configure(conf):
- conf.load("g++")
- conf.load("gcc")
+ conf.load('compiler_c')
+ conf.load('compiler_cxx')
conf.env.C_OPTS = conf.options.c_opts.split(',')
conf.env.RTEMS_VERSION = conf.options.rtems_version
diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
index d8c3175..8db0729 100644
--- a/rtemstoolkit/macros.py
+++ b/rtemstoolkit/macros.py
@@ -33,6 +33,7 @@
#
import copy
+import inspect
import re
import os
import string
@@ -71,11 +72,21 @@ class macros:
self.read_maps = []
self.read_map_locked = False
self.write_map = 'global'
+ self.rtpath = path.abspath(path.dirname(inspect.getfile(macros)))
+ if path.dirname(self.rtpath).endswith('/share/rtems'):
+ self.prefix = path.dirname(self.rtpath)[:-len('/share/rtems')]
+ else:
+ self.prefix = '.'
self.macros['global'] = {}
self.macros['global']['nil'] = ('none', 'none', '')
- self.macros['global']['_cwd'] = ('dir', 'required', path.abspath(os.getcwd()))
- self.macros['global']['_rtdir'] = ('dir', 'required', path.abspath(rtdir))
- self.macros['global']['_rttop'] = ('dir', 'required', path.abspath(path.dirname(rtdir)))
+ self.macros['global']['_cwd'] = ('dir',
+ 'required',
+ path.abspath(os.getcwd()))
+ self.macros['global']['_prefix'] = ('dir', 'required', self.prefix)
+ self.macros['global']['_rtdir'] = ('dir',
+ 'required',
+ path.abspath(self.expand(rtdir)))
+ self.macros['global']['_rttop'] = ('dir', 'required', self.prefix)
else:
self.macros = {}
for m in original.macros:
@@ -419,14 +430,19 @@ class macros:
def expand(self, _str):
"""Simple basic expander of config file macros."""
+ start_str = _str
expanded = True
+ count = 0
while expanded:
+ count += 1
+ if count > 1000:
+ raise error.general('expansion looped over 1000 times "%s"' %
+ (start_str))
expanded = False
for m in self.macro_filter.findall(_str):
name = m[2:-1]
macro = self.get(name)
if macro is None:
- print self.macros
raise error.general('cannot expand default macro: %s in "%s"' %
(m, _str))
_str = _str.replace(m, macro[2])
@@ -474,6 +490,7 @@ class macros:
if __name__ == "__main__":
import copy
import sys
+ print inspect.getfile(macros)
m = macros(name = 'defaults.mc')
d = copy.copy(m)
m['test1'] = 'something'
diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index 07703a0..229deeb 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -14,12 +14,12 @@ top = '.'
out = 'build-' + sys.platform
def options(opt):
- opt.load("g++")
- opt.load("gcc")
+ opt.load('compiler_c')
+ opt.load('compiler_cxx')
def configure(conf):
- conf.load("g++")
- conf.load("gcc")
+ conf.load('compiler_c')
+ conf.load('compiler_cxx')
conf_libiberty(conf)
conf_libelf(conf)
@@ -100,6 +100,29 @@ def build(bld):
cxxflags = conf['cxxflags'] + conf['warningflags'],
linkflags = conf['linkflags'])
+ #
+ # The Python toolkit.
+ #
+ bld(features = 'py',
+ source = ['__init__.py',
+ 'check.py',
+ 'config.py',
+ 'darwin.py',
+ 'error.py',
+ 'execute.py',
+ 'freebsd.py',
+ 'git.py',
+ 'linux.py',
+ 'log.py',
+ 'macros.py',
+ 'mailer.py',
+ 'options.py',
+ 'path.py',
+ 'stacktraces.py',
+ 'version.py',
+ 'windows.py'],
+ install_path = '${PREFIX}/share/rtems/rtemstoolkit')
+
def rebuild(ctx):
import waflib.Options
waflib.Options.commands.extend(['clean', 'build'])
diff --git a/tester/rt/options.py b/tester/rt/options.py
index f637017..2190818 100644
--- a/tester/rt/options.py
+++ b/tester/rt/options.py
@@ -48,6 +48,11 @@ from rtemstoolkit import path
import version
+#
+# The path for the defaults.
+#
+defaults_mc = 'rtems/testing/defaults.mc'
+
class command_line(options.command_line):
"""Process the command line in a common way for all Tool Builder commands."""
@@ -71,7 +76,7 @@ class command_line(options.command_line):
def load(args, optargs = None,
command_path = None,
- defaults = '%{_rtdir}/rtems/testing/defaults.mc'):
+ defaults = '%s' % (defaults_mc)):
#
# The path to this command if not supplied by the upper layers.
#
@@ -80,20 +85,30 @@ def load(args, optargs = None,
if len(command_path) == 0:
command_path = '.'
#
+ # Check if there is a defaults.mc file under the command path. If so this is
+ # the tester being run from within the git repo. If not found assume the tools
+ # have been installed and the defaults is in the install prefix.
+ #
+ print path.join(command_path, defaults_mc)
+ if path.exists(path.join(command_path, defaults_mc)):
+ rtdir = command_path
+ else:
+ rtdir = '%{_prefix}/share/rtems/tester'
+ defaults = '%s/%s' % (rtdir, defaults_mc)
+ #
# The command line contains the base defaults object all build objects copy
# and modify by loading a configuration.
#
opts = command_line(args,
optargs,
- macros.macros(name = defaults,
- rtdir = command_path),
+ macros.macros(name = defaults, rtdir = rtdir),
command_path)
options.load(opts)
return opts
def run(args):
try:
- _opts = load(args = args, defaults = 'rtems/testing/defaults.mc')
+ _opts = load(args = args, defaults = defaults_mc)
log.notice('RTEMS Test - Defaults, v%s' % (version.str()))
_opts.log_info()
log.notice('Options:')
diff --git a/tester/rt/test.py b/tester/rt/test.py
index b1ae0cd..d9a04da 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -307,7 +307,7 @@ def run(command_path = None):
except error.exit, eerr:
sys.exit(2)
except KeyboardInterrupt:
- if opts.find_arg('--stacktrace'):
+ if opts is not None and opts.find_arg('--stacktrace'):
print '}} dumping:', threading.active_count()
for t in threading.enumerate():
print '}} ', t.name
diff --git a/tester/rtems-test b/tester/rtems-test
index 53c81cd..1684abc 100755
--- a/tester/rtems-test
+++ b/tester/rtems-test
@@ -32,7 +32,8 @@
import sys, os
base = os.path.dirname(os.path.abspath(sys.argv[0]))
parent = os.path.dirname(base)
-sys.path = [base, parent] + sys.path
+rtems = os.path.join(parent, 'share', 'rtems')
+sys.path = [base, parent, rtems] + sys.path
try:
import rt.test
diff --git a/tester/rtems/testing/defaults.mc b/tester/rtems/testing/defaults.mc
index bf220f3..bf3186c 100644
--- a/tester/rtems/testing/defaults.mc
+++ b/tester/rtems/testing/defaults.mc
@@ -75,7 +75,6 @@ _infodir: dir, none, '%{_datarootdir}/info'
_localedir: dir, none, '%{_datarootdir}/locale'
_localedir: dir, none, '%{_datadir}/locale'
_localstatedir: dir, none, '%{_prefix}/var'
-_prefix: dir, none, '%{_usr}'
_usr: dir, none, '/usr/local'
_usrsrc: dir, none, '%{_usr}/src'
_var: dir, none, '/usr/local/var'
diff --git a/tester/wscript b/tester/wscript
index 1c5139c..16030df 100644
--- a/tester/wscript
+++ b/tester/wscript
@@ -1,6 +1,6 @@
#
# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2014 Chris Johns (chrisj@rtems.org)
+# Copyright 2015 Chris Johns (chrisj@rtems.org)
# All rights reserved.
#
# This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -34,14 +34,49 @@ def recurse(ctx):
for sd in subdirs:
ctx.recurse(sd)
-def options(ctx):
- recurse(ctx)
+def options(opt):
+ recurse(opt)
+ opt.load('python')
def configure(ctx):
recurse(ctx)
+ conf.load('python')
+ conf.check_python_version((2,7,3))
-def build(ctx):
- recurse(ctx)
+def build(bld):
+ recurse(bld)
+
+ #
+ # Install the tester code.
+ #
+ bld(features = 'py',
+ source = ['rt/__init__.py',
+ 'rt/bsps.py',
+ 'rt/config.py',
+ 'rt/console.py',
+ 'rt/gdb.py',
+ 'rt/options.py',
+ 'rt/report.py',
+ 'rt/stty.py',
+ 'rt/test.py',
+ 'rt/version.py'],
+ install_path = '${PREFIX}/share/rtems/rt')
+ bld(features = 'py',
+ source = ['rt/pygdb/__init__.py',
+ 'rt/pygdb/mi_parser.py',
+ 'rt/pygdb/spark.py'],
+ install_path = '${PREFIX}/share/rtems/rt/pygdb')
+ bld.install_files('${PREFIX}/bin', ['rtems-test'], chmod = 0755)
+ bld.install_files('${PREFIX}/bin', ['rtems-test'], chmod = 0755)
+
+ #
+ # Install the tester configuration files.
+ #
+ config = bld.path.find_dir('rtems')
+ bld.install_files('${PREFIX}/share/rtems/tester/rtems',
+ config.ant_glob('**', excl=['*~']),
+ cwd = config,
+ relative_trick = True)
def install(ctx):
recurse(ctx)
diff --git a/tools/gdb/python/wscript b/tools/gdb/python/wscript
index 5c898c1..0cb5bb8 100644
--- a/tools/gdb/python/wscript
+++ b/tools/gdb/python/wscript
@@ -3,10 +3,11 @@
#
def options(opt):
- pass
+ opt.load('python')
def configure(conf):
conf.load('python')
+ conf.check_python_version((2,7,3))
def build(bld):
source = ['__init__.py',
@@ -26,5 +27,6 @@ def build(bld):
'supercore_printer.py',
'threads.py',
'watchdog.py']
- bld(features = 'py', source = source, install_path = None)
- bld.install_files('${PREFIX}/share/gdb/python/rtems', source)
+ bld(features = 'py',
+ source = source,
+ install_path = '${PREFIX}/share/gdb/python/rtems')