mirror of
https://git.rtems.org/rtems-tools/
synced 2025-10-16 13:06:09 +08:00
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.
This commit is contained in:
@@ -8,12 +8,12 @@ version_minor = 0
|
|||||||
version_revision = 0
|
version_revision = 0
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
opt.load("g++")
|
opt.load('compiler_c')
|
||||||
opt.load("gcc")
|
opt.load('compiler_cxx')
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
conf.load("g++")
|
conf.load('compiler_c')
|
||||||
conf.load("gcc")
|
conf.load('compiler_cxx')
|
||||||
|
|
||||||
conf.env.C_OPTS = conf.options.c_opts.split(',')
|
conf.env.C_OPTS = conf.options.c_opts.split(',')
|
||||||
conf.env.RTEMS_VERSION = conf.options.rtems_version
|
conf.env.RTEMS_VERSION = conf.options.rtems_version
|
||||||
|
@@ -33,6 +33,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
import inspect
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import string
|
import string
|
||||||
@@ -71,11 +72,21 @@ class macros:
|
|||||||
self.read_maps = []
|
self.read_maps = []
|
||||||
self.read_map_locked = False
|
self.read_map_locked = False
|
||||||
self.write_map = 'global'
|
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'] = {}
|
||||||
self.macros['global']['nil'] = ('none', 'none', '')
|
self.macros['global']['nil'] = ('none', 'none', '')
|
||||||
self.macros['global']['_cwd'] = ('dir', 'required', path.abspath(os.getcwd()))
|
self.macros['global']['_cwd'] = ('dir',
|
||||||
self.macros['global']['_rtdir'] = ('dir', 'required', path.abspath(rtdir))
|
'required',
|
||||||
self.macros['global']['_rttop'] = ('dir', 'required', path.abspath(path.dirname(rtdir)))
|
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:
|
else:
|
||||||
self.macros = {}
|
self.macros = {}
|
||||||
for m in original.macros:
|
for m in original.macros:
|
||||||
@@ -419,14 +430,19 @@ class macros:
|
|||||||
|
|
||||||
def expand(self, _str):
|
def expand(self, _str):
|
||||||
"""Simple basic expander of config file macros."""
|
"""Simple basic expander of config file macros."""
|
||||||
|
start_str = _str
|
||||||
expanded = True
|
expanded = True
|
||||||
|
count = 0
|
||||||
while expanded:
|
while expanded:
|
||||||
|
count += 1
|
||||||
|
if count > 1000:
|
||||||
|
raise error.general('expansion looped over 1000 times "%s"' %
|
||||||
|
(start_str))
|
||||||
expanded = False
|
expanded = False
|
||||||
for m in self.macro_filter.findall(_str):
|
for m in self.macro_filter.findall(_str):
|
||||||
name = m[2:-1]
|
name = m[2:-1]
|
||||||
macro = self.get(name)
|
macro = self.get(name)
|
||||||
if macro is None:
|
if macro is None:
|
||||||
print self.macros
|
|
||||||
raise error.general('cannot expand default macro: %s in "%s"' %
|
raise error.general('cannot expand default macro: %s in "%s"' %
|
||||||
(m, _str))
|
(m, _str))
|
||||||
_str = _str.replace(m, macro[2])
|
_str = _str.replace(m, macro[2])
|
||||||
@@ -474,6 +490,7 @@ class macros:
|
|||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import copy
|
import copy
|
||||||
import sys
|
import sys
|
||||||
|
print inspect.getfile(macros)
|
||||||
m = macros(name = 'defaults.mc')
|
m = macros(name = 'defaults.mc')
|
||||||
d = copy.copy(m)
|
d = copy.copy(m)
|
||||||
m['test1'] = 'something'
|
m['test1'] = 'something'
|
||||||
|
@@ -14,12 +14,12 @@ top = '.'
|
|||||||
out = 'build-' + sys.platform
|
out = 'build-' + sys.platform
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
opt.load("g++")
|
opt.load('compiler_c')
|
||||||
opt.load("gcc")
|
opt.load('compiler_cxx')
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
conf.load("g++")
|
conf.load('compiler_c')
|
||||||
conf.load("gcc")
|
conf.load('compiler_cxx')
|
||||||
conf_libiberty(conf)
|
conf_libiberty(conf)
|
||||||
conf_libelf(conf)
|
conf_libelf(conf)
|
||||||
|
|
||||||
@@ -100,6 +100,29 @@ def build(bld):
|
|||||||
cxxflags = conf['cxxflags'] + conf['warningflags'],
|
cxxflags = conf['cxxflags'] + conf['warningflags'],
|
||||||
linkflags = conf['linkflags'])
|
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):
|
def rebuild(ctx):
|
||||||
import waflib.Options
|
import waflib.Options
|
||||||
waflib.Options.commands.extend(['clean', 'build'])
|
waflib.Options.commands.extend(['clean', 'build'])
|
||||||
|
@@ -48,6 +48,11 @@ from rtemstoolkit import path
|
|||||||
|
|
||||||
import version
|
import version
|
||||||
|
|
||||||
|
#
|
||||||
|
# The path for the defaults.
|
||||||
|
#
|
||||||
|
defaults_mc = 'rtems/testing/defaults.mc'
|
||||||
|
|
||||||
class command_line(options.command_line):
|
class command_line(options.command_line):
|
||||||
"""Process the command line in a common way for all Tool Builder commands."""
|
"""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,
|
def load(args, optargs = None,
|
||||||
command_path = 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.
|
# 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:
|
if len(command_path) == 0:
|
||||||
command_path = '.'
|
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
|
# The command line contains the base defaults object all build objects copy
|
||||||
# and modify by loading a configuration.
|
# and modify by loading a configuration.
|
||||||
#
|
#
|
||||||
opts = command_line(args,
|
opts = command_line(args,
|
||||||
optargs,
|
optargs,
|
||||||
macros.macros(name = defaults,
|
macros.macros(name = defaults, rtdir = rtdir),
|
||||||
rtdir = command_path),
|
|
||||||
command_path)
|
command_path)
|
||||||
options.load(opts)
|
options.load(opts)
|
||||||
return opts
|
return opts
|
||||||
|
|
||||||
def run(args):
|
def run(args):
|
||||||
try:
|
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()))
|
log.notice('RTEMS Test - Defaults, v%s' % (version.str()))
|
||||||
_opts.log_info()
|
_opts.log_info()
|
||||||
log.notice('Options:')
|
log.notice('Options:')
|
||||||
|
@@ -307,7 +307,7 @@ def run(command_path = None):
|
|||||||
except error.exit, eerr:
|
except error.exit, eerr:
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
if opts.find_arg('--stacktrace'):
|
if opts is not None and opts.find_arg('--stacktrace'):
|
||||||
print '}} dumping:', threading.active_count()
|
print '}} dumping:', threading.active_count()
|
||||||
for t in threading.enumerate():
|
for t in threading.enumerate():
|
||||||
print '}} ', t.name
|
print '}} ', t.name
|
||||||
|
@@ -32,7 +32,8 @@
|
|||||||
import sys, os
|
import sys, os
|
||||||
base = os.path.dirname(os.path.abspath(sys.argv[0]))
|
base = os.path.dirname(os.path.abspath(sys.argv[0]))
|
||||||
parent = os.path.dirname(base)
|
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:
|
try:
|
||||||
import rt.test
|
import rt.test
|
||||||
|
@@ -75,7 +75,6 @@ _infodir: dir, none, '%{_datarootdir}/info'
|
|||||||
_localedir: dir, none, '%{_datarootdir}/locale'
|
_localedir: dir, none, '%{_datarootdir}/locale'
|
||||||
_localedir: dir, none, '%{_datadir}/locale'
|
_localedir: dir, none, '%{_datadir}/locale'
|
||||||
_localstatedir: dir, none, '%{_prefix}/var'
|
_localstatedir: dir, none, '%{_prefix}/var'
|
||||||
_prefix: dir, none, '%{_usr}'
|
|
||||||
_usr: dir, none, '/usr/local'
|
_usr: dir, none, '/usr/local'
|
||||||
_usrsrc: dir, none, '%{_usr}/src'
|
_usrsrc: dir, none, '%{_usr}/src'
|
||||||
_var: dir, none, '/usr/local/var'
|
_var: dir, none, '/usr/local/var'
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# RTEMS Tools Project (http://www.rtems.org/)
|
# RTEMS Tools Project (http://www.rtems.org/)
|
||||||
# Copyright 2014 Chris Johns (chrisj@rtems.org)
|
# Copyright 2015 Chris Johns (chrisj@rtems.org)
|
||||||
# All rights reserved.
|
# All rights reserved.
|
||||||
#
|
#
|
||||||
# This file is part of the RTEMS Tools package in 'rtems-tools'.
|
# This file is part of the RTEMS Tools package in 'rtems-tools'.
|
||||||
@@ -34,14 +34,49 @@ def recurse(ctx):
|
|||||||
for sd in subdirs:
|
for sd in subdirs:
|
||||||
ctx.recurse(sd)
|
ctx.recurse(sd)
|
||||||
|
|
||||||
def options(ctx):
|
def options(opt):
|
||||||
recurse(ctx)
|
recurse(opt)
|
||||||
|
opt.load('python')
|
||||||
|
|
||||||
def configure(ctx):
|
def configure(ctx):
|
||||||
recurse(ctx)
|
recurse(ctx)
|
||||||
|
conf.load('python')
|
||||||
|
conf.check_python_version((2,7,3))
|
||||||
|
|
||||||
def build(ctx):
|
def build(bld):
|
||||||
recurse(ctx)
|
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):
|
def install(ctx):
|
||||||
recurse(ctx)
|
recurse(ctx)
|
||||||
|
@@ -3,10 +3,11 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
def options(opt):
|
def options(opt):
|
||||||
pass
|
opt.load('python')
|
||||||
|
|
||||||
def configure(conf):
|
def configure(conf):
|
||||||
conf.load('python')
|
conf.load('python')
|
||||||
|
conf.check_python_version((2,7,3))
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
source = ['__init__.py',
|
source = ['__init__.py',
|
||||||
@@ -26,5 +27,6 @@ def build(bld):
|
|||||||
'supercore_printer.py',
|
'supercore_printer.py',
|
||||||
'threads.py',
|
'threads.py',
|
||||||
'watchdog.py']
|
'watchdog.py']
|
||||||
bld(features = 'py', source = source, install_path = None)
|
bld(features = 'py',
|
||||||
bld.install_files('${PREFIX}/share/gdb/python/rtems', source)
|
source = source,
|
||||||
|
install_path = '${PREFIX}/share/gdb/python/rtems')
|
||||||
|
Reference in New Issue
Block a user