(self, template_path, output_path)
| 848 | yield l |
| 849 | |
| 850 | def to_cdash_xml(self, template_path, output_path): |
| 851 | |
| 852 | if template_path.endswith("Test.xml"): |
| 853 | body_start = "<Testing>" |
| 854 | elif template_path.endswith("Build.xml"): |
| 855 | body_start = "<Build>" |
| 856 | else: |
| 857 | raise Exception("Unsupported template name %s" % template_path) |
| 858 | xml_output = [] |
| 859 | # load template head (everything up to "<Testing>") |
| 860 | # -> this assumes a specific format of the xml |
| 861 | with open(template_path) as f: |
| 862 | for line in f: |
| 863 | if line.strip() == body_start: |
| 864 | break |
| 865 | xml_output.append(line) |
| 866 | |
| 867 | """ |
| 868 | # load template head |
| 869 | $template = file($ctestReportingPath."/Test.xml"); |
| 870 | $newTestFile = array(); |
| 871 | foreach ($template as $line) |
| 872 | { |
| 873 | array_push($newTestFile, $line); |
| 874 | if (trim($line) == "<Testing>") |
| 875 | { |
| 876 | break; |
| 877 | } |
| 878 | } |
| 879 | """ |
| 880 | |
| 881 | # Start writing the xml |
| 882 | xml_output.append(" <Testing>\n") |
| 883 | xml_output.append(" <StartDateTime>%s</StartDateTime>\n" % (time.strftime('%b %d %H:%M') ) ) |
| 884 | xml_output.append(" <StartTestTime>%s</StartTestTime>\n" % (time.time()) ) |
| 885 | xml_output.append(" <TestList>\n") |
| 886 | for classtestresults in self: |
| 887 | for tres in classtestresults: |
| 888 | xml_output.append(" <Test>%s</Test>\n" % xml_escape(tres.getXMLName() ) ) |
| 889 | xml_output.append(" </TestList>\n") |
| 890 | |
| 891 | for classtestresults in self: |
| 892 | for tres in classtestresults: |
| 893 | status = "" |
| 894 | if tres.isPassed(): |
| 895 | status = "passed" |
| 896 | else: |
| 897 | status = "failed" |
| 898 | |
| 899 | xml_output.append(" " * 2 + '<Test Status="%s">\n' % status) |
| 900 | xml_output.append(" " * 4 + '<Name>%s</Name>\n' % xml_escape(tres.getXMLName() ) ) |
| 901 | xml_output.append(" " * 4 + '<Path> ./tools/ </Path>\n' ) |
| 902 | xml_output.append(" " * 4 + '<FullName>%s</FullName>\n' % xml_escape(tres.name) ) |
| 903 | xml_output.append(" " * 4 + '<FullCommandLine>python PythonExtensionChecker.py %s</FullCommandLine>\n' % xml_escape(tres.name) ) |
| 904 | xml_output.append(" " * 4 + '<Results>') |
| 905 | xml_output.append(""" |
| 906 | <NamedMeasurement type="numeric/double" name="Execution Time"><Value>0.001</Value></NamedMeasurement> |
| 907 | <NamedMeasurement type="text/string" name="Completion Status"><Value>Completed</Value></NamedMeasurement> |
no test coverage detected