Browse Source

Merge pull request #10765 from richardkchapman/toxml_race

HPCC-18944 Occasional failure in toxml.ecl test

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>
Gavin Halliday 7 years ago
parent
commit
2188fdc237

+ 2 - 2
testing/regress/ecl/key/toxml.xml

@@ -11,6 +11,8 @@
  <Row><Result_4>&lt;row&gt;εν αρχη ην ο λογος&lt;/row&gt;</Result_4></Row>
 </Dataset>
 <Dataset name='Result 5'>
+ <Row><surname>Hälliday            </surname><forename>Gavin     </forename><homephone areaCode="     " number="0"></homephone><hasmobile>false</hasmobile><contact hasEmail="false"><phone areaCode="     " number="0"></phone></contact><books></books><colours></colours><endmarker>  </endmarker></Row>
+ <Row><surname>Halliday            </surname><forename>Abigäil   </forename><homephone areaCode="     " number="0"></homephone><hasmobile>false</hasmobile><contact hasEmail="false"><phone areaCode="     " number="0"></phone></contact><books></books><colours></colours><endmarker>  </endmarker></Row>
 </Dataset>
 <Dataset name='Result 6'>
 </Dataset>
@@ -23,8 +25,6 @@
 <Dataset name='Result 10'>
 </Dataset>
 <Dataset name='Result 11'>
- <Row><surname>Hälliday            </surname><forename>Gavin     </forename><homephone areaCode="     " number="0"></homephone><hasmobile>false</hasmobile><contact hasEmail="false"><phone areaCode="     " number="0"></phone></contact><books></books><colours></colours><endmarker>  </endmarker></Row>
- <Row><surname>Halliday            </surname><forename>Abigäil   </forename><homephone areaCode="     " number="0"></homephone><hasmobile>false</hasmobile><contact hasEmail="false"><phone areaCode="     " number="0"></phone></contact><books></books><colours></colours><endmarker>  </endmarker></Row>
 </Dataset>
 <Dataset name='Result 12'>
 </Dataset>

+ 10 - 7
testing/regress/ecl/setup/files.ecl

@@ -41,16 +41,19 @@ SHARED STRING EmptyString := '' : STORED('dummy');
 SHARED STRING EmptyString := '';
 #end
 
-SHARED STRING _filePrefix := '~regress::'+ MAP(
-        multiPart => 'multi',
-        'single') + '::' + EmptyString;
+SHARED forceLayoutTranslation := #IFDEFINED(root.forceLayoutTranslation, 0);
+
+SHARED STRING _filePrefix := '~regress::' + 
+        MAP(multiPart => 'multi', 'single') + 
+        IF(forceLayoutTranslation > 0, '_' + (STRING) forceLayoutTranslation, '') + 
+        '::' + EmptyString;
 
 //Yuk cannot use MAP because that creates a string6        
-SHARED STRING _indexPrefix := '~regress::'+ IF(multiPart AND useLocal, 'local', 
-                             IF(multiPart, 'multi',
-                             'single')) + '::' + EmptyString;
+SHARED STRING _indexPrefix := '~regress::' + 
+        IF(multiPart AND useLocal, 'local', IF(multiPart, 'multi', 'single')) + 
+        IF(forceLayoutTranslation > 0, '_' + (STRING) forceLayoutTranslation, '') + 
+        '::' + EmptyString;
 
