diff --git a/lnt/lnttool/main.py b/lnt/lnttool/main.py --- a/lnt/lnttool/main.py +++ b/lnt/lnttool/main.py @@ -10,6 +10,7 @@ from .viewcomparison import action_view_comparison from .admin import group_admin from lnt.util import logger +from lnt.server.db.rules_manager import register_hooks import click import logging import sys @@ -183,14 +184,20 @@ @submit_options @click.option("--verbose", "-v", is_flag=True, help="show verbose test results") -def action_submit(url, files, select_machine, merge, verbose): +@click.option("--testsuite", "-s", default='nts', show_default=True, + help="testsuite to use in case the url is a file path") +def action_submit(url, files, select_machine, merge, verbose, testsuite): """submit a test report to the server""" from lnt.util import ServerUtil import lnt.util.ImportData + if '://' not in url: + init_logger(logging.DEBUG) + register_hooks() + results = ServerUtil.submitFiles(url, files, verbose, select_machine=select_machine, - merge_run=merge) + merge_run=merge, testsuite=testsuite) for submitted_file in results: if verbose: lnt.util.ImportData.print_report_result( diff --git a/lnt/server/ui/static/lnt_profile.js b/lnt/server/ui/static/lnt_profile.js --- a/lnt/server/ui/static/lnt_profile.js +++ b/lnt/server/ui/static/lnt_profile.js @@ -122,7 +122,7 @@ if (!noFallThru && nextInstruction) targets.push(nextInstruction.address); if (match.length > 1) - targets.push(cfg.convertToAddress(match[1])); + targets.push(cfg.convertToAddress(match[1], instruction.address)); return [noFallThru, targets]; } } @@ -134,8 +134,13 @@ CFG.prototype = { // The following method will have different implementations depending // on the profiler, or kind of profiling input. - convertToAddress: function (addressString) { - return parseInt(addressString, 16); + convertToAddress: function (addressString, addressCurrent) { + // If the address starts with '#' it is a relative one + // and should be processed differently + if (addressString.startsWith('#')) + return addressCurrent + parseInt(addressString.substring(1), 16); + else + return parseInt(addressString, 16); }, parseDisassembly: function(counter) { diff --git a/lnt/util/ServerUtil.py b/lnt/util/ServerUtil.py --- a/lnt/util/ServerUtil.py +++ b/lnt/util/ServerUtil.py @@ -71,7 +71,8 @@ return -def submitFileToInstance(path, file, select_machine=None, merge_run=None): +def submitFileToInstance(path, file, select_machine=None, merge_run=None, + testsuite=None): # Otherwise, assume it is a local url and submit to the default database # in the instance. instance = lnt.server.instance.Instance.frompath(path) @@ -82,24 +83,28 @@ raise ValueError("no default database in instance: %r" % (path,)) session = db.make_session() return lnt.util.ImportData.import_and_report( - config, db_name, db, session, file, format='', ts_name='nts', - select_machine=select_machine, merge_run=merge_run) + config, db_name, db, session, file, format='', + ts_name=testsuite or 'nts', select_machine=select_machine, + merge_run=merge_run) -def submitFile(url, file, verbose, select_machine=None, merge_run=None): +def submitFile(url, file, verbose, select_machine=None, merge_run=None, + testsuite=None): # If this is a real url, submit it using urllib. if '://' in url: result = submitFileToServer(url, file, select_machine, merge_run) else: - result = submitFileToInstance(url, file, select_machine, merge_run) + result = submitFileToInstance(url, file, select_machine, merge_run, + testsuite) return result -def submitFiles(url, files, verbose, select_machine=None, merge_run=None): +def submitFiles(url, files, verbose, select_machine=None, merge_run=None, + testsuite=None): results = [] for file in files: result = submitFile(url, file, verbose, select_machine=select_machine, - merge_run=merge_run) + merge_run=merge_run, testsuite=testsuite) if result: results.append(result) return results