6 Copyright (C) 2009-2010 8 RT-Synthesis Research Group 9 Intelligent Systems Research Institute, 10 National Institute of Advanced Industrial Science and Technology (AIST), 13 Licensed under the Eclipse Public License -v 1.0 (EPL) 14 http://www.opensource.org/licenses/eclipse-1.0.txt 22 __version__ =
'$Revision: $' 30 from traceback
import print_exc
35 '''This test loads a given XML or YAML file (type determined by the extension) 36 into an RtsProfile object. The object is printed to a string, which is stored. 38 It then attempts to save the object using the XML output. This output is loaded 39 back in, printed to a string, and that string compared to the original. They 42 This save-load-check process is then repeated for the YAML output. 47 type = os.path.splitext(input_name)[1][1:]
54 print >>sys.stderr,
'Unknown input type: {0}'.format(type)
57 orig_prof_str = str(orig_prof)
58 print 'Loaded original.' 66 xml_output = orig_prof.save_to_xml()
70 xml_prof_str = str(xml_prof)
77 if xml_prof_str != orig_prof_str:
78 print 'XML profile does not equal original profile.' 81 print >>sys.stderr,
'XML test failed.' 82 f = open(
'original_prof.dump',
'w')
83 f.write(orig_prof_str)
85 f = open(
'xml_prof.dump',
'w')
88 f = open(
'xml_raw.dump',
'w')
98 yaml_output = orig_prof.save_to_yaml()
99 print 'Saved as YAML.' 102 yaml_prof_str = str(yaml_prof)
103 print 'Printed YAML.' 109 if yaml_prof_str != orig_prof_str:
110 print 'YAML profile does not equal original profile.' 113 print >>sys.stderr,
'YAML test failed.' 114 f = open(
'original_prof.dump',
'w')
115 f.write(orig_prof_str)
117 f = open(
'yaml_prof.dump',
'w')
118 f.write(yaml_prof_str)
120 f = open(
'yaml_raw.dump',
'w')
125 print >>sys.stderr,
'Tests passed.' 129 if __name__ ==
'__main__':
130 sys.exit(
main(sys.argv))