-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.js
90 lines (80 loc) · 2.77 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
const {c, cpp, node, python, java} = require('compile-run');
const {URL_GPP, URL_GCC, URL_PYTHON} = require('./src/env');
const LineReader = require('n-readlines');
const trataErroC = require('./src/util/trataErroC');
async function testCPPFiles(){
/*testa os erros atualmente suportados pela saída com debugger.
*/
let p = cpp.runFile("./tests/cpp/valgrind.cpp",
{
timeout : 3000,
compileTimeout : 60000,
//stdin : "1",
//stdin : "2",
//stdin : "3",
//stdin : "4",
//stdin : "7", //overlap src e dest in memcpy,
stdin : "9 dfaasdfhasdkfçjsaçdffaçldjfasflas fasdfas",
compilationPath : URL_GPP,
compilerArgs : "-lm",
stderrLimit : 2000,
stdoutLimit : 2000,
addressSanitizer : true
});
p.then(result => {
console.log("result");
console.log(result);//result object
if(result.debuggerReportFile){
//console.log(result.debuggerReportFile);
let errorSumary = trataErroC.getErrorInfo(result.debuggerReportFile, true, result.files);
console.log("Error Summary");
console.log(errorSumary.toString());
}
})
.catch(err => {
console.log("Error!");
console.log(err);
});
await p;
}
async function testCFiles(){
let p = c.runFile("./tests/c/errors.c",
{
timeout : 3000,
compileTimeout : 60000,
//stdin : "1",
//stdin : "2",
//stdin : "3",
//stdin : "4",
//stdin : "5",
//stdin : "6",
//stdin : "7",
//stdin : "8",
//stdin : "9",
//stdin : "10",
//stdin : "11",
stdin : "13",
compilerPath : URL_GCC,
compilerArgs : ['-lm'],
stderrLimit : 2000,
stdoutLimit : 2000,
addressSanitizer : true
});
p.then(result => {
console.log("result");
console.log(result);//result object
if(result.debuggerReportFile){
//console.log(result.debuggerReportFile);
let errorSumary = trataErroC.getErrorInfo(result.debuggerReportFile, true, result.files);
console.log("Error Summary");
console.log(errorSumary.toString());
}
})
.catch(err => {
console.log("Error!");
console.log(err);
});
await p;
}
testCFiles();
//testCPPFiles();