Skip to content

Xml description addition #6237

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/assets/xml_spec.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
<xs:sequence>
<xs:element ref="goto_trace" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="description" type="xs:string"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one should also be merged with the code change.

<xs:attribute name="property" type="xs:string"/>
<xs:attribute name="status" type="xs:string"/>
</xs:complexType>
Expand Down
36 changes: 36 additions & 0 deletions regression/cbmc/ACSL/fail-operators.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
void boolean()
{
__CPROVER_bool a, b;
__CPROVER_assert(!(a ≡ b) == (a == b), "≥");
__CPROVER_assert(!(a ≢ b) == (a != b), "≢");
__CPROVER_assert(!(a ⇒ b) == (!a || b), "⇒");
Copy link
Contributor

Choose a reason for hiding this comment

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

These looked a bit suspicious to me, but it looks like the C Compiler (or at least, GCC does) determines file encoding from reading the file, defaulting to either ASCII or UTF-8, and we are using ifstream to read files, which has its encoding information set through std::locale, so it looks like this should work.

__CPROVER_assert(!(a ⇔ b) == (a == b), "⇔");
__CPROVER_assert(!(a ∧ b) == (a && b), "∧");
__CPROVER_assert(!(a ∨ b) == (a || b), "∨");
__CPROVER_assert(!(a ⊻ b) == (a != b), "⊻");
__CPROVER_assert(!(¬ a) == (!a), "¬");
}

void relations()
{
int a, b;
__CPROVER_assert(!(a ≥ b) == (a >= b), "≥");
__CPROVER_assert(!(a ≤ b) == (a <= b), "≤");
__CPROVER_assert(!(a ≡ b) == (a == b), "≥");
__CPROVER_assert(!(a ≢ b) == (a != b), "≢");
__CPROVER_assert(!(− a) == (-a), "−");
}

void quantifiers()
{
__CPROVER_assert(!(∀ int i; 1) == 1, "∀");
__CPROVER_assert(!(∃ int i; 1) == 1, "∃");
__CPROVER_assert(!(\lambda int i; i + 1)(1) == 2, "lambda");
}

int main()
{
boolean();
relations();
quantifiers();
}
12 changes: 12 additions & 0 deletions regression/cbmc/ACSL/fail-operators.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
KNOWNBUG
fail-operators.c --trace

^EXIT=0$
^SIGNAL=0$
^VERIFICATION FAILURE$
--
^VERIFICATION SUCCESSFUL$
--
This is to test printing of special operator characters in traces.
The verification should fail. Note that this is a bug for normal
and XML output, but not JSON.
Comment on lines +11 to +12
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's not really clear to me what is failing here: is the actual verification outcome wrong just because of special characters?! Or is there just some issue with the output?

4 changes: 2 additions & 2 deletions regression/cbmc/xml-interface1/test.desc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ CORE
^EXIT=10$
^SIGNAL=0$
Not unwinding loop foo\.0 iteration 3 file main\.c line 5 function foo thread 0
<result property="foo\.assertion\.3" status="SUCCESS"/>
<result property="foo\.assertion\.1" status="FAILURE">
<result description="assertion 0" property="foo\.assertion\.3" status="SUCCESS"/>
<result description="assertion 0" property="foo\.assertion\.1" status="FAILURE">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit pick: I'd prefer for this commit to be merged with prior commit that causes this test to break. Just makes any future bisecting easier.

<goto_trace>
VERIFICATION FAILED
--
Expand Down
5 changes: 4 additions & 1 deletion regression/validate-trace-xml-schema/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
# the SAT back-end only
['integer-assignments1', 'test.desc'],
# this test is expected to abort, thus producing invalid XML
['String_Abstraction17', 'test.desc']
['String_Abstraction17', 'test.desc'],
# these tests use characters that cannot be displayed in XML
['ACSL', 'operators.desc'],
Copy link
Contributor

Choose a reason for hiding this comment

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

🚫 If the changes cause output to include more characters that are invalid XML then they should not be merged. The correct thing to do would be to escape these characters.

Copy link
Contributor

Choose a reason for hiding this comment

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

For details of how escaping works in XML see - https://www.w3.org/TR/REC-xml/#syntax
I think the code for this escaping exists already. See xmlt::escape_attribute in src/util/xml.cpp.

Copy link
Collaborator

Choose a reason for hiding this comment

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

☝️ What he said. Let's not generate invalid XML.

['ACSL', 'quantifier-precedence.desc']
]))

# TODO maybe consider looking them up on PATH, but direct paths are
Expand Down
1 change: 1 addition & 0 deletions src/goto-checker/properties.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ xmlt xml(const irep_idt &property_id, const property_infot &property_info)
xmlt xml_result("result");
xml_result.set_attribute("property", id2string(property_id));
xml_result.set_attribute("status", as_string(property_info.status));
xml_result.set_attribute("description", as_string(property_info.description));
return xml_result;
}

Expand Down