-
Notifications
You must be signed in to change notification settings - Fork 277
Add validation tests for trace XSD #5278
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
Add validation tests for trace XSD #5278
Conversation
7bf9de6
to
cebeb28
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but cannot comment on the gradle build files and the .bat files.
Codecov Report
@@ Coverage Diff @@
## develop #5278 +/- ##
===========================================
+ Coverage 67.95% 68.04% +0.09%
===========================================
Files 1170 1170
Lines 96362 96362
===========================================
+ Hits 65478 65571 +93
+ Misses 30884 30791 -93
Continue to review full report at Codecov.
|
2a610b1
to
8e6c02d
Compare
cc77b55
to
063eaec
Compare
@@ -0,0 +1,5 @@ | |||
distributionBase=GRADLE_USER_HOME |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything in the gradle
directory as well as the gradlew
and gradlew.bat
scripts are autogenerated by gradle so the build can work without a user having to have a compatible gradle version locally. So they're meant to be here, but shouldn't be reviewed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems good - some naming stuff in the python file I'd really like to see tidied up. Also, I sadly must insist on some tests for the program than runs the validation.
regression/Makefile
Outdated
@@ -2,35 +2,36 @@ | |||
# running tests in parallel, it is important that these directories are | |||
# listed with decreasing runtimes (i.e. longest running at the top) | |||
DIRS = cbmc \ | |||
cbmc-library \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ I assume this is just a reordering of the Makefile? If it is, it'd be best pulled out into its own commit so can be clearly stated as such
PROPERTIES | ||
LABELS "CBMC;CORE") | ||
else() | ||
message(WARNING "JDK not found, skipping trace schema tests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ This stops the tests being configured? I wonder if we should configure a test that always fails? That way, if someone configures it locally, they don't need JDK, but if CI fails on this step, it doesn't silently pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not all our CI passes have both Java and Python 3 available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'd rather we explicitly skip this test on the jobs that don't have the requirements.
python_minor_version=$(python3 --version | cut -d ' ' -f 2 | cut -d '.' -f 2) | ||
|
||
if [ $python_minor_version -lt 5 ]; then | ||
echo "python version less than 3.5, skipping XSD tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 I think I would exit with a non-zero exit code here, to prevent silent failures on CI 👻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not supposed to fail CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm suggesting is it should fail CI (and the CIs where this doesn't work, we disable it in the configuration file). Currently if a config breaks in a way that means we have the wrong version of python, this test will just be disabled and we'll never know.
|
||
if ! command -v javac > /dev/null; then | ||
echo "javac not found, skipping XSD tests" | ||
exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👻
|
||
if [ $javac_major_version -eq 1 ] || [ $javac_minor_version -ge 8 ]; then | ||
echo "JDK version less than 8, skipping XSD tests" | ||
exit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👻
class TestSpec: | ||
def __init__(self, args, is_knownbug, is_future, is_thorough): | ||
self.args = args | ||
self.is_knownbug = is_knownbug | ||
self.is_future = is_future | ||
self.is_thorough = is_thorough |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we've written a .desc
python parser before (possibly for test-gen) 💡 Pull out that into a separate python module so that it may be reused
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For reference, we [did](https://github.com/diffblue/cover/blob/develop/test-gen/regression/common.py#L50 🔒), but not trivial to unify these two at the moment.
|
||
def read_spec(self, spec_path): | ||
with open(spec_path) as spec_file: | ||
spec = spec_file.readline().split() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 I guess I would use the word test_kind
rather than spec, which has 3 means in this file:
- the XSD specificaiton
- the entire .desc file
- The first line of the desc file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to see this addressed, as I keep thinking is_knownbug = 'KNOWNBUG' in spec
is a bug, since KNOWNBUG might appear elsewhere in the spec, except here spec
is just the first line.
Where "this" is:
Rename spec
to spec_kind
since spec
makes it seem like it is the whole contents of the desc
file.
I've checked the test appears in the output for one job, but just to be safe, could you break the output trace to ensure the CI fails (e.g. just change one of the fields or something so is nonsense, ideally one that doesn't cause any other tests to fail) (maybe add a field?) |
88287c5
to
77e41e5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One remaining blocking comment (answering my question about the test you've labelled as failing locally).
I also strongly believe scripts that we run in CI should silently fail (e.g. when python not installed)
|
||
# some tests in the cbmc suite don't work for the trace checks for one reason or another | ||
ExcludedTests = list(map(lambda s: os.path.join(test_base_dir, s), [ | ||
# these tests except input from stdin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expect? accept? I don't think you mean except here though
⛏️ This seems outstanding
# this one doesn't work for me locally at all | ||
# 'integer-assignments1/test.desc', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh? You mean the test fails locally? Perhaps we could raise an issue to look into that?
❓ outstanding, this needs to be addressed IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be explicit about what needs addressing:
- shouldn't check in "me" since no way of knowing who "me" is as soon as this line gets moved.
Further, I'd like to understand what you mean "doesn't work locally at all" means!
python_minor_version=$(python3 --version | cut -d ' ' -f 2 | cut -d '.' -f 2) | ||
|
||
if [ $python_minor_version -lt 5 ]; then | ||
echo "python version less than 3.5, skipping XSD tests" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm suggesting is it should fail CI (and the CIs where this doesn't work, we disable it in the configuration file). Currently if a config breaks in a way that means we have the wrong version of python, this test will just be disabled and we'll never know.
|
||
def read_spec(self, spec_path): | ||
with open(spec_path) as spec_file: | ||
spec = spec_file.readline().split() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would like to see this addressed, as I keep thinking is_knownbug = 'KNOWNBUG' in spec
is a bug, since KNOWNBUG might appear elsewhere in the spec, except here spec
is just the first line.
Where "this" is:
Rename spec
to spec_kind
since spec
makes it seem like it is the whole contents of the desc
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I give up on trying to get the CI to fail without dependencies:
- for make builds on windows, can't get all the dependencies, and
make test
doesn't offer the opportunity to filter out tests AFAICT - for cmake builds, though you can filter out the tests, the info about what dependency gets lost which makes it a pain to debug, so I'll leave it
I'll raise a separate PR addressing my other comments, since I've fixed them, but let's get this in first (needs a rebase which is probably easier for you to do?
18ca4aa
to
ffd35ff
Compare
We have a XSD for cbmc --trace --xml-ui in our documentation, this adds a new test run which essentially validates the XML output of all tests in regression/cbmc against that XSD. Not all tests in there actually produce traces, but most do so we just exclude the few that don't.
ffd35ff
to
cd578d9
Compare
We have a XSD for cbmc --trace --xml-ui in our documentation, this adds
a new test run which essentially validates the XML output of all tests
in regression/cbmc against that XSD. Not all tests in there actually
produce traces, but most do so we just exclude the few that don't.