Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

debug: Add first cut to call "compliance" tests #157

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mwachs5
Copy link
Contributor

@mwachs5 mwachs5 commented Sep 4, 2018

There are now two commands in OpenOCD that do some coarse sanity checks on the Debug Module implementation. This adds them to the riscv-tests/debug suite so they can be run on more targets.

There are a few known issues with the compliance tests that these are currently working around, but they also cause some sort of problem on 64-bit spike implementation which I have not yet root-caused. Going to run the riscv-tools regression to see the current set of failing and passing tests.

@mwachs5
Copy link
Contributor Author

mwachs5 commented Sep 4, 2018

Problem with Compliance Test + Spike (writing all 1's to DMCONTROL register causes "unexpected" reset):

./gdbserver.py targets/RISC-V/spike32-2-rtos.py ComplianceTest

causes:

PASSED test 3 (DMCONTROL.hartreset can be 0 or RW.)

PASSED test 4 (Regular calls must return ERROR_OK)

PASSED test 5 (Regular calls must return ERROR_OK)

PASSED test 6 (Regular calls must return ERROR_OK)

PASSED test 7 (DMCONTROL.hasel can be 0 or RW.)

Hart 0 unexpectedly reset!
Hart 0 is already halted!
PASSED test 8 (Regular calls must return ERROR_OK)

PASSED test 9 (Regular calls must return ERROR_OK)

failed write (NOP) at 0x11, status=2
FAILED test 10 (Regular calls must return ERROR_OK)

def test(self):
output = self.gdb.command("monitor riscv test_compliance")
#TODO: Fix OpenOCD to remove the -rtos riscv requirement
assert(("ALL TESTS PASSED") in output or ("Please run with -rtos riscv to run compliance test.") in output)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nicer to do something like:

if "Please run with -rtos riscv to run compliance test." in output:
   return
assertIn("ALL TESTS PASSED", output)

which results in a slightly nicer error message if the tests didn't pass.

result = self.gdb.command("monitor riscv dmi_read 0x38")
if (int(result, base=16) == 0):
return 'not_applicable'

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make sure make pylint is happy before merging?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, but can we add pylint check to the regression (because otherwise you assume I know how to run pylint...)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pylint checks differ slightly between versions. I didn't put it in the regression to avoid the case where it works fine for a developer, but then fails a regression. The how-to-run pylint issue is why there's a make pylint target.

return 'not_applicable'

self.gdb.command("monitor riscv set_prefer_sba on")
command = "monitor riscv test_sba_config_reg 0x%08x %d 0x%08x off" % (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When I run this test I get:

(gdb) monitor riscv test_sba_config_reg 0x1212340000 100 0x121233fffc off
invalid subcommand "test_sba_config_reg 0x1212340000 100 0x121233fffc off"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and you're using latest OpenOCD?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I had the latest source, but hadn't rebuilt. Now the command starts correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants