diff options
author | Lars Thorsen <[email protected]> | 2011-04-26 14:54:24 +0200 |
---|---|---|
committer | Lars Thorsen <[email protected]> | 2011-05-10 09:13:24 +0200 |
commit | f721fb91140cb09b63b2563e61585ea2a272761c (patch) | |
tree | 113d815fb6cadbccce7751039c67024c3910c1dd /lib/xmerl | |
parent | 111410b7809269d8dec37722d6723d250c412cda (diff) | |
download | otp-f721fb91140cb09b63b2563e61585ea2a272761c.tar.gz otp-f721fb91140cb09b63b2563e61585ea2a272761c.tar.bz2 otp-f721fb91140cb09b63b2563e61585ea2a272761c.zip |
Added the xmerl test suites.
Diffstat (limited to 'lib/xmerl')
12 files changed, 507 insertions, 144 deletions
diff --git a/lib/xmerl/src/xmerl_sax_parser.erl b/lib/xmerl/src/xmerl_sax_parser.erl index eb9f8deec6..c1acf51b8a 100644 --- a/lib/xmerl/src/xmerl_sax_parser.erl +++ b/lib/xmerl/src/xmerl_sax_parser.erl @@ -278,6 +278,7 @@ detect_charset_1(Xml, State) -> convert_encoding(Enc) -> %% Just for 7,8 bit + utf8 case string:to_lower(Enc) of "utf-8" -> utf8; + "us-ascii" -> utf8; "iso-8859-1" -> latin1; % Handle all iso-8859 as latin1 "iso-8859-2" -> latin1; "iso-8859-3" -> latin1; diff --git a/lib/xmerl/src/xmerl_xsd.erl b/lib/xmerl/src/xmerl_xsd.erl index c0923520c2..bd24db5389 100644 --- a/lib/xmerl/src/xmerl_xsd.erl +++ b/lib/xmerl/src/xmerl_xsd.erl @@ -2420,8 +2420,8 @@ validate_xml(XMLEl=#xmlElement{},SEl=#schema_element{},S) -> %% 2 often check_element_type(XML=[XMLTxt=#xmlText{}|Rest],CM=[CMEl|CMRest],Env, Block,S,Checked) -> - %% XMLTxt ��r det f��rsta av content i element, - %% CMEl ��r den till��tna typen enligt schemat + %% XMLTxt is the first part of the elements content, + %% CMEl is the allowed type according to the schema case is_whitespace(XMLTxt) of true -> %% Ignore XMLEl check_element_type(Rest,CM,Env,Block,S,[XMLTxt|Checked]); @@ -2453,7 +2453,7 @@ check_element_type(XML=[#xmlElement{}|_],[{choice,{CM,Occ}}|_CMRest], check_element_type(XML=[#xmlElement{}|_],[{all,{CM,Occ}}|_CMRest], Env,_Block,S,Checked) -> ?debug("calling choice/6~n",[]), - check_all(XML,CM,Occ,Env,S,Checked,XML); + check_all(XML,CM,Occ,Env,set_num_el(S,0),Checked,XML); %%LTH %% 3 often. CMEL may be ((simpleType | complexType)?, (unique | key | keyref)*)) check_element_type(XML=[XMLEl=#xmlElement{}|_],[CMEl|CMRest],Env, Block,S,Checked) -> @@ -3393,8 +3393,12 @@ qualified_node_set(Paths,[QN|QNs],El,S,Acc) -> end end, {KeySequence,S2} = mapfoldl(Fun,S,Paths), - qualified_node_set(Paths,QNs,El,S2,[flatten(KeySequence)|Acc]). - + case flatten(KeySequence) of + [] -> + qualified_node_set(Paths,QNs,El,S2,Acc); + KS -> + qualified_node_set(Paths,QNs,El,S2,[KS|Acc]) + end. apply_field(F,El,S) -> %% xmerl_xpath:string returns a list diff --git a/lib/xmerl/test/ReadMe b/lib/xmerl/test/ReadMe new file mode 100644 index 0000000000..effcff6fc4 --- /dev/null +++ b/lib/xmerl/test/ReadMe @@ -0,0 +1,24 @@ + +W3C conformance tests +===================== + +The xmerl tests contains a large number of conformance tests from W3C, which are located in the following +directories. + +xmerl_std_SUITE_data: + These tests are fetched from http://www.w3.org/XML/Test/ and repackaged as four tgz files. + The W3C Copyright notice is located in the file xmerl_std_SUITE_data/w3c-copyright-19980720.html. + +xmerl_xsd_MS2002-01-16_SUITE_data: + These tests are fetched from http://www.w3.org/XML/2004/xml-schema-test-suite/index.html + The W3C Copyright notice is located in the file xmerl_xsd_MS2002-01-16_SUITE_data/w3c-copyright-19990405.html. + +xmerl_xsd_NIST2002-01-16_SUITE_data: + These tests are fetched from http://www.w3.org/XML/2004/xml-schema-test-suite/index.html + The W3C Copyright notice is located in the file xmerl_xsd_NIST2002-01-16_SUITE_data/w3c-copyright-19990405.html. + +xmerl_xsd_Sun2002-01-16_SUITE_data: + These tests are fetched from http://www.w3.org/XML/2004/xml-schema-test-suite/index.html + The W3C Copyright notice is located in the file xmerl_xsd_Sun2002-01-16_SUITE_data/w3c-copyright-19990405.html. + + diff --git a/lib/xmerl/test/xmerl_std_SUITE_data/w3c-copyright-19980720.html b/lib/xmerl/test/xmerl_std_SUITE_data/w3c-copyright-19980720.html new file mode 100644 index 0000000000..bc5c62fdbc --- /dev/null +++ b/lib/xmerl/test/xmerl_std_SUITE_data/w3c-copyright-19980720.html @@ -0,0 +1,81 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"><head> + + +<meta name="generator" content="HTML Tidy, see www.w3.org"> +<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> +<link rel="stylesheet" type="text/css" href="copyright-software-19980720_files/base.css"><title>W3C IPR SOFTWARE NOTICE</title></head><body bgcolor="#ffffff" text="#000000"> +<h1>W3C<sup>�</sup> SOFTWARE NOTICE AND LICENSE</h1> + +<h3>Copyright � 1994-2002 <a href="http://www.w3.org/">World +Wide Web Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de +Recherche en Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio University</a>). All Rights +Reserved. http://www.w3.org/Consortium/Legal/</h3> + +<p>This W3C work (including software, documents, or other related +items) is being provided by the copyright holders under the +following license. By obtaining, using and/or copying this work, +you (the licensee) agree that you have read, understood, and will +comply with the following terms and conditions:</p> + +<p>Permission to use, copy, modify, and distribute this software +and its documentation, with or without modification, for any +purpose and without fee or royalty is hereby granted, provided that +you include the following on ALL copies of the software and +documentation or portions thereof, including modifications, that +you make:</p> + +<ol> +<li>The full text of this NOTICE in a location viewable to users of +the redistributed or derivative work.</li> + +<li>Any pre-existing intellectual property disclaimers, notices, or +terms and conditions. If none exist, a short notice of the +following form (hypertext is preferred, text is permitted) should +be used within the body of any redistributed or derivative code: +"Copyright � [$date-of-software] <a href="http://www.w3.org/">World Wide Web Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de +Recherche en Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio University</a>). All Rights +Reserved. http://www.w3.org/Consortium/Legal/"</li> + +<li>Notice of any changes or modifications to the W3C files, +including the date changes were made. (We recommend you provide +URIs to the location from which the code is derived.)</li> +</ol> + +<p>THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND +COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF +MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE +USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD +PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p> + +<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, +SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE +SOFTWARE OR DOCUMENTATION.</p> + +<p>The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to the software without +specific, written prior permission. Title to copyright in this +software and any associated documentation will at all times remain +with copyright holders.</p> + +<p>____________________________________</p> + +<p>This formulation of W3C's notice and license became active on +August 14 1998 so as to improve compatibility with GPL. This +version ensures that W3C software licensing terms are no more +restrictive than GPL and consequently W3C software may be +distributed in GPL packages. See the <a href="http://www.w3.org/Consortium/Legal/copyright-software-19980519.html">older formulation</a> for +the policy prior to this date. Please see our <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a> for common questions about +using materials from our site, including specific terms and +conditions for packages like libwww, Amaya, and Jigsaw. Other +questions about this notice can be directed to <a href="mailto:[email protected]">[email protected]</a>.<br> + </p> + +<p> </p> + +<address><a href="http://www.w3.org/Help/Webmaster.html">webmaster</a><br> + (last updated $Date: 2002/02/13 14:08:32 $)</address> +</body></html>
\ No newline at end of file diff --git a/lib/xmerl/test/xmerl_test_lib.erl b/lib/xmerl/test/xmerl_test_lib.erl index 83ca5431fd..16f438ca84 100644 --- a/lib/xmerl/test/xmerl_test_lib.erl +++ b/lib/xmerl/test/xmerl_test_lib.erl @@ -88,5 +88,5 @@ keysearch_delete(Key,N,List) -> get_data_dir(Config) -> Data0 = ?config(data_dir, Config), - {ok,Data,_} = regexp:sub(Data0, "xmerl_sax_std_SUITE", "xmerl_sax_std_SUITE"), + {ok,Data,_} = regexp:sub(Data0, "xmerl_sax_std_SUITE", "xmerl_std_SUITE"), Data. diff --git a/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/msx_failed_cases.log b/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/msx_failed_cases.log index 473c7aabf6..a89a9a798c 100644 --- a/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/msx_failed_cases.log +++ b/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/msx_failed_cases.log @@ -503,6 +503,7 @@ "elemA010.xsd", "elemA009.xsd", "elemA006.xsd", + "elemZ001.xml", "elemZ002.xml", "elemU007.xml", "elemU006.xml", @@ -527,6 +528,7 @@ "elemT004.xml", "elemT001.xml", "elemQ022.xml", + "elemQ019.xml", "elemQ018.xml", "elemO011.xml", "elemO006.xml"],[]}}. @@ -1357,6 +1359,7 @@ "idL052.xml", "idL049.xml", "idL048.xml", + "idL025.xml", "idL024.xml", "idL023.xml", "idK015.xml", @@ -1367,10 +1370,13 @@ "idH032.xml", "idH023.xml", "idH012.xml", + "idH010.xml", "idH006.xml", "idG030.xml", "idG028.xml", "idG019.xml", + "idG012.xml", + "idG011.xml", "idG006.xml", "idF036.xml", "idF034.xml", @@ -1378,6 +1384,8 @@ "idF031.xml", "idF026.xml", "idF025.xml", + "idF017.xml", + "idF016.xml", "idF014.xml", "idF013.xml", "idF012.xml", diff --git a/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/w3c-copyright-19990405.html b/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/w3c-copyright-19990405.html new file mode 100644 index 0000000000..5c89ffd95e --- /dev/null +++ b/lib/xmerl/test/xmerl_xsd_MS2002-01-16_SUITE_data/w3c-copyright-19990405.html @@ -0,0 +1,82 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html><head> + + + <meta http-equiv="Content-Type" content="text/html"><title>DOCUMENT NOTICE</title> + + <link rel="stylesheet" type="text/css" href="copyright-documents-19990405_files/base.css"></head><body bgcolor="#ffffff" text="#000000"> +<h1>W3C<sup>�</sup> DOCUMENT NOTICE AND LICENSE</h1> + +<h3>Copyright � 1994-2002 <a href="http://www.w3.org/">World Wide Web +Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de Recherche +en Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio +University</a>). All Rights Reserved.<br> +http://www.w3.org/Consortium/Legal/</h3> + +<p>Public documents on the W3C site are provided by the copyright holders +under the following license. The software or Document Type Definitions (DTDs) +associated with W3C specifications are governed by the <a href="http://www.w3.org/Consortium/Legal/copyright-software.html"> Software +Notice</a>. By using and/or copying this document, or the W3C document from +which this statement is linked, you (the licensee) agree that you have read, +understood, and will comply with the following terms and conditions:</p> + +<p>Permission to use, copy, and distribute the contents of this document, or +the W3C document from which this statement is linked, in any medium for any +purpose and without fee or royalty is hereby granted, provided that you +include the following on <i>ALL</i> copies of the document, or portions +thereof, that you use:</p> +<ol> + <li>A link or URL to the original W3C document.</li> + <li>The pre-existing copyright notice of the original author, or if it + doesn't exist, a notice of the form: "Copyright � [$date-of-document] <a href="http://www.w3.org/">World Wide Web Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of Technology</a>, + <a href="http://www.inria.fr/"> Institut National de Recherche en + Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio + University</a>). All Rights Reserved. + http://www.w3.org/Consortium/Legal/" (Hypertext is preferred, but a + textual representation is permitted.)</li> + <li><em>If it exists</em>, the STATUS of the W3C document.</li> +</ol> + +<p>When space permits, inclusion of the full text of this <b> NOTICE</b> +should be provided. We request that authorship attribution be provided in any +software, documents, or other items or products that you create pursuant to +the implementation of the contents of this document, or any portion +thereof.</p> + +<p>No right to create modifications or derivatives of W3C documents is +granted pursuant to this license. However, if additional requirements +(documented in the <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a>) are satisfied, +the right to create modifications or derivatives is sometimes granted by the +W3C to individuals complying with those requirements.</p> + +<p>THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO +REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED +TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE +FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT +INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p> + +<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE +PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.</p> + +<p>The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to this document or its contents without +specific, written prior permission. Title to copyright in this document will +at all times remain with copyright holders.</p> + +<p>----------------------------------------------------------------------------</p> + +<p>This formulation of W3C's notice and license became active on April 05 +1999 so as to account for the treatment of DTDs, schema's and bindings. See +the <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990218.html"> older formulation</a> for +the policy prior to this date. Please see our <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a> for common questions about using +materials from our site, including specific terms and conditions for packages +like libwww, Amaya, and Jigsaw. Other questions about this notice can be +directed to <a href="mailto:[email protected]">[email protected]</a>.</p> +<address> + <a href="http://w3.org/Help/Webmaster.html">webmaster</a><br> + (last updated by reagle on 1999/04/99.) +</address> +</body></html>
\ No newline at end of file diff --git a/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/nist_failed_cases.log b/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/nist_failed_cases.log index e69f74d174..e10b6463fe 100644 --- a/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/nist_failed_cases.log +++ b/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/nist_failed_cases.log @@ -133,23 +133,9 @@ "NISTXML-decimal-minExclusive-5-1.xml", "NISTXML-decimal-minExclusive-4-5.xml", "NISTXML-decimal-minExclusive-4-4.xml", - "NISTXML-decimal-minExclusive-4-3.xml", - "NISTXML-decimal-minExclusive-4-2.xml", "NISTXML-decimal-minExclusive-4-1.xml", - "NISTXML-decimal-minExclusive-3-5.xml", - "NISTXML-decimal-minExclusive-3-4.xml", - "NISTXML-decimal-minExclusive-3-3.xml", - "NISTXML-decimal-minExclusive-3-2.xml", "NISTXML-decimal-minExclusive-3-1.xml", - "NISTXML-decimal-minExclusive-2-5.xml", - "NISTXML-decimal-minExclusive-2-4.xml", - "NISTXML-decimal-minExclusive-2-3.xml", - "NISTXML-decimal-minExclusive-2-2.xml", "NISTXML-decimal-minExclusive-2-1.xml", - "NISTXML-decimal-minExclusive-1-5.xml", - "NISTXML-decimal-minExclusive-1-4.xml", - "NISTXML-decimal-minExclusive-1-3.xml", - "NISTXML-decimal-minExclusive-1-2.xml", "NISTXML-decimal-minExclusive-1-1.xml"],[]}}. {'NISTSchema-double',{["NISTXML-double-maxInclusive-5-5.xml", "NISTXML-double-maxInclusive-5-4.xml", diff --git a/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/w3c-copyright-19990405.html b/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/w3c-copyright-19990405.html new file mode 100644 index 0000000000..5c89ffd95e --- /dev/null +++ b/lib/xmerl/test/xmerl_xsd_NIST2002-01-16_SUITE_data/w3c-copyright-19990405.html @@ -0,0 +1,82 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html><head> + + + <meta http-equiv="Content-Type" content="text/html"><title>DOCUMENT NOTICE</title> + + <link rel="stylesheet" type="text/css" href="copyright-documents-19990405_files/base.css"></head><body bgcolor="#ffffff" text="#000000"> +<h1>W3C<sup>�</sup> DOCUMENT NOTICE AND LICENSE</h1> + +<h3>Copyright � 1994-2002 <a href="http://www.w3.org/">World Wide Web +Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de Recherche +en Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio +University</a>). All Rights Reserved.<br> +http://www.w3.org/Consortium/Legal/</h3> + +<p>Public documents on the W3C site are provided by the copyright holders +under the following license. The software or Document Type Definitions (DTDs) +associated with W3C specifications are governed by the <a href="http://www.w3.org/Consortium/Legal/copyright-software.html"> Software +Notice</a>. By using and/or copying this document, or the W3C document from +which this statement is linked, you (the licensee) agree that you have read, +understood, and will comply with the following terms and conditions:</p> + +<p>Permission to use, copy, and distribute the contents of this document, or +the W3C document from which this statement is linked, in any medium for any +purpose and without fee or royalty is hereby granted, provided that you +include the following on <i>ALL</i> copies of the document, or portions +thereof, that you use:</p> +<ol> + <li>A link or URL to the original W3C document.</li> + <li>The pre-existing copyright notice of the original author, or if it + doesn't exist, a notice of the form: "Copyright � [$date-of-document] <a href="http://www.w3.org/">World Wide Web Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of Technology</a>, + <a href="http://www.inria.fr/"> Institut National de Recherche en + Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio + University</a>). All Rights Reserved. + http://www.w3.org/Consortium/Legal/" (Hypertext is preferred, but a + textual representation is permitted.)</li> + <li><em>If it exists</em>, the STATUS of the W3C document.</li> +</ol> + +<p>When space permits, inclusion of the full text of this <b> NOTICE</b> +should be provided. We request that authorship attribution be provided in any +software, documents, or other items or products that you create pursuant to +the implementation of the contents of this document, or any portion +thereof.</p> + +<p>No right to create modifications or derivatives of W3C documents is +granted pursuant to this license. However, if additional requirements +(documented in the <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a>) are satisfied, +the right to create modifications or derivatives is sometimes granted by the +W3C to individuals complying with those requirements.</p> + +<p>THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO +REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED +TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE +FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT +INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p> + +<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE +PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.</p> + +<p>The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to this document or its contents without +specific, written prior permission. Title to copyright in this document will +at all times remain with copyright holders.</p> + +<p>----------------------------------------------------------------------------</p> + +<p>This formulation of W3C's notice and license became active on April 05 +1999 so as to account for the treatment of DTDs, schema's and bindings. See +the <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990218.html"> older formulation</a> for +the policy prior to this date. Please see our <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a> for common questions about using +materials from our site, including specific terms and conditions for packages +like libwww, Amaya, and Jigsaw. Other questions about this notice can be +directed to <a href="mailto:[email protected]">[email protected]</a>.</p> +<address> + <a href="http://w3.org/Help/Webmaster.html">webmaster</a><br> + (last updated by reagle on 1999/04/99.) +</address> +</body></html>
\ No newline at end of file diff --git a/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/sun_failed_cases.log b/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/sun_failed_cases.log index 82f410b455..cf0403bdeb 100644 --- a/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/sun_failed_cases.log +++ b/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/sun_failed_cases.log @@ -1,27 +1,33 @@ -{'Sun-idc001.nogen',{["idc001.nogen.v01.xml","idc001.nogen.v00.xml"],[]}}. -{'Sun-idc004.nogen',{["idc004.nogen.v00.xml"],[]}}. -{'Sun-idc005.nogen',{["idc005.nogen.v00.xml"],[]}}. -{'Sun-idc006.nogen',{["idc006.nogen.v00.xml","idc006.nogen.n00.xml"],[]}}. -{'Sun-xsd001',{["xsd001.v03.xml", - "xsd001.v02.xml", - "xsd001.v01.xml", - "xsd001.v00.xml"],[]}}. +{'Sun-idc004.nogen',{["idc004.nogen.n02.xml", "idc004.nogen.n03.xml"],[]}}. +{'Sun-idc006.nogen',{["idc006.nogen.n00.xml"],[]}}. +{'Sun-xsd001',{["xsd001.n04.xml", + "xsd001.n05.xml", + "xsd001.n06.xml"],[]}}. {'Sun-xsd002',{["xsd002.v01.xml","xsd002.v00.xml"],[]}}. {'Sun-xsd003a',{["xsd003a.v00.xml"],[]}}. -{'Sun-xsd003b',{["xsd003b.v01.xml","xsd003b.v00.xml"],[]}}. -{'Sun-xsd004',{["xsd004.v00.xml","xsd004.n00.xml"],[]}}. -{'Sun-xsd005',{["xsd005.v00.xml"],[]}}. -{'Sun-xsd008',{["xsd008.v00.xml"],[]}}. +{'Sun-xsd003b',{["xsd003b.v01.xml"],[]}}. +{'Sun-xsd004',{["xsd004.v00.xml", + "xsd004.n00.xml", + "xsd004.n05.xml", + "xsd004.n06.xml", + "xsd004.n07.xml", + "xsd004.n11.xml", + "xsd004.n12.xml" + ],[]}}. +{'Sun-xsd005',{["xsd005.n05.xml"],[]}}. +{'Sun-xsd008',{[],[]}}. {'Sun-xsd012',{["xsd012.v00.xml"],[]}}. {'Sun-xsd021',{["xsd021.v00.xml", "xsd021.n03.xml", "xsd021.n02.xml", + "xsd021.n06.xml", + "xsd021.n07.xml", "xsd021.n01.xml", "xsd021.n00.xml"],[]}}. {'Sun-xsd022',{["xsd022.v00.xml"],[]}}. {'Sun-xsiType1',{["xsiType1.v1.xml"],[]}}. -{'Sun-xsiType-block-1',{["xsiType-block-1.v1.xml"],[]}}. -{'Sun-xsiType-block-2',{["xsiType-block-2.v1.xml"],[]}}. -{'Sun-xsiType-block-3',{["xsiType-block-3.v1.xml"],[]}}. -{'Sun-xsiType-block-4',{["xsiType-block-4.v1.xml"],[]}}. +{'Sun-xsiType-block-1',{["xsiType-block-1.n1.xml", "xsiType-block-1.v1.xml"],[]}}. +{'Sun-xsiType-block-2',{["xsiType-block-2.n1.xml", "xsiType-block-2.v1.xml"],[]}}. +{'Sun-xsiType-block-3',{["xsiType-block-3.n1.xml", "xsiType-block-3.v1.xml"],[]}}. +{'Sun-xsiType-block-4',{["xsiType-block-4.n2.xml", "xsiType-block-4.v1.xml"],[]}}. {'Sun-type-and-subst-1',{["type-and-subst-1.v2.xml"],[]}}. diff --git a/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/w3c-copyright-19990405.html b/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/w3c-copyright-19990405.html new file mode 100644 index 0000000000..5c89ffd95e --- /dev/null +++ b/lib/xmerl/test/xmerl_xsd_Sun2002-01-16_SUITE_data/w3c-copyright-19990405.html @@ -0,0 +1,82 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<html><head> + + + <meta http-equiv="Content-Type" content="text/html"><title>DOCUMENT NOTICE</title> + + <link rel="stylesheet" type="text/css" href="copyright-documents-19990405_files/base.css"></head><body bgcolor="#ffffff" text="#000000"> +<h1>W3C<sup>�</sup> DOCUMENT NOTICE AND LICENSE</h1> + +<h3>Copyright � 1994-2002 <a href="http://www.w3.org/">World Wide Web +Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of +Technology</a>, <a href="http://www.inria.fr/">Institut National de Recherche +en Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio +University</a>). All Rights Reserved.<br> +http://www.w3.org/Consortium/Legal/</h3> + +<p>Public documents on the W3C site are provided by the copyright holders +under the following license. The software or Document Type Definitions (DTDs) +associated with W3C specifications are governed by the <a href="http://www.w3.org/Consortium/Legal/copyright-software.html"> Software +Notice</a>. By using and/or copying this document, or the W3C document from +which this statement is linked, you (the licensee) agree that you have read, +understood, and will comply with the following terms and conditions:</p> + +<p>Permission to use, copy, and distribute the contents of this document, or +the W3C document from which this statement is linked, in any medium for any +purpose and without fee or royalty is hereby granted, provided that you +include the following on <i>ALL</i> copies of the document, or portions +thereof, that you use:</p> +<ol> + <li>A link or URL to the original W3C document.</li> + <li>The pre-existing copyright notice of the original author, or if it + doesn't exist, a notice of the form: "Copyright � [$date-of-document] <a href="http://www.w3.org/">World Wide Web Consortium</a>, (<a href="http://www.lcs.mit.edu/">Massachusetts Institute of Technology</a>, + <a href="http://www.inria.fr/"> Institut National de Recherche en + Informatique et en Automatique</a>, <a href="http://www.keio.ac.jp/">Keio + University</a>). All Rights Reserved. + http://www.w3.org/Consortium/Legal/" (Hypertext is preferred, but a + textual representation is permitted.)</li> + <li><em>If it exists</em>, the STATUS of the W3C document.</li> +</ol> + +<p>When space permits, inclusion of the full text of this <b> NOTICE</b> +should be provided. We request that authorship attribution be provided in any +software, documents, or other items or products that you create pursuant to +the implementation of the contents of this document, or any portion +thereof.</p> + +<p>No right to create modifications or derivatives of W3C documents is +granted pursuant to this license. However, if additional requirements +(documented in the <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a>) are satisfied, +the right to create modifications or derivatives is sometimes granted by the +W3C to individuals complying with those requirements.</p> + +<p>THIS DOCUMENT IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO +REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED +TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, +NON-INFRINGEMENT, OR TITLE; THAT THE CONTENTS OF THE DOCUMENT ARE SUITABLE +FOR ANY PURPOSE; NOR THAT THE IMPLEMENTATION OF SUCH CONTENTS WILL NOT +INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.</p> + +<p>COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE DOCUMENT OR THE +PERFORMANCE OR IMPLEMENTATION OF THE CONTENTS THEREOF.</p> + +<p>The name and trademarks of copyright holders may NOT be used in +advertising or publicity pertaining to this document or its contents without +specific, written prior permission. Title to copyright in this document will +at all times remain with copyright holders.</p> + +<p>----------------------------------------------------------------------------</p> + +<p>This formulation of W3C's notice and license became active on April 05 +1999 so as to account for the treatment of DTDs, schema's and bindings. See +the <a href="http://www.w3.org/Consortium/Legal/copyright-documents-19990218.html"> older formulation</a> for +the policy prior to this date. Please see our <a href="http://www.w3.org/Consortium/Legal/IPR-FAQ.html">Copyright FAQ</a> for common questions about using +materials from our site, including specific terms and conditions for packages +like libwww, Amaya, and Jigsaw. Other questions about this notice can be +directed to <a href="mailto:[email protected]">[email protected]</a>.</p> +<address> + <a href="http://w3.org/Help/Webmaster.html">webmaster</a><br> + (last updated by reagle on 1999/04/99.) +</address> +</body></html>
\ No newline at end of file diff --git a/lib/xmerl/test/xmerl_xsd_lib.erl b/lib/xmerl/test/xmerl_xsd_lib.erl index 074e6dcd49..0b6b1ebc84 100644 --- a/lib/xmerl/test/xmerl_xsd_lib.erl +++ b/lib/xmerl/test/xmerl_xsd_lib.erl @@ -37,29 +37,29 @@ -include_lib("kernel/include/file.hrl"). -compare_test_results(Config,ST,IT) -> +compare_test_results(Config, ST, IT) -> ResST=compare_schema_test_results(ST), ResIT=compare_instance_test_results(IT), - io:format("compare_test_results:~n ST = ~p~n IT = ~p~n ResST = ~p~n ResIT = ~p~n",[ST,IT,ResST,ResIT]), - case process_reference_results(Config,ResST,ResIT) of + io:format("compare_test_results:~n ST = ~p~n IT = ~p~n ResST = ~p~n ResIT = ~p~n",[ST, IT, ResST, ResIT]), + case process_reference_results(Config, ResST, ResIT) of error -> error; Diff -> - return_results(Diff,ResST,ResIT,length(ST)+length(IT)) + return_results(Diff, ResST, ResIT, length(ST)+length(IT)) end. compare_schema_test_results(ST) -> - {[N||{N,false}<-ST],[N||{N,enoent}<-ST]}. + {[N||{N, false}<-ST], [N||{N, enoent}<-ST]}. compare_instance_test_results(IT) -> - {[N||{N,false}<-IT],[N||{N,enoent}<-IT]}. + {[N||{N, false}<-IT], [N||{N, enoent}<-IT]}. -return_results(Diff,{STErrs,_},{ITErrs,_},TotN) -> - NumErrs = length(STErrs++ITErrs), +return_results({SkippedN, Diff},{STErrs, _},{ITErrs, _}, TotN) -> + NumErrs = length(STErrs ++ ITErrs), case NumErrs == TotN of true when TotN > 0 -> ?line exit(all_tests_cases_failed); _ -> - return_results2(Diff,TotN - NumErrs,TotN) + return_results2(Diff, TotN - NumErrs, SkippedN, TotN) end. %% return_results2(Diff,{[],[]},{[],[]},TotN) -> @@ -69,151 +69,158 @@ return_results(Diff,{STErrs,_},{ITErrs,_},TotN) -> %% return_results2(Diff,{STErrs,STOther},{ITErrs,ITOther},TotN) -> %% {comment,io_lib:format("Total number of test cases: ~p~nThe following ~p test cases failed: ~p~nThe following ~p test cases was malicious ~p~~n"++Diff,[TotN,length(STErrs++ITErrs),STErrs++ITErrs,length(STOther++ITOther),STOther++ITOther])}. -return_results2(_,0,0) -> - {comment,io_lib:format("This test case was empty.~n",[])}; -return_results2({[],[],[],[]},NumSucc,TotN) -> - {comment,io_lib:format("~p successful tests of totally ~p test cases.~n", - [NumSucc,TotN])}; -return_results2({NewFail,NewSuccess,NewMal,NewNotMal},NumSucc,TotN) -> +return_results2(_, 0, 0, 0) -> + {comment,io_lib:format("This test case was empty.~n", [])}; +return_results2({[], [], [], []}, NumSucc, SkippedN, TotN) -> + {comment,io_lib:format("~p successful tests, ~p skipped tests of totally ~p test cases.~n", + [NumSucc, SkippedN, TotN])}; +return_results2({NewFail, NewSuccess, NewMal, NewNotMal}, NumSucc, SkippedN, TotN) -> NFComm = case NewFail of [] -> ""; _ -> io_lib:format("These ~p tests are new failures: ~p~n", - [length(NewFail),NewFail]) + [length(NewFail), NewFail]) end, NSComm = case NewSuccess of [] -> ""; - _ -> io_lib:format("These ~p tests are new succeeding cases: ~p~n", - [length(NewSuccess),NewSuccess]) + _ -> io_lib:format("These ~p skipped tests are new succeeding cases: ~p~n", + [length(NewSuccess), NewSuccess]) end, NMComm = case NewMal of [] -> ""; _ -> io_lib:format("These ~p tests are now malicious: ~p~n", - [length(NewMal),NewMal]) + [length(NewMal), NewMal]) end, NNMComm = case NewNotMal of [] -> ""; - _ -> io_lib:format("These ~p tests were malicious, but succeeds now: ~p~n",[length(NewNotMal),NewNotMal]) + _ -> io_lib:format("These ~p skipped tests were malicious, but succeeds now: ~p~n", [length(NewNotMal), NewNotMal]) end, - {comment,io_lib:format("~p successful tests of totally ~p test cases. ~n"++ - NFComm++NSComm++NMComm++NNMComm,[NumSucc,TotN])}. + ct:comment(io_lib:format("~p successful tests, ~p skipped tests of totally ~p test cases. ~n" ++ + NFComm ++ NSComm ++ NMComm ++ NNMComm, [NumSucc, SkippedN, TotN])), + [] = NewFail. + %% return_results2(Diff,{STErrs,STOther},{ITErrs,ITOther},TotN) -> -%% {comment,io_lib:format("Total number of test cases: ~p~nThe following ~p test cases failed: ~p~nThe following ~p test cases was malicious ~p~~n",[TotN,length(STErrs++ITErrs),STErrs++ITErrs,length(STOther++ITOther),STOther++ITOther])}. +%% {comment,io_lib:format("Total number of test cases: ~p~n The following ~p test cases failed: ~p~nThe following ~p test cases was malicious ~p~~n",[TotN,length(STErrs++ITErrs),STErrs++ITErrs,length(STOther++ITOther),STOther++ITOther])}. -process_reference_results(Config,{ErrsST,MalST},{ErrsIT,MalIT}) -> - {RefFailed,RefMalicious} = xsd_reference_log(Config), +process_reference_results(Config, {ErrsST, MalST}, {ErrsIT, MalIT}) -> + {RefFailed, RefMalicious} = xsd_reference_log(Config), +io:format("A: ~p : ~p\n\n",[RefFailed, RefMalicious]), AllErrs = ErrsST ++ ErrsIT, AllMals = MalST ++ MalIT, %% test cases failed now but succeeded in reference results. - NewFailures = [X||X<-AllErrs, lists:member(X,RefFailed)==false], + NewFailures = [X||X<-AllErrs, lists:member(X, RefFailed) == false], %% test cases succeeded now but failed in reference results. - NewSucceeds = [X||X<-RefFailed,lists:member(X,AllErrs)==false], + NewSucceeds = [X||X<-RefFailed, lists:member(X, AllErrs) == false], %% test cases malicious now but succeeded in reference results. - NewMalicious = [X||X<-AllMals, lists:member(X,RefMalicious)==false], + NewMalicious = [X||X<-AllMals, lists:member(X, RefMalicious) == false], %% test cases succeeded now but malicious in reference results. - NewNotMal = [X||X<-RefMalicious, lists:member(X,AllMals) == false], - write_in_log(Config,AllErrs,AllMals), + NewNotMal = [X||X<-RefMalicious, lists:member(X, AllMals) == false], + write_in_log(Config, AllErrs, AllMals), % io:format("process_reference_results:~n AllErrs = ~p~n NewFailures = ~p~n",[AllErrs,NewFailures]), - {NewFailures,NewSucceeds,NewMalicious,NewNotMal}. + {length(RefFailed) + length(RefMalicious), {NewFailures, NewSucceeds, NewMalicious, NewNotMal}}. xsd_reference_log(Config) -> - DataDir = ?config(data_dir,Config), - Suite = ?config(suite,Config), + DataDir = ?config(data_dir, Config), + Suite = ?config(suite, Config), SuiteReferenceLog = - filename:join([DataDir,lists:concat([Suite,"_failed_cases.log"])]), + filename:join([DataDir, lists:concat([Suite, "_failed_cases.log"])]), +io:format("B: ~p\n\n",[SuiteReferenceLog]), case file:consult(SuiteReferenceLog) of {ok,List} when is_list(List) -> - case lists:keysearch(?config(testcase,Config),1,List) of - {value,{_,TCRefFails}} -> +io:format("C: ~p\n\n",[List]), + case lists:keysearch(?config(testcase, Config), 1, List) of + {value,{_, TCRefFails}} -> +io:format("D: ~p\n\n",[TCRefFails]), TCRefFails; _ -> - {[],[]} +io:format("D: ~no result\n\n",[]), + {[], []} end; _ -> - {[],[]} + {[], []} end. -write_in_log(_Config,[],[]) -> +write_in_log(_Config, [], []) -> ok; -write_in_log(Config,AllErrs,AllMals) -> - ?line LogFileName = ?config(xmerl_error_log,Config), - {ok,IO}=file:open(LogFileName,[append]), - ?line TestCase = ?config(testcase,Config), - io:format(IO,"{~p,{~p,~p}}.~n",[TestCase,AllErrs,AllMals]), +write_in_log(Config, AllErrs, AllMals) -> + ?line LogFileName = ?config(xmerl_error_log, Config), + {ok,IO}=file:open(LogFileName, [append]), + ?line TestCase = ?config(testcase, Config), + io:format(IO,"{~p,{~p,~p}}.~n", [TestCase, AllErrs, AllMals]), file:close(IO), ok. schema_test(Config,FileName,XsdBase,Validity) -> ModuleName = filename:basename(FileName), - DataDir = ?config(data_dir,Config), - case xmerl_xsd:process_schema(filename:join([DataDir, FileName]),[{xsdbase,filename:join([DataDir,XsdBase])}]) of - {error,enoent} -> - {{ModuleName,enoent},#xsd_state{}}; - {Ok,S} -> + DataDir = ?config(data_dir, Config), + case xmerl_xsd:process_schema(filename:join([DataDir, FileName]), [{xsdbase,filename:join([DataDir, XsdBase])}]) of + {error, enoent} -> + {{ModuleName, enoent},#xsd_state{}}; + {Ok, S} -> case Validity of valid when Ok == ok -> %% io:format("schema_test1: Validity=valid,Ok=ok,S=~p~n",[S]), - {{ModuleName,S#xsd_state.errors == []},S}; + {{ModuleName, S#xsd_state.errors == []}, S}; invalid when Ok == error -> %% S is in this case an error reason - {{ModuleName,no_internal_error(S)},#xsd_state{}}; + {{ModuleName, no_internal_error(S)}, #xsd_state{}}; notKnown -> - {{ModuleName,true},#xsd_state{}}; + {{ModuleName, true}, #xsd_state{}}; valid -> - io:format("schema_test2: Validity=valid,Ok=~p,S=~p~n",[Ok,S]), + io:format("schema_test2: Validity=valid,Ok=~p,S=~p~n", [Ok, S]), %% io:format("FileName: ~p~n",[FileName]), - {{ModuleName,false},#xsd_state{}}; + {{ModuleName, false}, #xsd_state{}}; _ -> %% invalid Ok == ok - io:format("schema_test3: Validity=~p,Ok=~p,S=~p~n",[Validity,Ok,S]), - {{ModuleName,false},S} + io:format("schema_test3: Validity=~p,Ok=~p,S=~p~n", [Validity, Ok, S]), + {{ModuleName, false}, S} end end. -schema_test(Config,FileName,XsdBase,Validity,AccState) -> +schema_test(Config, FileName, XsdBase, Validity, AccState) -> ModuleName = filename:basename(FileName), - DataDir = ?config(data_dir,Config), - case xmerl_xsd:process_schema(filename:join([DataDir,FileName]), - [{xsdbase,filename:join([DataDir,XsdBase])}, AccState]) of - {error,enoent} -> - {{ModuleName,enoent},AccState}; - {Ok,S} -> + DataDir = ?config(data_dir, Config), + case xmerl_xsd:process_schema(filename:join([DataDir, FileName]), + [{xsdbase, filename:join([DataDir, XsdBase])}, AccState]) of + {error, enoent} -> + {{ModuleName, enoent}, AccState}; + {Ok, S} -> case Validity of valid when Ok == ok -> - {{ModuleName,S#xsd_state.errors == []},S}; + {{ModuleName, S#xsd_state.errors == []}, S}; invalid when Ok == error -> - {{ModuleName,no_internal_error(S)},AccState}; + {{ModuleName, no_internal_error(S)}, AccState}; notKnown -> - {{ModuleName,true},AccState}; + {{ModuleName, true}, AccState}; valid -> - {{ModuleName,false},AccState}; + {{ModuleName, false}, AccState}; _ -> - {{ModuleName,false},S} + {{ModuleName, false}, S} end end. -instance_test(Config,FileName,XMLBase,Validity,State) -> +instance_test(Config, FileName, XMLBase, Validity, State) -> ModuleName = filename:basename(FileName), - DataDir = ?config(data_dir,Config), - case xmerl_scan:file(filename:join([DataDir,FileName]), - [{xmlbase,filename:join([DataDir,XMLBase])}]) of - {error,enoent} -> - {ModuleName,enoent}; - {E,_} -> - {VE,S2} = xmerl_xsd:validate(E,State), + DataDir = ?config(data_dir, Config), + case xmerl_scan:file(filename:join([DataDir, FileName]), + [{xmlbase, filename:join([DataDir, XMLBase])}]) of + {error, enoent} -> + {ModuleName, enoent}; + {E, _} -> + {VE, S2} = xmerl_xsd:validate(E, State), case Validity of - valid when is_record(VE,xmlElement) -> + valid when is_record(VE, xmlElement) -> case S2#xsd_state.errors of [] -> ok; - _ -> io:format("test case ~p failed.~nValidity: ~p~nValidation result:~p~n",[FileName,Validity,VE]) + _ -> io:format("test case ~p failed.~nValidity: ~p~nValidation result:~p~n", [FileName, Validity, VE]) end, - {ModuleName,S2#xsd_state.errors == []}; + {ModuleName, S2#xsd_state.errors == []}; invalid when VE == error -> - {ModuleName,no_internal_error(S2)}; + {ModuleName, no_internal_error(S2)}; notKnown -> - {ModuleName,true}; + {ModuleName, true}; _ -> - io:format("test case ~p failed.~nValidity: ~p~nValidation result:~p~n",[FileName,Validity,VE]), + io:format("test case ~p failed.~nValidity: ~p~nValidation result:~p~n", [FileName, Validity, VE]), {ModuleName,false} end end. @@ -226,11 +233,11 @@ no_internal_error(R) -> true end. -unpack(Config,Suite) -> +unpack(Config, Suite) -> TarFile = suite_tar(Suite), - ?line file:set_cwd(?config(data_dir,Config)), - ?line ok=erl_tar:extract(TarFile,[compressed]), - change_mode(filename:rootname(TarFile,".tar.gz")). + ?line file:set_cwd(?config(data_dir, Config)), + ?line ok=erl_tar:extract(TarFile, [compressed]), + change_mode(filename:rootname(TarFile, ".tar.gz")). suite_tar(sun) -> "suntest.tar.gz"; @@ -242,14 +249,14 @@ suite_tar(nist) -> change_mode(Files) -> change_mode3(Files). change_mode2(Dir)-> - ?line {ok,CWD} = file:get_cwd(), - ?line {ok,FileList} = file:list_dir(Dir), - ?line file:set_cwd(filename:join([CWD,Dir])), + ?line {ok, CWD} = file:get_cwd(), + ?line {ok, FileList} = file:list_dir(Dir), + ?line file:set_cwd(filename:join([CWD, Dir])), change_mode3(FileList), ?line file:set_cwd(CWD). change_mode3([]) -> ok; -change_mode3([F|Fs]) -> +change_mode3([F |Fs]) -> case filelib:is_dir(F) of true -> chmod(F), @@ -261,53 +268,53 @@ change_mode3([F|Fs]) -> chmod(F) -> case file:read_file_info(F) of - {ok,FileInfo} -> + {ok, FileInfo} -> Mode= FileInfo#file_info.mode, - file:write_file_info(F,FileInfo#file_info{mode=8#00777 bor Mode}); + file:write_file_info(F, FileInfo#file_info{mode=8#00777 bor Mode}); _ -> ok end. -rmdir(Config,Suite) -> - ?line file:set_cwd(?config(data_dir,Config)), - SuiteDir = filename:rootname(suite_tar(Suite),".tar.gz"), +rmdir(Config, Suite) -> + ?line file:set_cwd(?config(data_dir, Config)), + SuiteDir = filename:rootname(suite_tar(Suite), ".tar.gz"), ?line ok=rm_f_(SuiteDir). %% Dir is a directory rm_f_(Dir) -> - ?line {ok,CWD} = file:get_cwd(), - ?line {ok,FileList} = file:list_dir(Dir), - ?line file:set_cwd(filename:join([CWD,Dir])), + ?line {ok, CWD} = file:get_cwd(), + ?line {ok, FileList} = file:list_dir(Dir), + ?line file:set_cwd(filename:join([CWD, Dir])), rm_files(FileList), ?line file:set_cwd(CWD), ? line ok = file:del_dir(Dir). rm_files([])-> ok; -rm_files([F|Fs]) -> +rm_files([F |Fs]) -> case filelib:is_dir(F) of true -> rm_f_(F); _ -> - io:format("rm_files: ~p~n",[F]), + io:format("rm_files: ~p~n", [F]), ?line ok = file:delete(F) end, rm_files(Fs). -create_error_log_file(Config,Suite) -> - ?line {{Y,M,D},{H,Min,S}} = calendar:local_time(), - DTString=lists:concat([Y,"-",M,"-",D,"_",H,".",Min,".",S]), - FileName = lists:concat([Suite,"_",DTString,".errorlog"]), +create_error_log_file(Config, Suite) -> + ?line {{Y, M, D}, {H, Min, S}} = calendar:local_time(), + DTString=lists:concat([Y, "-", M,"-", D, "_", H, ".", Min, ".", S]), + FileName = lists:concat([Suite, "_", DTString, ".errorlog"]), %% ?line {ok,_IO} = file:open(filename:join([?config(priv_dir,Config), %% FileName]),[append]). %% ?line {ok,_IO} = file:open(FileName,[append]). - io:format("error log file: ~p~n",[filename:join([?config(priv_dir,Config),FileName])]), - {ok,filename:join([?config(priv_dir,Config),FileName])}. + io:format("error log file: ~p~n", [filename:join([?config(priv_dir,Config), FileName])]), + {ok, filename:join([?config(priv_dir,Config), FileName])}. close_error_log_file(Config) -> - case lists:keysearch(xmerl_error_log,1,Config) of - {value,{_,IO}} -> + case lists:keysearch(xmerl_error_log, 1, Config) of + {value,{_, IO}} -> file:close(IO); _ -> ok |