Skip to content

Commit

Permalink
HPCC-18709 Allow file prefixes in regression suite to be overridden
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
  • Loading branch information
richardkchapman committed Nov 10, 2017
1 parent aa00fb5 commit f76d92a
Show file tree
Hide file tree
Showing 60 changed files with 667 additions and 598 deletions.
6 changes: 4 additions & 2 deletions testing/regress/ecl/HeadingExample.ecl
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

import $.setup;
prefix := setup.Files(false, false).FilePrefix;

//Sample data
rec := record
string s1;
Expand All @@ -9,4 +11,4 @@ ds0 := dataset([{'xxx','yyy'},{'xx,x','y,yy'},{'zzz','z'}],rec);
ds0;

//Save dataset to file with heading option
output(ds0,,'~thor::jas::testout',csv(heading,SEPARATOR(','),quote('"')),overwrite,expire);
output(ds0,,prefix+'jas_testout',csv(heading,SEPARATOR(','),quote('"')),overwrite,expire);
7 changes: 5 additions & 2 deletions testing/regress/ecl/aggsq1.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
limitations under the License.
############################################################################## */

import $.setup;
Files := setup.Files(false, false);

namesRecord :=
RECORD
string20 surname;
Expand Down Expand Up @@ -45,9 +48,9 @@ d := dataset([
}
], houseRecord);

output(d,,'~regresstemp::houses1',overwrite);
output(d,,Files.filePrefix+'houses1',overwrite);

houseTable := dataset('~regresstemp::houses1', houseRecord, thor);
houseTable := dataset(Files.filePrefix+'houses1', houseRecord, thor);

//--- End of common ---

Expand Down
3 changes: 2 additions & 1 deletion testing/regress/ecl/badindex.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
// Testing various indexes that might present tricky cases for remote projection/filtering

import ^ as root;
prefix := #IFDEFINED(root.prefix, '~regress::key::badidx');
import $.setup;
prefix := setup.Files(false, false).IndexPrefix;

simple_rec := RECORD
unsigned4 u4;
Expand Down
6 changes: 4 additions & 2 deletions testing/regress/ecl/critical1.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
limitations under the License.
###############################################################################*/
import Std;
import $.setup;
prefix := setup.Files(false, false).FilePrefix;

//noroxie
//nohthor
Expand All @@ -27,7 +29,7 @@ taggedRecord := RECORD(rawRecord)
unsigned8 id;
END;

idFileName := 'test::ids';
idFileName := prefix+'ids';

// Create superfile and initialize with first id number
InitializeSuperFile := FUNCTION
Expand Down Expand Up @@ -68,7 +70,7 @@ sortedds_cnt := COUNT(sortedds);

SEQUENTIAL(
EVALUATE(datasetOutsideCritical),
processInput(datasetOutsideCritical, 'test::tagged'),
processInput(datasetOutsideCritical, prefix+'tagged'),
OUTPUT(sortedds_cnt-dedupds_cnt,NAMED('DuplicateIdCount') ), // This should be zero
Std.File.DeleteSuperFile(idFileName)
);
43 changes: 23 additions & 20 deletions testing/regress/ecl/csv-escaped.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
limitations under the License.
############################################################################## */

import $.setup;
prefix := setup.Files(false, false).FilePrefix;

// Roxie needs this to resolve files at run time
#option ('allowVariableRoxieFilenames', 1);
VarString EmptyString := '' : STORED('dummy');
Expand All @@ -27,56 +30,56 @@ END;

// Default is no escape
orig := DATASET([{'this is an \\\'escaped\\\' string', 10, 'while this is not'}], rec);
OUTPUT(orig, ,'regress::csv-orig'+EmptyString, OVERWRITE, CSV);
escaped := DATASET('regress::csv-orig'+EmptyString, rec, CSV);
OUTPUT(orig, ,prefix + 'csv-orig'+EmptyString, OVERWRITE, CSV);
escaped := DATASET(prefix + 'csv-orig'+EmptyString, rec, CSV);
OUTPUT(escaped);

