Added cmake support & assertive comparison tester#35
Conversation
Earlier work fell behind develop, so existing work has been reworked to match the emerging style and direction of the repository. In _build(...), specifying `cmake` now changes behaviour; a key assumption is that CMakeLists.txt exists in a superdirectory of the xe_path, and that directory also holds /bin/. do_run_pyxsim now supports plugins of class XsiPlugin. pyxsim.py is now guarded against XCC_EXEC_PREFIXes that do not end in / AssertiveComparisonTester has been added; this is used in essentially the same way as ComparisonTester, but uses asserts rather than writing errors to stdout. Should be more useful for pytest-based frameworks. Personal opinion is that it's also more readable but that's by the by.
| p.join(timeout=timeout) | ||
| if p.is_alive(): | ||
| assert 0 | ||
| assert 0 # Why is this here? Following two lines become unreachable |
There was a problem hiding this comment.
This needs removing. Accidental commit.
| xsi.register_simthread(x) | ||
| if plugins: | ||
| for plugin in plugins: | ||
| xsi.register_plugin(plugin) |
There was a problem hiding this comment.
I'd just be using plugins via sim args, do we need to support plugin args?
There was a problem hiding this comment.
So XsiPlugin is a class that's defined, see e.g. pyxsim.py, line 454, where an XsiLoopbackPlugin is defined that seems to replicate the Loopback plugin in xsim. This was the last piece needed to actually use it, although whether it needs to exist at all is a good question.
In /theory/ you could define Pyxsim plugins that are clocked alongside simthreads, although in practice why you would choose to make an XsiPlugin rather than a SimThread escapes me (see e.g. the Clock class in lib_i2s/i2s_master_checker.py) - they seem like they're doing the same thing, but plugins are always clocked rather than simthreads which are waited upon.
There was a problem hiding this comment.
Ah yes, only just noticed this. I must say not sure I understand the utility of this given this whole framework is essentially for creating plugin functionality..
xross
left a comment
There was a problem hiding this comment.
Approved. But I think we should remove that erroneous asset and comment.
|
Answer, to the question - yes probably. I recently reinstalled run_on_simulator as main point of entry and probably didn't do a full job. Making people call build did not seem okay (the fact its a "" for one..) |
|
Using the ComparisonChecking returning a bool just means the assert happens "further up" the code. You only want to calculate coverage etc on passing tests and checking a bool rather an catching an assert feels nicer but personal preference really (but arguably less "pythonic") |
agreed, although do we only want to calculate coverage on passing tests? I always understood coverage to mean "how much of your codebase is exercised", not necessarily "how much of your codebase meets requirements"
also agreed - will add that in this PR then |
Earlier work fell behind develop, so existing work has been reworked to match
the emerging style and direction of the repository.
In _build(...), specifying
cmakenow changes behaviour; akey assumption is that CMakeLists.txt exists
in a superdirectory of the xe_path, and that directory also holds /bin/.
do_run_pyxsim now supports plugins of class XsiPlugin.
pyxsim.py is now guarded against XCC_EXEC_PREFIXes that do not end in /
AssertiveComparisonTester has been added;
this is used in essentially the same way as ComparisonTester, but
uses asserts rather than writing errors to stdout.
Should be more useful for pytest-based frameworks.
Personal opinion is that it's also more readable but that's by the by.
QUESTIONS: