]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
drd, XML: add xsd schema description and a script to verify the DRD XML output agains...
authorBart Van Assche <bvanassche@acm.org>
Thu, 13 Oct 2011 18:16:29 +0000 (18:16 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 13 Oct 2011 18:16:29 +0000 (18:16 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12147

drd/Testing.txt
drd/docs/drd-xml-output.xsd [new file with mode: 0644]
drd/tests/verify-xml-output [new file with mode: 0755]

index d2428e9ac347b6813e74180585bbf8b98f489da9..4581a06efabefa26d661eb3855b63b6675a9c9bf 100644 (file)
@@ -83,3 +83,7 @@ How to test DRD
      drd/scripts/download-and-build-firefox
    Now run the following command:
      LD_LIBRARY_PATH=$HOME/software/mozilla-build/dist/lib: ./vg-in-place --tool=drd --check-stack-var=yes --trace-children=yes --show-confl-seg=no $HOME/software/mozilla-build/dist/bin/firefox-bin
+
+13. Verify that the XML output matches the DRD XML output XSD.
+
+   drd/tests/verify-xml-output
diff --git a/drd/docs/drd-xml-output.xsd b/drd/docs/drd-xml-output.xsd
new file mode 100644 (file)
index 0000000..5c7ae5e
--- /dev/null
@@ -0,0 +1,182 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <!-- Header printed by Valgrind tool as multiple lines of text -->
+  <xs:complexType name="vgPreamble">
+    <xs:sequence>
+      <xs:element name="line" type="xs:string"
+                 minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <!-- Executable path and arguments -->
+  <xs:complexType name="vgExeAndArgs">
+    <xs:sequence>
+      <xs:element name="exe" type="xs:string"/>
+      <xs:element name="arg" type="xs:string"
+                 minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <!-- Valgrind tool and client executable path and arguments -->
+  <xs:complexType name="vgArgs">
+    <xs:sequence>
+      <xs:element name="vargv" type="vgExeAndArgs"/>
+      <xs:element name="argv" type="vgExeAndArgs"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:simpleType name="vgSchedState">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="RUNNING"/>
+      <xs:enumeration value="FINISHED"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <!-- Valgrind scheduler state and time at which a state has been reached -->
+  <xs:complexType name="vgSchedulerStatus">
+    <xs:sequence>
+      <xs:element name="state" type="vgSchedState"/>
+      <xs:element name="time" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <!-- Client call stack -->
+  <xs:complexType name="vgStack">
+    <xs:sequence>
+      <xs:element name="frame" minOccurs="0" maxOccurs="unbounded">
+       <xs:complexType>
+         <xs:sequence>
+           <xs:element name="ip" type="xs:string"/>
+           <xs:element name="obj" type="xs:string" minOccurs="0"/>
+           <xs:element name="fn" type="xs:string" minOccurs="0"/>
+           <xs:element name="dir" type="xs:string" minOccurs="0"/>
+           <xs:element name="file" type="xs:string" minOccurs="0"/>
+           <xs:element name="line" type="xs:string" minOccurs="0"/>
+         </xs:sequence>
+       </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="vgErrorCount">
+    <xs:sequence>
+      <xs:element name="pair" minOccurs="0" maxOccurs="unbounded">
+       <xs:complexType>
+         <xs:sequence>
+           <xs:element name="count" type="xs:integer"/>
+           <xs:element name="unique" type="xs:string"/>
+         </xs:sequence>
+       </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="vgSuppCount">
+    <xs:sequence>
+      <xs:element name="pair" minOccurs="0" maxOccurs="unbounded">
+       <xs:complexType>
+         <xs:sequence>
+           <xs:element name="count" type="xs:integer"/>
+           <xs:element name="name" type="xs:string"/>
+         </xs:sequence>
+       </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:simpleType name="drdErrorKind">
+    <xs:restriction base="xs:string">
+      <xs:enumeration value="ConflictingAccess"/>
+      <xs:enumeration value="MutexErr"/>
+      <xs:enumeration value="CondErr"/>
+      <xs:enumeration value="CondDestrErr"/>
+      <xs:enumeration value="CondRaceErr"/>
+      <xs:enumeration value="CondWaitErr"/>
+      <xs:enumeration value="SemaphoreErr"/>
+      <xs:enumeration value="BarrierErr"/>
+      <xs:enumeration value="RwlockErr"/>
+      <xs:enumeration value="HoldtimeErr"/>
+      <xs:enumeration value="GenericErr"/>
+      <xs:enumeration value="InvalidThreadId"/>
+      <xs:enumeration value="UnimpHgClReq"/>
+      <xs:enumeration value="UnimpDrdClReq"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <!-- Single line of trace information with an optional call stack -->
+  <xs:complexType name="drdTrace">
+    <xs:sequence>
+      <xs:element name="text" type="xs:string"/>
+      <xs:element name="stack" type="vgStack" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <!-- Context information about a DRD error -->
+  <xs:complexType name="drdContext">
+    <xs:sequence>
+      <xs:element name="what" type="xs:string" minOccurs="0"/>
+      <xs:element name="address" type="xs:string" minOccurs="0"/>
+      <xs:element name="stack" type="vgStack"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="drdError">
+    <xs:sequence>
+      <xs:element name="unique" type="xs:string"/>
+      <xs:element name="tid" type="xs:integer"/>
+      <xs:element name="kind" type="drdErrorKind"/>
+      <xs:element name="acquired_at" type="drdContext" minOccurs="0"/>
+      <xs:element name="what" type="xs:string"/>
+      <xs:element name="stack" type="vgStack"/>
+      <xs:element name="auxwhat" type="xs:string" minOccurs="0"/>
+      <xs:element name="allocation_context" minOccurs="0"/>
+      <xs:element name="confl_wait_call" type="drdContext"
+                 minOccurs="0"/>
+      <xs:element name="first_observed_at" type="drdContext"
+                 minOccurs="0" maxOccurs="3"/>
+      <xs:element name="xauxwhat" minOccurs="0">
+       <xs:complexType>
+         <xs:sequence>
+           <xs:element name="text" type="xs:string"/>
+           <xs:element name="file" type="xs:string"/>
+           <xs:element name="line" type="xs:integer"/>
+         </xs:sequence>
+       </xs:complexType>
+      </xs:element>
+      <xs:element name="other_segment_start" minOccurs="0">
+       <xs:complexType>
+         <xs:sequence>
+           <xs:element name="stack" type="vgStack" minOccurs="0"/>
+         </xs:sequence>
+       </xs:complexType>
+      </xs:element>
+      <xs:element name="other_segment_end" minOccurs="0">
+       <xs:complexType>
+         <xs:sequence>
+           <xs:element name="stack" type="vgStack" minOccurs="0"/>
+         </xs:sequence>
+       </xs:complexType>
+      </xs:element>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:element name="valgrindoutput">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded">
+       <xs:element name="protocolversion" type="xs:string"/>
+       <xs:element name="protocoltool" type="xs:string"/>
+       <xs:element name="preamble" type="vgPreamble"/>
+       <xs:element name="pid" type="xs:string"/>
+       <xs:element name="ppid" type="xs:string"/>
+       <xs:element name="tool" type="xs:string"/>
+       <xs:element name="args" type="vgArgs"/>
+       <xs:element name="trace" type="drdTrace"/>
+       <xs:element name="error" type="drdError"
+                   minOccurs="0" maxOccurs="unbounded"/>
+       <xs:element name="status" type="vgSchedulerStatus"/>
+       <xs:element name="errorcounts" type="vgErrorCount"/>
+       <xs:element name="suppcounts" type="vgSuppCount" minOccurs="0"/>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/drd/tests/verify-xml-output b/drd/tests/verify-xml-output
new file mode 100755 (executable)
index 0000000..e0df6f8
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+cd "$(dirname $0)" || exit $?
+for f in *.vgtest
+do
+  b="${f%.vgtest}"
+  if [ ${b%_xml} != $b ]; then
+    continue
+  fi
+  echo === $b
+  prereq="$(sed -n 's/^prereq: //p' $f)"
+  if [ "$prereq" = "" ]; then
+    prereq="true"
+  fi
+  prog="$(sed -n 's/^prog: //p' $f)"
+  args="$(sed -n 's/^args: //p' $f)"
+  vgopts="$(sed -n 's/^vgopts: //p' $f)"
+  if eval $prereq; then
+    ../../vg-in-place --tool=drd --xml=yes --xml-file=$b.xml $vgopts ./$prog $args
+    xmllint --noout --schema ../docs/drd-xml-output.xsd $b.xml 2>&1 | tee $b.xmllint
+  fi
+done