// Standard escape
orig2 := DATASET([{'this is an \\\'escaped\\\' string', 10, 'while this is not'}], rec);
OUTPUT(orig2, ,'regress::csv-escaped'+EmptyString, OVERWRITE, CSV);
escaped2 := DATASET('regress::csv-escaped'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(orig2, ,prefix + 'csv-escaped'+EmptyString, OVERWRITE, CSV);
escaped2 := DATASET(prefix + 'csv-escaped'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(escaped2);

// Multi-char escape
orig3 := DATASET([{'this is an -=-\'escaped-=-\' string', 10, 'while this is not'}], rec);
OUTPUT(orig3, ,'regress::csv-escaped-multi'+EmptyString, OVERWRITE, CSV);
escaped3 := DATASET('regress::csv-escaped-multi'+EmptyString, rec, CSV(ESCAPE('-=-')));
OUTPUT(orig3, ,prefix + 'csv-escaped-multi'+EmptyString, OVERWRITE, CSV);
escaped3 := DATASET(prefix + 'csv-escaped-multi'+EmptyString, rec, CSV(ESCAPE('-=-')));
OUTPUT(escaped3);

// Escape the escape
orig4 := DATASET([{'escape the \\\\ escape', 10, 'escape at the end \\\\'}], rec);
OUTPUT(orig4, ,'regress::csv-escaped-escape'+EmptyString, OVERWRITE, CSV);
escaped4 := DATASET('regress::csv-escaped-escape'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(orig4, ,prefix + 'csv-escaped-escape'+EmptyString, OVERWRITE, CSV);
escaped4 := DATASET(prefix + 'csv-escaped-escape'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(escaped4);

// Multi-escapes in a row
orig5 := DATASET([{'multiple escapes \\\\\\\\ in a row', 10, 'multiple at end \\\\\\\\'}], rec);
OUTPUT(orig5, ,'regress::csv-escaped-many'+EmptyString, OVERWRITE, CSV);
escaped5 := DATASET('regress::csv-escaped-many'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(orig5, ,prefix + 'csv-escaped-many'+EmptyString, OVERWRITE, CSV);
escaped5 := DATASET(prefix + 'csv-escaped-many'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(escaped5);

// Many escapes
orig6 := DATASET([{'many escapes like \\\'\\\' \\\' \\\' and \\\\\\\\ \\\\ \\\\ \\\\ \\\\ escape', 10, 'escape at the end \\\''}], rec);
OUTPUT(orig6, ,'regress::csv-escaped-many-more'+EmptyString, OVERWRITE, CSV);
escaped6 := DATASET('regress::csv-escaped-many-more'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(orig6, ,prefix + 'csv-escaped-many-more'+EmptyString, OVERWRITE, CSV);
escaped6 := DATASET(prefix + 'csv-escaped-many-more'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(escaped6);

// Escape separator
orig7 := DATASET([{'escaping \\, the \\,\\, \\, \\, separator', 10, 'escape at the end \\,'}], rec);
OUTPUT(orig7, ,'regress::csv-escaped-separator'+EmptyString, OVERWRITE, CSV);
escaped7 := DATASET('regress::csv-escaped-separator'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(orig7, ,prefix + 'csv-escaped-separator'+EmptyString, OVERWRITE, CSV);
escaped7 := DATASET(prefix + 'csv-escaped-separator'+EmptyString, rec, CSV(ESCAPE('\\')));
OUTPUT(escaped7);

// Escape with quotes
orig8 := DATASET([{'\'escaping\'\'the quote\'', 10, 'au naturel'}], rec);
OUTPUT(orig8, ,'regress::csv-escaped-escaped'+EmptyString, OVERWRITE, CSV);
escaped8 := DATASET('regress::csv-escaped-escaped'+EmptyString, rec, CSV(QUOTE('\'')));
OUTPUT(orig8, ,prefix + 'csv-escaped-escaped'+EmptyString, OVERWRITE, CSV);
escaped8 := DATASET(prefix + 'csv-escaped-escaped'+EmptyString, rec, CSV(QUOTE('\'')));
OUTPUT(escaped8);

// Escape with quotes with ESCAPE()
orig9 := DATASET([{'\'escaping\'\'the quote\'', 10, 'with user defined escape'}], rec);
OUTPUT(orig9, ,'regress::csv-escaped-escaped2'+EmptyString, OVERWRITE, CSV);
escaped9 := DATASET('regress::csv-escaped-escaped2'+EmptyString, rec, CSV(ESCAPE('\\'), QUOTE('\'')));
OUTPUT(orig9, ,prefix + 'csv-escaped-escaped2'+EmptyString, OVERWRITE, CSV);
escaped9 := DATASET(prefix + 'csv-escaped-escaped2'+EmptyString, rec, CSV(ESCAPE('\\'), QUOTE('\'')));
OUTPUT(escaped9);

// Default is no escape
Expand All @@ -87,6 +90,6 @@ orig10 := DATASET([
{'this is a line with "quotes" \n!\n in it', 10, 'while this is not'},
{'',0,''}
], rec);
OUTPUT(orig10, ,'regress::csv-orig10'+EmptyString, OVERWRITE, CSV(QUOTE('"')));
escaped10 := DATASET('regress::csv-orig10'+EmptyString, rec, CSV(QUOTE('"'),MAXLENGTH(1)));
OUTPUT(orig10, ,prefix + 'csv-orig10'+EmptyString, OVERWRITE, CSV(QUOTE('"')));
escaped10 := DATASET(prefix + 'csv-orig10'+EmptyString, rec, CSV(QUOTE('"'),MAXLENGTH(1)));
OUTPUT(escaped10);
13 changes: 8 additions & 5 deletions testing/regress/ecl/despray.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
limitations under the License.
############################################################################# */

import $.setup;
prefix := setup.Files(false, false).IndexPrefix;

//nothor

import Std.File AS FileServices;
Expand All @@ -31,15 +34,15 @@ allPeople := DATASET([ {1,'Fred','Smith'},
{2,'Joe','Blow'},
{3,'Jane','Smith'}],Layout_Person);

// Outputs ---
setup := output(allPeople, , '~persons', OVERWRITE);

import * from lib_fileservices;

SrcAddrIp := '.';
SrcAddrLocalhost := 'localhost';
File := 'persons';
SourceFile := '~::' + File;
SourceFile := prefix + File;

// Outputs ---
setupPeople := output(allPeople, , SourceFile, OVERWRITE);

ClusterName := 'mythor';

Expand Down Expand Up @@ -243,7 +246,7 @@ c10 := CATCH(NOFOLD(p10), ONFAIL(TRANSFORM(rec,
#end

SEQUENTIAL(
setup,
setupPeople,
PARALLEL(
o2,
o3,
Expand Down
4 changes: 3 additions & 1 deletion testing/regress/ecl/dict_index.ecl
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//nothor
//noroxie
import $.setup;
prefix := setup.Files(false, false).IndexPrefix;
d := dataset(
[{ '1', '2',
[{ '3' => '4'},
Expand All @@ -13,7 +15,7 @@ d := dataset(
}],
{ string1 a, string1 b, dictionary({string1 c1=>string1 c2}) c, string1 d });

i := index(d, {a,b}, {c,d}, 'test::dict');
i := index(d, {a,b}, {c,d}, prefix+'dict');

recordof(d) t(d L, i R) := TRANSFORM
self := R;
Expand Down
2 changes: 1 addition & 1 deletion testing/regress/ecl/dpat1.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ results :=
string tree := 'Tree: '+parseLib.getParseTree();
end;

outfile1 := PARSE(d,line,progeny,results,scan all);// : persist('kjv::relationships');
outfile1 := PARSE(d,line,progeny,results,scan all);

count(outfile1);
output(choosen(outfile1,1000));
Expand Down
30 changes: 2 additions & 28 deletions testing/regress/ecl/dpat3.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,13 @@ IMPORT * FROM lib_parselib;

r := record
string10000 line;
// unsigned integer8 __filepos { virtual(fileposition)};
end;
dp := dataset('~thor_data50::in::ktext',r,csv(separator('')));

r roll(r le, r ri) := transform
self.line := trim(le.line)+' '+trim(ri.line);
end;

//d := choosen(rollup(dp,right.line[4]<>':',roll(left,right)), 200);

//d := dataset([{'Ge 34:2 And when Shechem the son of Hamor the Hivite, prince of the country, saw her, he took her, and lay with her, and defiled her.'}],r);

d := dataset([
d := dataset([
{'Ge 34:2 And when Shechem the son of Hamor the Hivite, prince of the country, saw her, he took her, and lay with her, and defiled her.'},
{'Ge 36:10 These are the names of Esaus sons; Eliphaz the son of Adah the wife of Esau, Reuel the son of Bashemath the wife of Esau.'},
{'Ge 34:2 And when Shechem the son of Hamor the Hivite, prince of the country, saw her, he took her, and lay with her, and defiled her.'}],r);
Expand All @@ -57,28 +51,8 @@ results :=
string tree := 'Tree: '+parseLib.getParseTree();
end;

outfile1 := PARSE(d,line,progeny,results,scan all,matched(Name));// : persist('kjv::relationships');

//output(d);
/*results switch(results le) := transform
self.le := le.ri;
self.ri := le.le;
self := le;
end;
kids := project(outfile1(childphrase<>''),switch(left));
p_claims := outfile1(parentphrase<>'')+kids ;
results2 := record
string parent := p_claims.le;
string child := p_claims.ri;
unsigned4 cnt := count(group);
end;
t := table(p_claims,results2,le,ri);*/
outfile1 := PARSE(d,line,progeny,results,scan all,matched(Name));

//output(t);
count(outfile1);
output(choosen(outfile1,1000));

5 changes: 0 additions & 5 deletions testing/regress/ecl/dpat4.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ layout_actor_movie := record
unsigned1 movie_rank := (unsigned)(matchtext(m_rank/number));
end;

//Actor_Movie_Init := parse(accurint_test.File_Actors,IMDB_Actor_Desc,line,layout_actor_movie,whole,first);
d := dataset('~thor_data50::in::actors_list',{string inline},csv(separator('')));

Actor_Movie_Init := parse(File_Actors,inline,line,layout_actor_movie,whole,first);

// Iterate to propagate actor name
Expand All @@ -86,6 +83,4 @@ END;

Actor_Movie_Base := ITERATE(Actor_Movie_Init, PropagateName(LEFT, RIGHT));

//OUTPUT(CHOOSEN(Actor_Movie_Base,1000));
//count(Actor_Movie_Base)
OUTPUT(Actor_Movie_Init);
14 changes: 9 additions & 5 deletions testing/regress/ecl/dynamicoptflag.ecl
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,31 @@
limitations under the License.
############################################################################## */

#option ('warnOnImplicitReadLimit', true);
import $.setup;
prefix := setup.Files(false, false).FilePrefix;

#onwarning (4522, ignore);
d := dataset(DYNAMIC('regress::no::such::file'), {string10 f}, FLAT, OPT);
#onwarning (4523, ignore);

d := dataset(DYNAMIC(prefix + 'no_such_file'), {string10 f}, FLAT, OPT);
output(d);
count(d);
output(d(f='NOT'));
count(d(f='NOT'));

p := PRELOAD(dataset(DYNAMIC('regress::no::such::file::either'), {string10 f}, FLAT, OPT));
p := PRELOAD(dataset(DYNAMIC(prefix + 'no_such_file_either'), {string10 f}, FLAT, OPT));
output(p);
count(p);
output(p(f='NOT'));
count(p(f='NOT'));

p2 := PRELOAD(dataset(DYNAMIC('regress::no::such::file::again'), {string10 f}, FLAT, OPT), 2);
p2 := PRELOAD(dataset(DYNAMIC(prefix + 'no:_such_file_again'), {string10 f}, FLAT, OPT), 2);
output(p2);
count(p2);
output(p2(f='NOT'));
count(p2(f='NOT'));

i := INDEX(d,{f},{},DYNAMIC('regress::nor::this'), OPT);
i := INDEX(d,{f},{},DYNAMIC(prefix + 'nor_this'), OPT);
output(i);
count(i);
output(i(f='NOT'));
Expand Down
Loading

0 comments on commit f76d92a

Please sign in to comment.