Skip to content

Commit eefc324

Browse files
committed
Skip test file on statement error
1 parent 7b12fe7 commit eefc324

File tree

3 files changed

+37
-225
lines changed

3 files changed

+37
-225
lines changed

results.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# SQLlogictest results for AlaSQL 0.2.1
2+
3+
_2015-11-30T18:59:33.355Z_
4+
5+
This is a subset of the total 622 tests.
6+
Results from 1 test files:
7+
8+
---- ---- ---- ---- ---- ---- ----
9+
### 1/1 [`./test/select5.test`](https://github.com/mathiasrw/alasql-logictest/blob/master/sqllogic/./test/select5.test)
10+
11+
_Mimic sqlite_

sqllogic/run_md.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@ var util = require('util');
77
var pretty = require('prettysize');
88
var md5 = require("MD5");
99
var comparray = require('comparray');
10-
var sqllogictestparser = require('./sqllogictestparserV2');
11-
var alasql = require('./alasql');
10+
var sqllogictestparser = require(__dirname+'/sqllogictestparserV2');
11+
var alasql = require('alasql');
1212
//var sql = require('sql.js');
1313

1414
console.time('Total script time');
1515

1616

1717
//////////////////////////// CONFIG START /////////////////////////////////////
1818

19-
// Incomment to use local file instead of node_module
20-
alasql = require('./alasql.js');
19+
// outcomment to use node_module version instead of local file
20+
// alasql = require(__dirname+'/alasql');
2121

2222
// If set to false an error will only be printed first time ic occures in all test files.
2323
var printAllErrors = false;
@@ -42,18 +42,19 @@ var debugErrorInfo = false;
4242

4343
// Config of what tests to run
4444
var testfiles = walkFiles(
45-
'test', // Folder where to find test files
45+
'./test', // Folder where to find test files
4646

4747

4848
/\.test$/, // Regexp for files to include (all files ending with .test )
4949

5050

5151
// Regexp for files to exclude - keep one and outcomment the rest
52-
/00\/|\d{2,}\.test/ // Exclude a lot of files (fastest - 125 files)
52+
// /00\/|\d{2,}\.test/ // Exclude a lot of files (fastest - 125 files)
5353
// /\/10+\// // exclude biggest files (balance between time and depth) (410 files)
54-
// null // Exclude no files - As all tests contains a few million tests it can take some time. (622+ files)
54+
null // Exclude no files - As all tests contains a few million tests it can take some time. (622+ files)
5555
);
5656
//testfiles=['test/index/between/10/slt_good_0.test'];
57+
//testfiles=['./test/select5.test'];
5758

