Skip to content

Add checks for symbol well-formedness. #3193

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

Merged
merged 1 commit into from
Dec 18, 2018

Conversation

NlightNFotis
Copy link
Contributor

@NlightNFotis NlightNFotis commented Oct 17, 2018

Add a well-formedness check method to the symbol class, and add it as an extra criterion to the
soundness of a symbol table that every symbol is well-formed.

  • Each commit message has a non-empty body, explaining why the change was made.
  • Methods or procedures I have added are documented, following the guidelines provided in CODING_STANDARD.md.
  • Regression or unit tests are included, or existing tests cover the modified code (in this case I have detailed which ones those are in the commit message).
  • n/a My commit message includes data points confirming performance improvements (if claimed).
  • My PR is restricted to a single feature or bugfix.
  • White-space or formatting changes outside the feature-related changed lines are in commits of their own.

}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline

}

return true;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing newline

@NlightNFotis NlightNFotis force-pushed the symbol-well-formedness branch from 30e7adc to 6754dbe Compare October 19, 2018 10:21
Copy link
Collaborator

@martin-cs martin-cs left a comment

Choose a reason for hiding this comment

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

[ Approval for the last commit only. ]
Seems reasonable.

Copy link
Contributor

@danpoe danpoe left a comment

Choose a reason for hiding this comment

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

LGTM

tautschnig added a commit that referenced this pull request Nov 9, 2018
Skeleton for well-formedness checking of goto models [blocks: #3118, #3147, #3188, #3191, #3187, #3193]
@NlightNFotis NlightNFotis force-pushed the symbol-well-formedness branch 3 times, most recently from 86b6c4d to be2492a Compare November 12, 2018 14:45
@NlightNFotis
Copy link
Contributor Author

There was a problem with the introduction of this set of changes that made the unit tests in unit/util/symbol_table.cpp to fail. The change introduced is that this introduces the well-formedness checks for the individual symbols, which are getting invoked by symbol_tablet::validate(). Because the symbol constructed by hand in unit/util/symbol_table.cpp doesn't pass the well-formedness criteria, the test failed because it tested validate(), which called symbol.is_well_formed() on the symbol.

Copy link
Contributor

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: cf34d42).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/91854745


WHEN("The symbol doesn't have base name as a suffix to name")
{
symbol.name = "TEST";
Copy link
Contributor

Choose a reason for hiding this comment

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

That will fail due to a non-empty mode, which isn't what you intend to test.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, you were right. I fixed this now.

@@ -35,10 +35,11 @@ SCENARIO(
symbol_tablet symbol_table;

symbolt symbol;
irep_idt symbol_name = "Test";
irep_idt symbol_name = "Test_TestBase";
Copy link
Contributor

Choose a reason for hiding this comment

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

Given this test doesn't check symbol.is_well_formed(), it's a little surprising to see this check happening at the same time.

Copy link
Contributor Author

@NlightNFotis NlightNFotis Dec 14, 2018

Choose a reason for hiding this comment

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

This is because this was a test for something related added by @chrisr-diffblue but went in first, so my change had now broken this test, so I had to edit this test to conform to what the validity checks expected, and make it pass again.

@NlightNFotis
Copy link
Contributor Author

@smowton Addressed your latest comments. Can you re-review now please?

Copy link
Contributor

@smowton smowton left a comment

Choose a reason for hiding this comment

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

CI looks actually broken, but the code LGTM

@NlightNFotis NlightNFotis force-pushed the symbol-well-formedness branch 2 times, most recently from 91919ae to 5c1319d Compare December 17, 2018 16:11
Add a method that checks a symbol for structural validity
according to some predetermined rule, and add it as an
extra rule for symbol-table validity that each symbol is
well-formed.
@NlightNFotis NlightNFotis force-pushed the symbol-well-formedness branch from 5c1319d to df616e4 Compare December 18, 2018 15:45
@NlightNFotis NlightNFotis merged commit 94ebd97 into diffblue:develop Dec 18, 2018
Copy link
Contributor

@allredj allredj left a comment

Choose a reason for hiding this comment

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

✔️
Passed Diffblue compatibility checks (cbmc commit: df616e4).
Build URL: https://travis-ci.com/diffblue/test-gen/builds/95145472

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.

10 participants