-SHARED forceLayoutTranslation := #IFDEFINED(root.forceLayoutTranslation, 0);
 #IF (forceLayoutTranslation != 0)
   SHARED setLayout := #option('layoutTranslationEnabled', CASE(forceLayoutTranslation,1=>v'alwaysECL',2=>v'alwaysDisk',v''));
   EXPORT filePrefix := WHEN(#IFDEFINED(root.filePrefix, _filePrefix), setLayout);

+ 16 - 7
testing/regress/ecl/toxml.ecl

@@ -71,16 +71,16 @@ output(U'<row>'+U8'εν αρχη ην ο λογος'+U'</row>');
 output(U8'<row>'+U8'εν αρχη ην ο λογος'+U8'</row>');
 output((utf8)(U'<row>'+U'εν αρχη ην ο λογος'+U'</row>'));
 
-output(namesTable,,TOXMLPREFIX+'toxml1.xml',expire(1),overwrite,xml(heading('<MyDataset>\n','</MyDataset>')));
-output(namesTable,,TOXMLPREFIX+'toxml2.flat',expire(1),overwrite);
+setup1 := output(namesTable,,TOXMLPREFIX+'toxml1.xml',expire(1),overwrite,xml(heading('<MyDataset>\n','</MyDataset>')));
+setup2 := output(namesTable,,TOXMLPREFIX+'toxml2.flat',expire(1),overwrite);
 
 //Read from xml and then write out again - should be possible to compare the results easily
 inf := dataset(TOXMLPREFIX+'toxml1.xml', personRecord, xml('/MyDataset/Row'));
-output(inf,,TOXMLPREFIX+'toxml3.xml',expire(1),overwrite,xml);
+setup3 := output(inf,,TOXMLPREFIX+'toxml3.xml',expire(1),overwrite,xml);
 
-output(inf,{string xml{maxlength(1024)} := (string)toxml(row(inf))},TOXMLPREFIX+'toxml4.utf8',expire(1),overwrite,csv(unicode));
-output(inf,{utf8 xml{maxlength(1024)} := ((utf8)U'<row>')+toxml(row(inf))+((utf8)U'</row>')},TOXMLPREFIX+'toxml5.utf8',expire(1),overwrite,csv(unicode));
-output(inf,{unicode xml{maxlength(1024)} := toxml(row(inf))},TOXMLPREFIX+'toxml6.utf8',expire(1),overwrite,csv(unicode));
+setup4 := output(inf,{string xml{maxlength(1024)} := (string)toxml(row(inf))},TOXMLPREFIX+'toxml4.utf8',expire(1),overwrite,csv(unicode));
+setup5 := output(inf,{utf8 xml{maxlength(1024)} := ((utf8)U'<row>')+toxml(row(inf))+((utf8)U'</row>')},TOXMLPREFIX+'toxml5.utf8',expire(1),overwrite,csv(unicode));
+setup6 := output(inf,{unicode xml{maxlength(1024)} := toxml(row(inf))},TOXMLPREFIX+'toxml6.utf8',expire(1),overwrite,csv(unicode));
 
 p := TABLE(namesTable,{unicode text{maxlength(1024)} := U'<row>'+toxml(row(namesTable))+U'</row>'});
 
@@ -94,12 +94,21 @@ z := parse(p, p.text, createRowFromXml(), xml('/row'));
 output(z);
 
 infraw := dataset(TOXMLPREFIX+'toxml2.flat', personRecord, thor);
-output(infraw,{string xml{maxlength(1024)} := (string)toxml(row(infraw))},TOXMLPREFIX+'toxml7.utf8',expire(1),overwrite,csv(unicode));
+setup7 := output(infraw,{string xml{maxlength(1024)} := (string)toxml(row(infraw))},TOXMLPREFIX+'toxml7.utf8',expire(1),overwrite,csv(unicode));
 
 //Now read each of the xml files and output to the work unit as csv so we can check the content!
+sequential(
+setup1;
+setup2;
+setup3;
+setup4;
+setup5;
+setup6;
+setup7;
 output(dataset(TOXMLPREFIX+'toxml1.xml', { unicode line{maxlength(4096)} }, csv(unicode))(line not in ['<MyDataset>','</MyDataset>']));
 output(dataset(TOXMLPREFIX+'toxml3.xml', { unicode line{maxlength(4096)} }, csv(unicode))(line not in ['<Dataset>','</Dataset>']));
 output(dataset(TOXMLPREFIX+'toxml4.utf8', { unicode line{maxlength(4096)} }, csv(unicode)));
 output(dataset(TOXMLPREFIX+'toxml5.utf8', { unicode line{maxlength(4096)} }, csv(unicode)));
 output(dataset(TOXMLPREFIX+'toxml6.utf8', { unicode line{maxlength(4096)} }, csv(unicode)));
 output(dataset(TOXMLPREFIX+'toxml7.utf8', { unicode line{maxlength(4096)} }, csv(unicode)));
+);