5859
//What databases to mimic when running tests
5960
var mimic = [
@@ -170,15 +171,22 @@ for (var i in testfiles) {
170171
for (mimicking = 0; mimicking < mimic.length; mimicking++) {
171172

172173
var name = testfiles[i].replace(/[^a-z0-9]/mig,'_') + mimic[mimicking];
174+
173175
var db = new alasql.Database(name);
176+
177+
/*
178+
var db = alasqlFn();
179+
db.options.modifier = "MATRIX";
180+
db.options.cache = false;
181+
*/
174182

175183
if(useSqliteDb){
176184
db = new sql.Database();
177185
}
178186

179187
score.round.init();
180188

181-
runSQLtestFromFile(testfiles[i], db, mimic[mimicking]);
189+
runSQLtestFromFile(__dirname+'/'+testfiles[i], db, mimic[mimicking]);
182190

183191
var roundCount = score.round.stat();
184192
if(0===roundCount.total){
@@ -324,7 +332,7 @@ function runSQLtestFromFile(path, db, mimic){
324332
// The hashing of the errors gives us first error per error type. The math random is there to give os 1% of all errors so we have some different examples. Should be avoided when we have the worst error types implemented correctly.
325333
if(statementFaild || printAllErrors || !erroIndex[errHash] || Math.random()<curiousErrorprinting){
326334

327-
335+
//console.log(JSON.stringify(db.tables, null, 4));
328336

329337
console.log('');
330338
console.log('```sql');

sqllogic/sqllogictestparserV2.js

Lines changed: 9 additions & 216 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,6 @@
1-
/*
2-
3-
var fs = require('fs');
4-
5-
6-
var parserPath = './parser.txt'
7-
var parserDescription = fs.readFileSync(parserPath, "ASCII");
8-
var testDescription = fs.readFileSync(testPath, "ASCII");
9-
10-
console.log('Creating parser')
11-
var parser = PEG.buildParser(parserDescription);
12-
console.log('Parser OK')
13-
console.log('')
14-
15-
16-
console.log('Parseing test')
17-
console.log(parser.parse(testDescription));
18-
19-
20-
21-
22-
23-
24-
25-
26-
27-
*/
28-
291
var fs = require('fs');
302
var PEG = require("pegjs");
31-
var _parserPath = 'parser.peg';
3+
var _parserPath = __dirname+'/parser.peg';
324
//console.log('Initializing parser');
335
//console.time('Parser OK');
346
var _parserDescription = fs.readFileSync(_parserPath, "ASCII");
@@ -45,7 +17,7 @@ module.exports = function(path) {
4517

4618
var parser = _parser;
4719

48-
var commands = []
20+
var commands = [];
4921

5022
var fileContent = fs.readFileSync(path, "ASCII");
5123

@@ -63,7 +35,7 @@ module.exports = function(path) {
6335
for (var i = 0; i < textCommands.length; i++) {
6436

6537

66-
if(''==textCommands[i]){
38+
if(''===textCommands[i]){
6739
continue;
6840
}
6941

@@ -72,203 +44,24 @@ module.exports = function(path) {
7244
commands.push(parser.parse(textCommands[i]+"\n"));
7345
}catch(e){
7446
// output if could not be passed
75-
console.log('************ Error parseing test number', (i+1), 'in file', path)
47+
console.log('************ Error parseing test number', (i+1), 'in file', path);
7648
console.log('previus one (passed):',textCommands[i-1]);
7749
console.log('this one (failed):', textCommands[i]);
7850
if(i+1 < textCommands.length)
7951
console.log('Next test to be passed:', textCommands[i+1]);
80-
console.log('')
81-
console.log(JSON.stringify({error:e.message}))
82-
console.log('----------------')
83-
console.log('')
52+
console.log('');
53+
console.log(JSON.stringify({error:e.message}));
54+
console.log('----------------');
55+
console.log('');
8456
}
8557

8658

8759

88-
};
60+
}
8961

9062

9163
return commands;
9264

9365

9466

9567
};
96-
97-
/*
98-
99-
{
100-
function doInt(o) {
101-
return parseInt(o.join(""), 10);
102-
}
103-
104-
}
105-
106-
start
107-
= nl* c:command trim? {return c}
108-
109-
trim
110-
= ([\n\t ]*)
111-
112-
113-
command
114-
= statement
115-
/ query
116-
/ hash
117-
/ halt
118-
119-
120-
121-
halt
122-
= "halt"i
123-
{
124-
return {
125-
command:'halt'
126-
}
127-
}
128-
129-
hash
130-
= "hash-threshold" _ maxResponses:[0-9]+
131-
{
132-
return {
133-
command: 'setThreshold',
134-
maxResponses: doInt(maxResponses)
135-
}
136-
}
137-
138-
statement
139-
= expect:statementExpectation _* nl sql:sql
140-
{
141-
return {
142-
command: 'execute',
143-
expectSucess: expect,
144-
sql:sql
145-
}
146-
}
147-
148-
statementExpectation
149-
= "statement"i ' ' v:statementOption {return v}
150-
151-
statementOption
152-
= "ok"i {return true}
153-
/ "fail"i {return false}
154-
155-
156-
sql
157-
= result: (
158-
t:(!delimitor .) {return t[1];}
159-
)*
160-
delimitor {return result.join("");}
161-
162-
delimitor
163-
= '\n----'
164-
/ !.
165-
166-
query
167-
= queryInit:queryInit?
168-
queryMain:queryMain nl
169-
sql:sql nl
170-
result:result
171-
{
172-
return {
173-
command: 'execute',
174-
expectSucess: true,
175-
sql: sql,
176-
result: result,
177-
skipif: queryInit.skipif || false,
178-
onlyif: queryInit.onlyif || false,
179-
}
180-
}
181-
182-
nl
183-
= "\n"
184-
185-
result
186-
= resultHash
187-
/ resultList
188-
/ resultVoid
189-
190-
resultHash
191-
= amount:$[0-9]+
192-
" values hashing to "
193-
hash:alphanum
194-
{
195-
return {
196-
type:'hash',
197-
amount: amount,
198-
hash:hash
199-
}
200-
}
201-
202-
203-
resultList
204-
= list:(v:$[^\n]+ nl{return v})+
205-
{
206-
console.log(list)
207-
return {
208-
type:'list',
209-
values: list
210-
}
211-
}
212-
213-
resultVoid
214-
= nl* !.
215-
{
216-
return{
217-
type:"void"
218-
}
219-
220-
}
221-
222-
223-
queryInit
224-
= c:queryInitCommand*
225-
{
226-
var skipif = [];
227-
var onlyif = [];
228-
for (var i = c.length - 1; i >= 0; i--) {
229-
if('skip' == c[i].type){
230-
skipif.push(c[i].val);
231-
} else if('only' == c[i].type){
232-
onlyif.push(c[i].val);
233-
}
234-
};
235-
return {skipif:skipif,onlyif:onlyif}
236-
}
237-
238-
queryInitCommand
239-
= "skipif"i ' ' v:alphanum nl {return {type:'skip', val: v}}
240-
/ "onlyif"i ' ' v:alphanum nl {return {type:'only', val: v}}
241-
242-
243-
queryMain
244-
= "query"i _ colInfo _ sortInfo
245-
246-
skipif
247-
= "skipif"i _ alphanum
248-
249-
250-
colInfo
251-
= [SDI]+
252-
253-
sortInfo
254-
= "nosort"i
255-
/ "rowsort"i
256-
257-
258-
alphanum
259-
= $[a-z0-9]i+
260-
261-
262-
_
263-
= ' '
264-
265-
266-
267-
268-
269-
270-
271-
272-
273-
274-
*/

0 commit comments

Comments
 (0)