4a71035e4f3977ea49794450d373db3af26eac4f
3 """Test that OpenOCD can talk to a RISC-V target."""
10 from testlib
import assertRegexpMatches
12 class OpenOcdTest(testlib
.BaseTest
):
13 def __init__(self
, target
):
14 testlib
.BaseTest
.__init
__(self
, target
)
17 def early_applicable(self
):
18 return self
.target
.openocd_config
21 # pylint: disable=attribute-defined-outside-init
22 self
.cli
= testlib
.OpenocdCli()
24 class RegTest(OpenOcdTest
):
26 self
.cli
.command("halt")
27 output
= self
.cli
.command("reg")
28 assertRegexpMatches(output
, r
"x18 \(/%d\): 0x[0-9A-F]+" %
32 parser
= argparse
.ArgumentParser(
33 description
="Test that OpenOCD can talk to a RISC-V target.")
34 targets
.add_target_options(parser
)
35 testlib
.add_test_run_options(parser
)
37 parsed
= parser
.parse_args()
39 target
= parsed
.target(parsed
.cmd
, parsed
.run
, parsed
.isolate
)
41 target
.xlen
= parsed
.xlen
43 module
= sys
.modules
[__name__
]
45 return testlib
.run_all_tests(module
, target
, parsed
.test
, parsed
.fail_fast
)
47 if __name__
== '__main__':