Add missing git attributes
Change-Id: I0fd68ed33da702a02d183fc31edd1e0441b3e009
Signed-off-by: Kevin Peng <kevin.peng@arm.com>
diff --git a/irq_test_tool/example/irqs_AN519.json b/irq_test_tool/example/irqs_AN519.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_AN519.json
+++ b/irq_test_tool/example/irqs_AN519.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_AN521.json b/irq_test_tool/example/irqs_AN521.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_AN521.json
+++ b/irq_test_tool/example/irqs_AN521.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_AN524.json b/irq_test_tool/example/irqs_AN524.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_AN524.json
+++ b/irq_test_tool/example/irqs_AN524.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_AN539.json b/irq_test_tool/example/irqs_AN539.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_AN539.json
+++ b/irq_test_tool/example/irqs_AN539.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_LPC55S69.json b/irq_test_tool/example/irqs_LPC55S69.json
index 30fcad7..33db749 100644
--- a/irq_test_tool/example/irqs_LPC55S69.json
+++ b/irq_test_tool/example/irqs_LPC55S69.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 36
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 36
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_Musca_A.json b/irq_test_tool/example/irqs_Musca_A.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_Musca_A.json
+++ b/irq_test_tool/example/irqs_Musca_A.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_Musca_B1.json b/irq_test_tool/example/irqs_Musca_B1.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_Musca_B1.json
+++ b/irq_test_tool/example/irqs_Musca_B1.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_Musca_S1.json b/irq_test_tool/example/irqs_Musca_S1.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_Musca_S1.json
+++ b/irq_test_tool/example/irqs_Musca_S1.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/irqs_SSE-200_AWS.json b/irq_test_tool/example/irqs_SSE-200_AWS.json
index 2ba98dc..4bf9a2c 100644
--- a/irq_test_tool/example/irqs_SSE-200_AWS.json
+++ b/irq_test_tool/example/irqs_SSE-200_AWS.json
@@ -1,7 +1,7 @@
-{
- "irqs": {
- "timer_0_irq": {
- "line_num" : 3
- }
- }
-}
+{
+ "irqs": {
+ "timer_0_irq": {
+ "line_num" : 3
+ }
+ }
+}
diff --git a/irq_test_tool/example/testcase.json b/irq_test_tool/example/testcase.json
index 91c8c13..28c93d8 100644
--- a/irq_test_tool/example/testcase.json
+++ b/irq_test_tool/example/testcase.json
@@ -1,15 +1,15 @@
-{
- "description" : ["Trigger Secure interrupt during Secure Service execution"],
- "steps": [
- {
- "wait_for" : "example_secure_service_start"
- },
- {
- "expect" : "stop_secure_timer",
- "trigger" : "timer_0_irq"
- },
- {
- "wait_for" : "example_secure_service_end"
- }
- ]
-}
+{
+ "description" : ["Trigger Secure interrupt during Secure Service execution"],
+ "steps": [
+ {
+ "wait_for" : "example_secure_service_start"
+ },
+ {
+ "expect" : "stop_secure_timer",
+ "trigger" : "timer_0_irq"
+ },
+ {
+ "wait_for" : "example_secure_service_end"
+ }
+ ]
+}
diff --git a/irq_test_tool/irq_test.py b/irq_test_tool/irq_test.py
index b9b2fd3..16a7143 100644
--- a/irq_test_tool/irq_test.py
+++ b/irq_test_tool/irq_test.py
@@ -1,107 +1,107 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-""" This module is the entry point of the IRQ testing tool.
-"""
-
-import argparse
-import json
-import logging
-import os
-import sys
-
-# Workaround for GDB: Add current directory to the module search path
-sys.path.insert(0, os.getcwd())
-from irq_test_abstract_debugger import Location
-from irq_test_dummy_debugger import DummyDebugger
-from irq_test_executor import TestExecutor
-
-def create_argparser():
- """ Create an argument parser for the script
-
- This parser enumerates the arguments that are necessary for all the
- debuggers. Debugger implementations might add other arguments to this
- parser.
- """
- parser = argparse.ArgumentParser()
- parser.add_argument("-w", "--sw-break",
- help="use sw breakpoint (the default is HW breakpoint)",
- action="store_true")
- parser.add_argument("-q", "--irqs",
- type=str,
- help="the name of the irqs json",
- required=True)
- parser.add_argument("-b", "--breakpoints",
- type=str,
- help="the name of the breakpoints json",
- required=True)
- parser.add_argument("-t", "--testcase",
- type=str,
- help="The testcase to execute",
- required=True)
- return parser
-
-def main():
- """ The main function of the script
-
- Detects the debugger that it is started in, creates the debugger
- implementation instance, and either executes the test, or registers a
- command in the debugger. For details see the README.rst
- """
- try:
- # TODO: evironment checking should be refactored to the debugger
- # implementations
- from arm_ds.debugger_v1 import Debugger
- debugger_type = 'Arm-DS'
- except ImportError:
- logging.debug('Failed to import Arm-DS scripting env, try GDB')
- try:
- # TODO: evironment checking should be refactored to the debugger
- # implementations
- import gdb
- debugger_type = 'GDB'
- except ImportError:
- logging.debug("Failed to import GDB scripting env, fall back do "
- "dummy")
- debugger_type = 'dummy'
-
- logging.info("The debugger type selected is: %s", debugger_type)
-
- # create a debugger controller instance
- if debugger_type == 'Arm-DS':
- from irq_test_Arm_DS_debugger import ArmDSDebugger
- logging.debug("initialising debugger object...")
- arg_parser = create_argparser()
- try:
- args = arg_parser.parse_args()
- except:
- logging.error("Failed to parse command line parameters")
- return
- # TODO: Fail gracefully in case of an argparse error
- debugger = ArmDSDebugger(args.sw_break)
- executor = TestExecutor(debugger)
- executor.execute(args.irqs, args.breakpoints, args.testcase)
- elif debugger_type == 'GDB':
- from irq_test_gdb_debugger import GDBDebugger
- from irq_test_gdb_debugger import TestIRQsCommand
- logging.debug("initialising debugger object...")
- arg_parser = create_argparser()
-
- # register the 'test_irqs' custom command
- TestIRQsCommand(arg_parser)
- logging.info("Command 'test_irqs' is successfully registered")
- elif debugger_type == 'dummy':
- arg_parser = create_argparser()
- args = arg_parser.parse_args()
- debugger = DummyDebugger(args.sw_break)
- executor = TestExecutor(debugger)
- executor.execute(args.irqs, args.breakpoints, args.testcase)
-
-if __name__ == "__main__":
- logging.basicConfig(format='===== %(levelname)s: %(message)s',
- level=logging.DEBUG, stream=sys.stdout)
- main()
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+""" This module is the entry point of the IRQ testing tool.
+"""
+
+import argparse
+import json
+import logging
+import os
+import sys
+
+# Workaround for GDB: Add current directory to the module search path
+sys.path.insert(0, os.getcwd())
+from irq_test_abstract_debugger import Location
+from irq_test_dummy_debugger import DummyDebugger
+from irq_test_executor import TestExecutor
+
+def create_argparser():
+ """ Create an argument parser for the script
+
+ This parser enumerates the arguments that are necessary for all the
+ debuggers. Debugger implementations might add other arguments to this
+ parser.
+ """
+ parser = argparse.ArgumentParser()
+ parser.add_argument("-w", "--sw-break",
+ help="use sw breakpoint (the default is HW breakpoint)",
+ action="store_true")
+ parser.add_argument("-q", "--irqs",
+ type=str,
+ help="the name of the irqs json",
+ required=True)
+ parser.add_argument("-b", "--breakpoints",
+ type=str,
+ help="the name of the breakpoints json",
+ required=True)
+ parser.add_argument("-t", "--testcase",
+ type=str,
+ help="The testcase to execute",
+ required=True)
+ return parser
+
+def main():
+ """ The main function of the script
+
+ Detects the debugger that it is started in, creates the debugger
+ implementation instance, and either executes the test, or registers a
+ command in the debugger. For details see the README.rst
+ """
+ try:
+ # TODO: evironment checking should be refactored to the debugger
+ # implementations
+ from arm_ds.debugger_v1 import Debugger
+ debugger_type = 'Arm-DS'
+ except ImportError:
+ logging.debug('Failed to import Arm-DS scripting env, try GDB')
+ try:
+ # TODO: evironment checking should be refactored to the debugger
+ # implementations
+ import gdb
+ debugger_type = 'GDB'
+ except ImportError:
+ logging.debug("Failed to import GDB scripting env, fall back do "
+ "dummy")
+ debugger_type = 'dummy'
+
+ logging.info("The debugger type selected is: %s", debugger_type)
+
+ # create a debugger controller instance
+ if debugger_type == 'Arm-DS':
+ from irq_test_Arm_DS_debugger import ArmDSDebugger
+ logging.debug("initialising debugger object...")
+ arg_parser = create_argparser()
+ try:
+ args = arg_parser.parse_args()
+ except:
+ logging.error("Failed to parse command line parameters")
+ return
+ # TODO: Fail gracefully in case of an argparse error
+ debugger = ArmDSDebugger(args.sw_break)
+ executor = TestExecutor(debugger)
+ executor.execute(args.irqs, args.breakpoints, args.testcase)
+ elif debugger_type == 'GDB':
+ from irq_test_gdb_debugger import GDBDebugger
+ from irq_test_gdb_debugger import TestIRQsCommand
+ logging.debug("initialising debugger object...")
+ arg_parser = create_argparser()
+
+ # register the 'test_irqs' custom command
+ TestIRQsCommand(arg_parser)
+ logging.info("Command 'test_irqs' is successfully registered")
+ elif debugger_type == 'dummy':
+ arg_parser = create_argparser()
+ args = arg_parser.parse_args()
+ debugger = DummyDebugger(args.sw_break)
+ executor = TestExecutor(debugger)
+ executor.execute(args.irqs, args.breakpoints, args.testcase)
+
+if __name__ == "__main__":
+ logging.basicConfig(format='===== %(levelname)s: %(message)s',
+ level=logging.DEBUG, stream=sys.stdout)
+ main()
diff --git a/irq_test_tool/irq_test_Arm_DS_debugger.py b/irq_test_tool/irq_test_Arm_DS_debugger.py
index 2bac20c..6078cdf 100644
--- a/irq_test_tool/irq_test_Arm_DS_debugger.py
+++ b/irq_test_tool/irq_test_Arm_DS_debugger.py
@@ -1,155 +1,155 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-""" This module implements the debugger control interface for the Arm
- Developement Studio
-"""
-
-import logging
-import re
-# pylint: disable=import-error
-from arm_ds.debugger_v1 import Debugger
-from arm_ds.debugger_v1 import DebugException
-# pylint: enable=import-error
-from irq_test_abstract_debugger import AbstractDebugger
-
-class ArmDSDebugger(AbstractDebugger):
- """ This class is the implementation of the control interface for the Arm
- Developement Studio
- """
-
- def __init__(self, use_sw_breakpoints):
- super(ArmDSDebugger, self).__init__()
- debugger = Debugger()
- self.debugger = debugger
- self.breakpoints = {} # map breakpoint IDs to names
- self.use_sw_breakpoints = use_sw_breakpoints
-
- if debugger.isRunning():
- logging.info("debugger is running, stop it")
- debugger.stop()
- try:
- timeout = 180*1000 # TODO: configureble timeout value?
- debugger.waitForStop(timeout)
- except DebugException as debug_exception:
- logging.error("debugger wait timed out: %s", str(debug_exception))
-
- def set_breakpoint(self, name, location):
- logging.info("Add breakpoint for location %s:'%s'", name, str(location))
-
- ec = self.debugger.getCurrentExecutionContext()
- bps = ec.getBreakpointService()
-
- try:
- if location.symbol:
- if location.offset != 0:
- spec = '(((unsigned char*)' + location.symbol + ') + ' + location.offset + ')'
- bps.setBreakpoint(spec, hw=(not self.use_sw_breakpoints))
- else:
- bps.setBreakpoint(location.symbol, hw=(not self.use_sw_breakpoints))
- else:
- bps.setBreakpoint(location.filename, location.line, hw=(not self.use_sw_breakpoints))
- except DebugException as ex:
- logging.error("Failed to set breakpoint for %s", str(location))
- logging.error(str(ex))
- # TODO: Remove exit (from all over the script), and drop custom
- # exception that is handled in main.
- exit(2)
-
- # Add the new breakpoint to the list.
- # Assume that the last breakpoint is the newly added one
- breakpoint = bps.getBreakpoint(bps.getBreakpointCount()-1)
-
- self.breakpoints[breakpoint.getId()] = name
-
- def __triger_interrupt_using_STIR_address(self, line):
- logging.debug("writing to STIR address %s", hex(line))
- ec = self.debugger.getCurrentExecutionContext()
- memory_service = ec.getMemoryService()
- mem_params = {'width': 8, 'verify': 0, 'use_image': 0}
- memory_service.writeMemory32(hex(0xE000EF00), line, mem_params)
-
- def __triger_interrupt_using_STIR_register(self, line):
- logging.debug("writing to STIR register %s", hex(line))
- register_name = "STIR"
- ec = self.debugger.getCurrentExecutionContext()
- ec.getRegisterService().setValue(register_name, line)
-
- def __triger_interrupt_using_NVIC_ISPR_register(self, line):
- # write ISPR register directly
- register_id = line//32
- register_offset = line%32
- register_name = "NVIC_ISPR" + str(register_id)
-
- ec = self.debugger.getCurrentExecutionContext()
- value = ec.getRegisterService().getValue(register_name)
- value |= 1 << register_offset
-
- logging.debug("Writing to {:s} register 0x{:08x}".
- format(register_name, value))
-
- ec.getRegisterService().setValue(register_name, hex(value))
-
- def __triger_interrupt_using_NVIC_ISPR_address(self, line):
- # write ISPR register directly
- register_id = line//32
- register_offset = line%32
- # TODO: remove magic numbers
- NVIC_ISPR_address = 0xE000E200
- NVIC_ISPR_n_address = NVIC_ISPR_address + register_id * 4
-
- ec = self.debugger.getCurrentExecutionContext()
- memory_service = ec.getMemoryService()
- mem_params = {'width': 8, 'verify': 0, 'use_image': 0}
-
- value = 1 << register_offset # 0 bits are ignored on write
-
- logging.debug("Writing to address 0x{:08x} register 0x{:08x}".
- format(NVIC_ISPR_n_address, value))
-
- memory_service.writeMemory32(NVIC_ISPR_n_address, value, mem_params)
-
- def trigger_interrupt(self, interrupt_line):
- logging.info("triggering interrupt for line %s", str(interrupt_line))
-
- line = int(interrupt_line)
-
- if line >= 0:
- #self.__triger_interrupt_using_STIR_address(line)
- #self.__triger_interrupt_using_STIR_register(line)
- #self.__triger_interrupt_using_NVIC_ISPR_register(line) # seems to have bugs?
- self.__triger_interrupt_using_NVIC_ISPR_address(line)
- else:
- logging.error("Invalid interrupt line value {:d}".format(line))
- exit(0)
-
- def continue_execution(self):
- logging.info("Continuing execution ")
- ec = self.debugger.getCurrentExecutionContext()
- ec.executeDSCommand("info breakpoints")
- self.debugger.run()
-
- try:
- timeout = 180*1000 # TODO: configureble timeout value?
- self.debugger.waitForStop(timeout)
- except DebugException as debug_exception:
- logging.error("debugger wait timed out %s", str(debug_exception))
- exit(0)
-
-
- def clear_breakpoints(self):
- logging.info("Remove all breakpoints")
- self.debugger.removeAllBreakpoints()
- self.breakpoints = {}
-
- def get_triggered_breakpoint(self):
- ec = self.debugger.getCurrentExecutionContext()
- bps = ec.getBreakpointService()
- breakpoint = bps.getHitBreakpoint()
- id = breakpoint.getId()
- logging.info("getting the triggered breakpoints, ID = {:d}".format(id))
- return self.breakpoints[id]
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+""" This module implements the debugger control interface for the Arm
+ Developement Studio
+"""
+
+import logging
+import re
+# pylint: disable=import-error
+from arm_ds.debugger_v1 import Debugger
+from arm_ds.debugger_v1 import DebugException
+# pylint: enable=import-error
+from irq_test_abstract_debugger import AbstractDebugger
+
+class ArmDSDebugger(AbstractDebugger):
+ """ This class is the implementation of the control interface for the Arm
+ Developement Studio
+ """
+
+ def __init__(self, use_sw_breakpoints):
+ super(ArmDSDebugger, self).__init__()
+ debugger = Debugger()
+ self.debugger = debugger
+ self.breakpoints = {} # map breakpoint IDs to names
+ self.use_sw_breakpoints = use_sw_breakpoints
+
+ if debugger.isRunning():
+ logging.info("debugger is running, stop it")
+ debugger.stop()
+ try:
+ timeout = 180*1000 # TODO: configureble timeout value?
+ debugger.waitForStop(timeout)
+ except DebugException as debug_exception:
+ logging.error("debugger wait timed out: %s", str(debug_exception))
+
+ def set_breakpoint(self, name, location):
+ logging.info("Add breakpoint for location %s:'%s'", name, str(location))
+
+ ec = self.debugger.getCurrentExecutionContext()
+ bps = ec.getBreakpointService()
+
+ try:
+ if location.symbol:
+ if location.offset != 0:
+ spec = '(((unsigned char*)' + location.symbol + ') + ' + location.offset + ')'
+ bps.setBreakpoint(spec, hw=(not self.use_sw_breakpoints))
+ else:
+ bps.setBreakpoint(location.symbol, hw=(not self.use_sw_breakpoints))
+ else:
+ bps.setBreakpoint(location.filename, location.line, hw=(not self.use_sw_breakpoints))
+ except DebugException as ex:
+ logging.error("Failed to set breakpoint for %s", str(location))
+ logging.error(str(ex))
+ # TODO: Remove exit (from all over the script), and drop custom
+ # exception that is handled in main.
+ exit(2)
+
+ # Add the new breakpoint to the list.
+ # Assume that the last breakpoint is the newly added one
+ breakpoint = bps.getBreakpoint(bps.getBreakpointCount()-1)
+
+ self.breakpoints[breakpoint.getId()] = name
+
+ def __triger_interrupt_using_STIR_address(self, line):
+ logging.debug("writing to STIR address %s", hex(line))
+ ec = self.debugger.getCurrentExecutionContext()
+ memory_service = ec.getMemoryService()
+ mem_params = {'width': 8, 'verify': 0, 'use_image': 0}
+ memory_service.writeMemory32(hex(0xE000EF00), line, mem_params)
+
+ def __triger_interrupt_using_STIR_register(self, line):
+ logging.debug("writing to STIR register %s", hex(line))
+ register_name = "STIR"
+ ec = self.debugger.getCurrentExecutionContext()
+ ec.getRegisterService().setValue(register_name, line)
+
+ def __triger_interrupt_using_NVIC_ISPR_register(self, line):
+ # write ISPR register directly
+ register_id = line//32
+ register_offset = line%32
+ register_name = "NVIC_ISPR" + str(register_id)
+
+ ec = self.debugger.getCurrentExecutionContext()
+ value = ec.getRegisterService().getValue(register_name)
+ value |= 1 << register_offset
+
+ logging.debug("Writing to {:s} register 0x{:08x}".
+ format(register_name, value))
+
+ ec.getRegisterService().setValue(register_name, hex(value))
+
+ def __triger_interrupt_using_NVIC_ISPR_address(self, line):
+ # write ISPR register directly
+ register_id = line//32
+ register_offset = line%32
+ # TODO: remove magic numbers
+ NVIC_ISPR_address = 0xE000E200
+ NVIC_ISPR_n_address = NVIC_ISPR_address + register_id * 4
+
+ ec = self.debugger.getCurrentExecutionContext()
+ memory_service = ec.getMemoryService()
+ mem_params = {'width': 8, 'verify': 0, 'use_image': 0}
+
+ value = 1 << register_offset # 0 bits are ignored on write
+
+ logging.debug("Writing to address 0x{:08x} register 0x{:08x}".
+ format(NVIC_ISPR_n_address, value))
+
+ memory_service.writeMemory32(NVIC_ISPR_n_address, value, mem_params)
+
+ def trigger_interrupt(self, interrupt_line):
+ logging.info("triggering interrupt for line %s", str(interrupt_line))
+
+ line = int(interrupt_line)
+
+ if line >= 0:
+ #self.__triger_interrupt_using_STIR_address(line)
+ #self.__triger_interrupt_using_STIR_register(line)
+ #self.__triger_interrupt_using_NVIC_ISPR_register(line) # seems to have bugs?
+ self.__triger_interrupt_using_NVIC_ISPR_address(line)
+ else:
+ logging.error("Invalid interrupt line value {:d}".format(line))
+ exit(0)
+
+ def continue_execution(self):
+ logging.info("Continuing execution ")
+ ec = self.debugger.getCurrentExecutionContext()
+ ec.executeDSCommand("info breakpoints")
+ self.debugger.run()
+
+ try:
+ timeout = 180*1000 # TODO: configureble timeout value?
+ self.debugger.waitForStop(timeout)
+ except DebugException as debug_exception:
+ logging.error("debugger wait timed out %s", str(debug_exception))
+ exit(0)
+
+
+ def clear_breakpoints(self):
+ logging.info("Remove all breakpoints")
+ self.debugger.removeAllBreakpoints()
+ self.breakpoints = {}
+
+ def get_triggered_breakpoint(self):
+ ec = self.debugger.getCurrentExecutionContext()
+ bps = ec.getBreakpointService()
+ breakpoint = bps.getHitBreakpoint()
+ id = breakpoint.getId()
+ logging.info("getting the triggered breakpoints, ID = {:d}".format(id))
+ return self.breakpoints[id]
diff --git a/irq_test_tool/irq_test_abstract_debugger.py b/irq_test_tool/irq_test_abstract_debugger.py
index 38600ce..de27cb5 100644
--- a/irq_test_tool/irq_test_abstract_debugger.py
+++ b/irq_test_tool/irq_test_abstract_debugger.py
@@ -1,76 +1,76 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-"""Defines the interface that a debugger control class have to implement
-"""
-
-class Location(object):
- """A helper class to store the properties of a location where breakpoint
- can be put
- """
- def __init__(self, symbol=None, offset=0, filename=None, line=None):
- self.symbol = symbol
- self.offset = offset
- self.filename = filename
- self.line = line
-
- def __str__(self):
- ret = ""
- if self.symbol:
- ret += str(self.symbol)
-
- if self.offset:
- ret += "+" + str(self.offset)
-
- if self.filename:
- if self.symbol:
- ret += " @ "
- ret += str(self.filename) + ":" + str(self.line)
-
- return ret
-
- def __unicode__(self):
- return str(self), "utf-8"
-
-class AbstractDebugger(object):
- """The interface that a debugger control class have to implement
- """
- def __init__(self):
- pass
-
- def set_breakpoint(self, name, location):
- """Put a breakpoint at a location
-
- Args:
- name: The name of the location. This name is returned by
- get_triggered_breakpoint
- location: An instance of a Location class
- """
- raise NotImplementedError('subclasses must override set_breakpoint()!')
-
- def trigger_interrupt(self, interrupt_line):
- """trigger an interrupt on the interrupt line specified in the parameter
-
- Args:
- interrupt_line: The number of the interrupt line
- """
- raise NotImplementedError('subclasses must override trigger_interrupt()!')
-
- def continue_execution(self):
- """Continue the execution
- """
- raise NotImplementedError('subclasses must override continue_execution()!')
-
- def clear_breakpoints(self):
- """Clear all breakpoints
- """
- raise NotImplementedError('subclasses must override clear_breakpoints()!')
-
- def get_triggered_breakpoint(self):
- """Get the name of the last triggered breakpoint
- """
- raise NotImplementedError('subclasses must override get_triggered_breakpoint()!')
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+"""Defines the interface that a debugger control class have to implement
+"""
+
+class Location(object):
+ """A helper class to store the properties of a location where breakpoint
+ can be put
+ """
+ def __init__(self, symbol=None, offset=0, filename=None, line=None):
+ self.symbol = symbol
+ self.offset = offset
+ self.filename = filename
+ self.line = line
+
+ def __str__(self):
+ ret = ""
+ if self.symbol:
+ ret += str(self.symbol)
+
+ if self.offset:
+ ret += "+" + str(self.offset)
+
+ if self.filename:
+ if self.symbol:
+ ret += " @ "
+ ret += str(self.filename) + ":" + str(self.line)
+
+ return ret
+
+ def __unicode__(self):
+ return str(self), "utf-8"
+
+class AbstractDebugger(object):
+ """The interface that a debugger control class have to implement
+ """
+ def __init__(self):
+ pass
+
+ def set_breakpoint(self, name, location):
+ """Put a breakpoint at a location
+
+ Args:
+ name: The name of the location. This name is returned by
+ get_triggered_breakpoint
+ location: An instance of a Location class
+ """
+ raise NotImplementedError('subclasses must override set_breakpoint()!')
+
+ def trigger_interrupt(self, interrupt_line):
+ """trigger an interrupt on the interrupt line specified in the parameter
+
+ Args:
+ interrupt_line: The number of the interrupt line
+ """
+ raise NotImplementedError('subclasses must override trigger_interrupt()!')
+
+ def continue_execution(self):
+ """Continue the execution
+ """
+ raise NotImplementedError('subclasses must override continue_execution()!')
+
+ def clear_breakpoints(self):
+ """Clear all breakpoints
+ """
+ raise NotImplementedError('subclasses must override clear_breakpoints()!')
+
+ def get_triggered_breakpoint(self):
+ """Get the name of the last triggered breakpoint
+ """
+ raise NotImplementedError('subclasses must override get_triggered_breakpoint()!')
diff --git a/irq_test_tool/irq_test_dummy_debugger.py b/irq_test_tool/irq_test_dummy_debugger.py
index c03077c..d31550a 100644
--- a/irq_test_tool/irq_test_dummy_debugger.py
+++ b/irq_test_tool/irq_test_dummy_debugger.py
@@ -1,50 +1,50 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-""" This module contains a dummy implementation of the debugger control interface
-"""
-
-import logging
-from irq_test_abstract_debugger import AbstractDebugger
-
-class DummyDebugger(AbstractDebugger):
- """A dummy implementation of the debugger control interface
-
- This class can be used for rapidly testing the testcase execution algorithm.
-
- Breakpoint names are put in a list to keep track of them. Interrupts are not
- emulated in any way, the 'trigger_interrupt' function returns without doing
- anything. 'continue_execution' returns immediately as well, and
- 'get_triggered_breakpoint' returns the breakpoint added the earliest.
- """
- def __init__(self, use_sw_breakpoints):
- super(DummyDebugger, self).__init__()
- self.breakpoints = []
- self.use_sw_breakpoints = use_sw_breakpoints
-
- def set_breakpoint(self, name, location):
- if (self.use_sw_breakpoints):
- breakpoint_type = "sw"
- else:
- breakpoint_type = "hw"
- logging.info("debugger: set %s breakpoint %s", breakpoint_type, name)
- self.breakpoints.append(name)
-
- def trigger_interrupt(self, interrupt_line):
- logging.info("debugger: triggering interrupt line for %s", str(interrupt_line))
-
- def continue_execution(self):
- logging.info("debugger: continue")
-
- def clear_breakpoints(self):
- logging.info("debugger: clearing breakpoints")
- self.breakpoints = []
-
- def get_triggered_breakpoint(self):
- if self.breakpoints:
- return self.breakpoints[0]
- return None
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+""" This module contains a dummy implementation of the debugger control interface
+"""
+
+import logging
+from irq_test_abstract_debugger import AbstractDebugger
+
+class DummyDebugger(AbstractDebugger):
+ """A dummy implementation of the debugger control interface
+
+ This class can be used for rapidly testing the testcase execution algorithm.
+
+ Breakpoint names are put in a list to keep track of them. Interrupts are not
+ emulated in any way, the 'trigger_interrupt' function returns without doing
+ anything. 'continue_execution' returns immediately as well, and
+ 'get_triggered_breakpoint' returns the breakpoint added the earliest.
+ """
+ def __init__(self, use_sw_breakpoints):
+ super(DummyDebugger, self).__init__()
+ self.breakpoints = []
+ self.use_sw_breakpoints = use_sw_breakpoints
+
+ def set_breakpoint(self, name, location):
+ if (self.use_sw_breakpoints):
+ breakpoint_type = "sw"
+ else:
+ breakpoint_type = "hw"
+ logging.info("debugger: set %s breakpoint %s", breakpoint_type, name)
+ self.breakpoints.append(name)
+
+ def trigger_interrupt(self, interrupt_line):
+ logging.info("debugger: triggering interrupt line for %s", str(interrupt_line))
+
+ def continue_execution(self):
+ logging.info("debugger: continue")
+
+ def clear_breakpoints(self):
+ logging.info("debugger: clearing breakpoints")
+ self.breakpoints = []
+
+ def get_triggered_breakpoint(self):
+ if self.breakpoints:
+ return self.breakpoints[0]
+ return None
diff --git a/irq_test_tool/irq_test_executor.py b/irq_test_tool/irq_test_executor.py
index d98096f..86ddf8f 100644
--- a/irq_test_tool/irq_test_executor.py
+++ b/irq_test_tool/irq_test_executor.py
@@ -1,180 +1,180 @@
-#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited. All rights reserved.
-#
-# SPDX-License-Identifier: BSD-3-Clause
-#
-#-------------------------------------------------------------------------------
-
-from irq_test_abstract_debugger import Location
-import logging
-import json
-
-def create_locations_from_file(breakpoints_file_name):
- """Internal function to create Location objects of a breakpoints data file
- """
- # Read in the points to break at
- logging.info("Reading breakpoints file '%s'", breakpoints_file_name)
- breakpoints_file = open(breakpoints_file_name)
- breakpoints = json.load(breakpoints_file)
- logging.debug("breakpoints: %s", str(breakpoints))
-
- #TODO: go over the breakpoints and try to set them as a sanity check
-
- locations = {}
-
- for loc_name in breakpoints['breakpoints']:
- bkpt = breakpoints['breakpoints'][loc_name]
- offset = 0
-
- if 'file' in bkpt:
- filename = bkpt['file']
- else:
- filename = None
-
- if 'symbol' in bkpt:
- symbol = bkpt['symbol']
- if 'offset' in bkpt:
- offset = bkpt['offset']
- else:
- offset = 0
- else:
- if 'offset' in bkpt:
- logging.error("In location %s offset is included without a"
- " symbol")
- exit(2)
- symbol = None
-
- if 'line' in bkpt:
- line = bkpt['line']
- try:
- int(line)
- except ValueError:
- logging.error("In location %s line is not a valid int",
- loc_name)
- exit(2)
- else:
- line = None
-
- if symbol:
- if line or filename:
- logging.error("In location %s nor filename nor line should"
- "be present when symbol is present", loc_name)
- exit(2)
-
- if (not line and filename) or (line and not filename):
- logging.error("In location %s line and filename have to be "
- "present the same time", loc_name)
- exit(2)
-
- if (not symbol) and (not filename):
- logging.error("In location %s no symbol nor code location is "
- "specified at all", loc_name)
- exit(2)
-
- loc = Location(symbol=symbol, offset=offset, filename=filename, line=line)
-
- locations[loc_name] = loc
-
- return locations
-
-class TestExecutor(object):
- """ This class implements the test logic.
-
- It reads the input files, and executes the steps of the testcase. It receives an
- AbstractDebugger instance on creation. The test execution is implemented in the
- execute function.
- """
-
- def __init__(self, debugger):
- self.debugger = debugger
-
- def execute(self, irqs_filename, breakpoints_filename, testcase_filename):
- """ Execute a testcase
-
- Execute the testcase defined in 'testcase_filename', using the IRQs and
- breakpoints defined in irqs_filename and breakpoints_filename.
- """
- # Read in the list of IRQs
- logging.info("Reading irqs file '%s'", irqs_filename)
- irqs_file = open(irqs_filename)
- irqs = json.load(irqs_file)
- logging.debug("irqs: %s", str(irqs))
-
- # read in the test sequence
- logging.info("Reading test sequence file '%s'", testcase_filename)
- test_file = open(testcase_filename)
- test = json.load(test_file)
- logging.debug("testcase: %s", str(test))
-
- # TODO: crosscheck the tests file against the breakpoints and the irq's
- # available
-
- locations = create_locations_from_file(breakpoints_filename)
-
- self.debugger.clear_breakpoints()
-
- # execute the test
- steps = test['steps']
- for i, step in enumerate(steps):
-
- logging.info("---- Step %d ----", i)
-
- continue_execution = False
-
- if 'wait_for' in step:
- bp_name = step['wait_for']
- self.debugger.set_breakpoint(bp_name, locations[bp_name])
- next_to_break_at = bp_name
- continue_execution = True
- elif 'expect' in step:
- bp_name = step['expect']
- self.debugger.set_breakpoint(bp_name, locations[bp_name])
- next_to_break_at = bp_name
-
- # Find the next wait_for in the test sequence, and set a
- # breakpoint for that as well. So that it can be detected if an
- # expected breakpoint is missed.
-
- wait_for_found = False
- ii = i+1
-
- while ii < len(steps) and not wait_for_found:
- next_step = steps[ii]
- if 'wait_for' in next_step:
- next_bp_name = next_step['wait_for']
- self.debugger.set_breakpoint(next_bp_name,
- locations[next_bp_name])
- wait_for_found = True
- ii += 1
-
- continue_execution = True
-
-
- if 'trigger' in step:
- irqs_dict = irqs['irqs']
- irq = irqs_dict[step['trigger']]
- line_nu = irq['line_num']
- self.debugger.trigger_interrupt(line_nu)
-
-
- if continue_execution:
- self.debugger.continue_execution()
-
- triggered_breakpoint = self.debugger.get_triggered_breakpoint()
-
- if triggered_breakpoint is None:
- logging.error("No breakpoint was hit?????")
- exit(0)
-
- if triggered_breakpoint != next_to_break_at:
- logging.error("execution stopped at '%s' instead of '%s'",
- triggered_breakpoint, next_to_break_at)
- exit(0)
- else:
- logging.error("execution stopped as no breakpoint is set")
- exit(1)
-
- self.debugger.clear_breakpoints()
-
- logging.info("All the steps in the test file are executed successfully"
- " with the expected result.")
+#-------------------------------------------------------------------------------
+# Copyright (c) 2020, Arm Limited. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+from irq_test_abstract_debugger import Location
+import logging
+import json
+
+def create_locations_from_file(breakpoints_file_name):
+ """Internal function to create Location objects of a breakpoints data file
+ """
+ # Read in the points to break at
+ logging.info("Reading breakpoints file '%s'", breakpoints_file_name)
+ breakpoints_file = open(breakpoints_file_name)
+ breakpoints = json.load(breakpoints_file)
+ logging.debug("breakpoints: %s", str(breakpoints))
+
+ #TODO: go over the breakpoints and try to set them as a sanity check
+
+ locations = {}
+
+ for loc_name in breakpoints['breakpoints']:
+ bkpt = breakpoints['breakpoints'][loc_name]
+ offset = 0
+
+ if 'file' in bkpt:
+ filename = bkpt['file']
+ else:
+ filename = None
+
+ if 'symbol' in bkpt:
+ symbol = bkpt['symbol']
+ if 'offset' in bkpt:
+ offset = bkpt['offset']
+ else:
+ offset = 0
+ else:
+ if 'offset' in bkpt:
+ logging.error("In location %s offset is included without a"
+ " symbol")
+ exit(2)
+ symbol = None
+
+ if 'line' in bkpt:
+ line = bkpt['line']
+ try:
+ int(line)
+ except ValueError:
+ logging.error("In location %s line is not a valid int",
+ loc_name)
+ exit(2)
+ else:
+ line = None
+
+ if symbol:
+ if line or filename:
+ logging.error("In location %s nor filename nor line should"
+ "be present when symbol is present", loc_name)
+ exit(2)
+
+ if (not line and filename) or (line and not filename):
+ logging.error("In location %s line and filename have to be "
+ "present the same time", loc_name)
+ exit(2)
+
+ if (not symbol) and (not filename):
+ logging.error("In location %s no symbol nor code location is "
+ "specified at all", loc_name)
+ exit(2)
+
+ loc = Location(symbol=symbol, offset=offset, filename=filename, line=line)
+
+ locations[loc_name] = loc
+
+ return locations
+
+class TestExecutor(object):
+ """ This class implements the test logic.
+
+ It reads the input files, and executes the steps of the testcase. It receives an
+ AbstractDebugger instance on creation. The test execution is implemented in the
+ execute function.
+ """
+
+ def __init__(self, debugger):
+ self.debugger = debugger
+
+ def execute(self, irqs_filename, breakpoints_filename, testcase_filename):
+ """ Execute a testcase
+
+ Execute the testcase defined in 'testcase_filename', using the IRQs and
+ breakpoints defined in irqs_filename and breakpoints_filename.
+ """
+ # Read in the list of IRQs
+ logging.info("Reading irqs file '%s'", irqs_filename)
+ irqs_file = open(irqs_filename)
+ irqs = json.load(irqs_file)
+ logging.debug("irqs: %s", str(irqs))
+
+ # read in the test sequence
+ logging.info("Reading test sequence file '%s'", testcase_filename)
+ test_file = open(testcase_filename)
+ test = json.load(test_file)
+ logging.debug("testcase: %s", str(test))
+
+ # TODO: crosscheck the tests file against the breakpoints and the irq's
+ # available
+
+ locations = create_locations_from_file(breakpoints_filename)
+
+ self.debugger.clear_breakpoints()
+
+ # execute the test
+ steps = test['steps']
+ for i, step in enumerate(steps):
+
+ logging.info("---- Step %d ----", i)
+
+ continue_execution = False
+
+ if 'wait_for' in step:
+ bp_name = step['wait_for']
+ self.debugger.set_breakpoint(bp_name, locations[bp_name])
+ next_to_break_at = bp_name
+ continue_execution = True
+ elif 'expect' in step:
+ bp_name = step['expect']
+ self.debugger.set_breakpoint(bp_name, locations[bp_name])
+ next_to_break_at = bp_name
+
+ # Find the next wait_for in the test sequence, and set a
+ # breakpoint for that as well. So that it can be detected if an
+ # expected breakpoint is missed.
+
+ wait_for_found = False
+ ii = i+1
+
+ while ii < len(steps) and not wait_for_found:
+ next_step = steps[ii]
+ if 'wait_for' in next_step:
+ next_bp_name = next_step['wait_for']
+ self.debugger.set_breakpoint(next_bp_name,
+ locations[next_bp_name])
+ wait_for_found = True
+ ii += 1
+
+ continue_execution = True
+
+
+ if 'trigger' in step:
+ irqs_dict = irqs['irqs']
+ irq = irqs_dict[step['trigger']]
+ line_nu = irq['line_num']
+ self.debugger.trigger_interrupt(line_nu)
+
+
+ if continue_execution:
+ self.debugger.continue_execution()
+
+ triggered_breakpoint = self.debugger.get_triggered_breakpoint()
+
+ if triggered_breakpoint is None:
+ logging.error("No breakpoint was hit?????")
+ exit(0)
+
+ if triggered_breakpoint != next_to_break_at:
+ logging.error("execution stopped at '%s' instead of '%s'",
+ triggered_breakpoint, next_to_break_at)
+ exit(0)
+ else:
+ logging.error("execution stopped as no breakpoint is set")
+ exit(1)
+
+ self.debugger.clear_breakpoints()
+
+ logging.info("All the steps in the test file are executed successfully"
+ " with the expected result.")