regression/cbmc/array-constraint/test_json: un-KNOWNBUG, fix expectations#9018
Open
tautschnig wants to merge 1 commit into
Open
regression/cbmc/array-constraint/test_json: un-KNOWNBUG, fix expectations#9018tautschnig wants to merge 1 commit into
tautschnig wants to merge 1 commit into
Conversation
…ions test_json.desc was added as KNOWNBUG in 2020 (commit ecb0a5d) asserting an aspirational JSON shape that cbmc never produced. Two flaws: 1. The exit code assertion '^EXIT=0$' did not match cbmc's actual exit. main.c contains 'assert(a[index] == 1)' with a non-deterministic 'index', which fails verification — cbmc exits with 10. (The two sibling tests, test.desc and test_xml.desc, exercise '--show-array- constraints' without '--json-ui' / with '--xml-ui'; cbmc rejects those combinations and exits 1, which they correctly assert.) 2. The regex asserted list-shaped JSON values, e.g. '"arrayWith": [.*]', but the implementation has always emitted scalar counts: '"arrayWith": 2'. The test was therefore unmatchable on day one. Fix both: assert '^EXIT=10$' and rewrite the regex to match scalar counts ('\\d+'). Drop the KNOWNBUG tag so the JSON contract for '--show-array-constraints' is now pinned by an actually-running test. The test only applies to the default SAT backend: under '--cprover-smt2' or '--incremental-smt2-solver z3' cbmc bypasses the array theory entirely and emits no 'arrayConstraints' JSON block (and '--cprover-smt2' returns a different exit code). Tag the test 'broken-cprover-smt-backend no-new-smt' so it is skipped under those profiles, matching the convention used by other arrayst-dependent tests such as Array_operations2 / Bitfields1 / Computed-Goto1. Co-authored-by: Kiro <kiro-agent@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR corrects the array-constraint JSON regression test so it matches CBMC’s actual behavior and can run as a normal CORE test (instead of an unmatchable KNOWNBUG), while being skipped under SMT-backend profiles where the output/exit code differs.
Changes:
- Remove
KNOWNBUGand add solver-profile skip tags (broken-cprover-smt-backend,broken-z3-smt-backend,no-new-smt). - Update expected exit code from
0to10(verification failure). - Fix the expected JSON shape to match scalar counts (e.g.,
"arrayWith": \d+) instead of list values.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #9018 +/- ##
===========================================
+ Coverage 80.59% 80.61% +0.01%
===========================================
Files 1711 1711
Lines 189454 189454
Branches 73 73
===========================================
+ Hits 152694 152727 +33
+ Misses 36760 36727 -33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test_json.desc was added as KNOWNBUG in 2020 (commit ecb0a5d) asserting an aspirational JSON shape that cbmc never produced. Two flaws:
The exit code assertion '^EXIT=0$' did not match cbmc's actual exit. main.c contains 'assert(a[index] == 1)' with a non-deterministic 'index', which fails verification — cbmc exits with 10. (The two sibling tests, test.desc and test_xml.desc, exercise '--show-array- constraints' without '--json-ui' / with '--xml-ui'; cbmc rejects those combinations and exits 1, which they correctly assert.)
The regex asserted list-shaped JSON values, e.g. '"arrayWith": [.*]', but the implementation has always emitted scalar counts: '"arrayWith": 2'. The test was therefore unmatchable on day one.
Fix both: assert '^EXIT=10$' and rewrite the regex to match scalar counts ('\d+'). Drop the KNOWNBUG tag so the JSON contract for '--show-array-constraints' is now pinned by an actually-running test.
The test only applies to the default SAT backend: under '--cprover-smt2' or '--incremental-smt2-solver z3' cbmc bypasses the array theory entirely and emits no 'arrayConstraints' JSON block (and '--cprover-smt2' returns a different exit code). Tag the test 'broken-cprover-smt-backend no-new-smt' so it is skipped under those profiles, matching the convention used by other arrayst-dependent tests such as Array_operations2 / Bitfields1 / Computed-Goto1.