diff options
author | Richard J. Knight <rjknight@us.ibm.com> | 2013-07-19 09:55:30 -0500 |
---|---|---|
committer | A. Patrick Williams III <iawillia@us.ibm.com> | 2013-07-30 16:12:03 -0500 |
commit | 5168d4f925a1bcebf43547a44dd1108977b1c3b7 (patch) | |
tree | 5f8122bf2b9a016bb72e628339a8ddbfdf375110 /src/usr/targeting/common/xmltohb/xmltohb.pl | |
parent | 80ff78be2e9d496e31ce39c6a20eb95eee54a91c (diff) | |
download | talos-hostboot-5168d4f925a1bcebf43547a44dd1108977b1c3b7.tar.gz talos-hostboot-5168d4f925a1bcebf43547a44dd1108977b1c3b7.zip |
SW214677 : FW810: Unknown type is coming for tod clk unit in target dump
Change-Id: I19690e0d2cc974501cf24ff6393a9e386dec51ae
Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/5495
Tested-by: Jenkins Server
Reviewed-by: Brian H. Horton <brianh@linux.ibm.com>
Reviewed-by: Andrea Y. Ma <ayma@us.ibm.com>
Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/usr/targeting/common/xmltohb/xmltohb.pl')
-rwxr-xr-x | src/usr/targeting/common/xmltohb/xmltohb.pl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/usr/targeting/common/xmltohb/xmltohb.pl b/src/usr/targeting/common/xmltohb/xmltohb.pl index 35dfaa235..421af5e4e 100755 --- a/src/usr/targeting/common/xmltohb/xmltohb.pl +++ b/src/usr/targeting/common/xmltohb/xmltohb.pl @@ -184,6 +184,7 @@ if( !($cfgSrcOutputDir =~ "none") ) writeStringImplementationFileHeader($stringImplementationFile); writeStringImplementationFileStrings($attributes,$stringImplementationFile); writeStringImplementationFileFooter($stringImplementationFile); + writeTestEntityPath($attributes); close $stringImplementationFile; open(STRUCTS_HEADER_FILE,">$cfgSrcOutputDir"."attributestructs.H") @@ -958,6 +959,84 @@ VERBATIM } ################################################################################ +# Writes test for toString entity path function +################################################################################ + +sub writeTestEntityPath { + my($attributes) = @_; + + open EP_TEST_FILE, ">", "$cfgSrcOutputDir"."test_ep.H" or die $!; + + print EP_TEST_FILE "#include <attributeenums.H>\n"; + print EP_TEST_FILE "EntityPath l_path;\n"; + print EP_TEST_FILE "const char * name = NULL;\n"; + print(EP_TEST_FILE "const char * test_string = \"Unknown path" . + " type\";\n"); + print EP_TEST_FILE "size_t size = strlen( test_string );\n"; + + foreach my $attribute (@{$attributes->{attribute}}) + { + if(exists $attribute->{simpleType}) + { + my $simpleType = $attribute->{simpleType}; + if(exists $simpleType->{enumeration}) + { + my $enumeration = $simpleType->{enumeration}; + + my $enumerationType = getEnumerationType($attributes, + $enumeration->{id}); + + foreach my $enumerator (@{$enumerationType->{enumerator}}) + { + if( $attribute->{id} eq "TYPE" ) + { + print(EP_TEST_FILE "name = " . + "l_path.pathElementTypeAsString( " . + "TYPE_$enumerator->{name} );\n"); + print EP_TEST_FILE "size = strlen( name );\n"; + + if( $enumerator->{name} eq "LAST_IN_RANGE" ) + { + print(EP_TEST_FILE "if( memcmp( name, " . + "test_string, size ))\n{\n"); + + print(EP_TEST_FILE "TS_FAIL(\"type " . + "attribute TYPE_$enumerator->{name}" . + " - did not return expected error " . + "message. - update entitypath.C\");\n}\n"); + + } + elsif( $enumerator->{name} eq "TEST_FAIL" ) + { + #TEST_FAIL is not defined in the function + #pathElementTypeAsString - validate error string + print(EP_TEST_FILE "if( memcmp( name, " . + "test_string, size ))\n{\n"); + + print(EP_TEST_FILE "TS_FAIL(\"type " . + "attribute TYPE_$enumerator->{name}" . + " - did not return expected error " . + "message. - update entitypath.C\");\n}\n"); + } + else + { + print(EP_TEST_FILE "if( !memcmp( name, " . + "test_string, size ))\n{\n"); + + print(EP_TEST_FILE "TS_FAIL(\"undefined TYPE " . + "attribute TYPE_$enumerator->{name}" . + " - update entitypath.C\");\n}\n"); + } + } + } + } + } + } +close EP_TEST_FILE; +} + + +################################################################################ # Writes string implementation ################################################################################ |