1
0
Fork 0

Merge branch 'devel' of github.com:arangodb/arangodb into devel

This commit is contained in:
hkernbach 2016-09-23 14:14:59 +02:00
commit 35e14fdab2
7 changed files with 154 additions and 114 deletions

View File

@ -99,6 +99,8 @@ function Run (testsuite) {
var tests = [];
var setUp;
var tearDown;
var setUpAll;
var tearDownAll;
if (definition.hasOwnProperty('setUp')) {
setUp = definition.setUp;
@ -108,16 +110,26 @@ function Run (testsuite) {
tearDown = definition.tearDown;
}
if (definition.hasOwnProperty('setUpAll')) {
setUpAll = definition.setUpAll;
}
if (definition.hasOwnProperty('tearDownAll')) {
tearDownAll = definition.tearDownAll;
}
var scope = {};
scope.setUp = setUp;
scope.tearDown = tearDown;
scope.setUpAll = setUpAll;
scope.tearDownAll = tearDownAll;
for (var key in definition) {
if (key.indexOf('test') === 0) {
var test = { name: key, fn: definition[key]};
tests.push(test);
} else if (key !== 'tearDown' && key !== 'setUp') {
} else if (key !== 'tearDown' && key !== 'setUp' && key !== 'tearDownAll' && key !== 'setUpAll') {
console.error('unknown function: %s', key);
}
}
@ -127,6 +139,8 @@ function Run (testsuite) {
suite.tests = tests;
suite.setUp = setUp;
suite.tearDown = tearDown;
suite.setUpAll = setUpAll;
suite.tearDownAll = tearDownAll;
var result = jsUnity.run(suite);
TOTAL += result.total;
@ -148,7 +162,6 @@ function Run (testsuite) {
// //////////////////////////////////////////////////////////////////////////////
function Done (suiteName) {
// console.log("%d total, %d passed, %d failed, %d ms", TOTAL, PASSED, FAILED, DURATION)
internal.printf('%d total, %d passed, %d failed, %d ms', TOTAL, PASSED, FAILED, DURATION);
print();

View File

@ -322,7 +322,7 @@ var jsUnity = exports.jsUnity = (function () {
if (typeof fn === "function") {
if (/^test/.test(name)) {
suite.tests.push({ name: name, fn: fn });
} else if (/^(setUp|tearDown)$/.test(name)) {
} else if (/^(setUp|tearDown|setUpAll|tearDownAll)$/.test(name)) {
suite[name] = fn;
}
}
@ -399,6 +399,8 @@ var jsUnity = exports.jsUnity = (function () {
this.tests = [];
this.setUp = undefined;
this.tearDown = undefined;
this.setUpAll = undefined;
this.tearDownAll = undefined;
},
TestResults: function () {
@ -486,63 +488,90 @@ var jsUnity = exports.jsUnity = (function () {
var setUp = getFixtureUtil("setUp", suite);
var tearDown = getFixtureUtil("tearDown", suite);
var setUpAll = getFixtureUtil("setUpAll", suite);
var tearDownAll = getFixtureUtil("tearDownAll", suite);
var runSuite;
for (var j = 0; j < cnt; j++) {
var test = suite.tests[j];
try {
setUpAll(suite.suiteName);
runSuite = true;
} catch (setUpAllError) {
runSuite = false;
if (setUpAllError.stack !== undefined) {
this.results.fail(0, suite.suiteName,
setUpAllError + " - " + String(setUpAllError.stack) +
" - setUpAll failed");
}
}
counter = 0;
if (runSuite) {
for (var j = 0; j < cnt; j++) {
var test = suite.tests[j];
try {
setUp(test.name);
test.fn.call(suite.scope, test.name);
tearDown(test.name);
counter = 0;
this.results.pass(j + 1, test.name);
results.passed++;
} catch (e) {
try {
tearDown(test.name); // if tearDown above throws exc, will call again!
}
catch (x) {
var xstack;
if (x.stack !== undefined) {
xstack = x.stack;
setUp(test.name);
test.fn.call(suite.scope, test.name);
tearDown(test.name);
this.results.pass(j + 1, test.name);
results.passed++;
} catch (e) {
try {
tearDown(test.name); // if tearDown above throws exc, will call again!
}
catch (x) {
var xstack;
if (x.stack !== undefined) {
xstack = x.stack;
}
if (e.stack !== undefined) {
this.results.fail(j + 1,
test.name,
e + " - " + String(e.stack) +
" - teardown failed - " +
x +
" - " +
xstack);
}
else {
this.results.fail(j + 1,
test.name,
e +
" - teardown failed - " +
x +
" - " +
xstack);
}
this.log.error("Teardown failed (again): " +
x +
" - " +
xstack +
" aborting tests");
i = arguments.length; j = cnt; break;
}
if (e.stack !== undefined) {
this.results.fail(j + 1,
test.name,
e + " - " + String(e.stack) +
" - teardown failed - " +
x +
" - " +
xstack);
this.results.fail(j + 1, test.name, e + " - " + String(e.stack));
}
else {
this.results.fail(j + 1,
test.name,
e +
" - teardown failed - " +
x +
" - " +
xstack);
this.results.fail(j + 1, test.name, e);
}
this.log.error("Teardown failed (again): " +
x +
" - " +
xstack +
" aborting tests");
i = arguments.length; j = cnt; break;
}
}
}
if (e.stack !== undefined) {
this.results.fail(j + 1, test.name, e + " - " + String(e.stack));
}
else {
this.results.fail(j + 1, test.name, e);
}
try {
tearDownAll(suite.suiteName);
} catch (tearDownAllError) {
if (tearDownAllError.stack !== undefined) {
this.results.fail(0, suite.suiteName,
tearDownAllError + " - " + String(tearDownAllError.stack) +
" - tearDownAll failed");
}
}
}

View File

@ -63,7 +63,7 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -125,7 +125,7 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -714,7 +714,7 @@ function ahuacatlQueryGeneralCommonTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop("UnitTestsAhuacatlVertex1");
db._drop("UnitTestsAhuacatlVertex2");
db._drop("UnitTestsAhuacatlEdge1");
@ -776,7 +776,7 @@ function ahuacatlQueryGeneralCommonTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop("UnitTestsAhuacatlVertex1");
db._drop("UnitTestsAhuacatlVertex2");
db._drop("UnitTestsAhuacatlEdge1");
@ -998,7 +998,7 @@ function ahuacatlQueryGeneralPathsTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop("UnitTestsAhuacatlVertex1");
db._drop("UnitTestsAhuacatlVertex2");
db._drop("UnitTestsAhuacatlVertex3");
@ -1056,7 +1056,7 @@ function ahuacatlQueryGeneralPathsTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop("UnitTestsAhuacatlVertex1");
db._drop("UnitTestsAhuacatlVertex2");
db._drop("UnitTestsAhuacatlVertex3");
@ -1236,7 +1236,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop("UnitTests_Berliner");
db._drop("UnitTests_Hamburger");
db._drop("UnitTests_Frankfurter");
@ -1303,7 +1303,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
graph._drop("werKenntWen", true);
},
@ -2062,7 +2062,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop("UnitTests_Berliner");
db._drop("UnitTests_Hamburger");
db._drop("UnitTests_Frankfurter");
@ -2125,7 +2125,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop("UnitTests_Berliner");
db._drop("UnitTests_Hamburger");
db._drop("UnitTests_Frankfurter");
@ -2496,7 +2496,7 @@ function ahuacatlQueryMultiCollectionMadnessTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -2540,7 +2540,7 @@ function ahuacatlQueryMultiCollectionMadnessTestSuite() {
graph._registerCompatibilityFunctions();
},
tearDown: function () {
tearDownAll: function () {
graph._drop(gN, true);
},
@ -2596,8 +2596,3 @@ jsunity.run(ahuacatlQueryGeneralEdgesTestSuite);
jsunity.run(ahuacatlQueryMultiCollectionMadnessTestSuite);
return jsunity.done();
// Local Variables:
// mode: outline-minor
// outline-regexp: "^\\(/// @brief\\|/// @addtogroup\\|// --SECTION--\\|/// @page\\|/// @}\\)"
// End:

View File

@ -73,7 +73,7 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -134,7 +134,7 @@ function ahuacatlQueryGeneralEdgesTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -682,7 +682,7 @@ function ahuacatlQueryGeneralCommonTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop("UnitTestsAhuacatlVertex1");
db._drop("UnitTestsAhuacatlVertex2");
db._drop("UnitTestsAhuacatlEdge1");
@ -743,7 +743,7 @@ function ahuacatlQueryGeneralCommonTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop("UnitTestsAhuacatlVertex1");
db._drop("UnitTestsAhuacatlVertex2");
db._drop("UnitTestsAhuacatlEdge1");
@ -1024,7 +1024,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -1090,7 +1090,7 @@ function ahuacatlQueryGeneralTraversalTestSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
graph._drop("werKenntWen", true);
},
@ -1358,7 +1358,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -1420,7 +1420,7 @@ function ahuacatlQueryGeneralCyclesSuite() {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown: function () {
tearDownAll: function () {
db._drop("UnitTests_Berliner");
db._drop("UnitTests_Hamburger");
db._drop("UnitTests_Frankfurter");
@ -1524,7 +1524,7 @@ function ahuacatlQueryMultiCollectionMadnessTestSuite() {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -1567,7 +1567,7 @@ function ahuacatlQueryMultiCollectionMadnessTestSuite() {
);
},
tearDown: function () {
tearDownAll: function () {
graph._drop(gN, true);
},
@ -1615,7 +1615,7 @@ function ahuacatlQueryShortestPathTestSuite() {
const graphName = "abc";
return {
setUp: function () {
setUpAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);
@ -1672,7 +1672,7 @@ function ahuacatlQueryShortestPathTestSuite() {
makeEdge(B._id, A._id, g[e2], 2);
},
tearDown: function () {
tearDownAll: function () {
db._drop(v1);
db._drop(v2);
db._drop(v3);

View File

@ -101,7 +101,7 @@ function namedGraphSuite () {
return {
setUp: function() {
setUpAll: function() {
opts.allPlans = true;
opts.verbosePlans = true;
cleanup();
@ -114,7 +114,7 @@ function namedGraphSuite () {
g = gm._create(gn, [gm._relation(en, vn, vn)]);
},
tearDown: function () {
tearDownAll: function () {
gm._drop(gn);
cleanup();
},
@ -432,7 +432,7 @@ function multiCollectionGraphSuite () {
return {
setUp: function() {
setUpAll: function() {
opts.allPlans = true;
opts.verbosePlans = true;
cleanup();
@ -449,7 +449,7 @@ function multiCollectionGraphSuite () {
db[en2].save(vn2 + "/G", vn + "/D", {});
},
tearDown: function() {
tearDownAll: function() {
gm._drop(gn);
db._drop(vn2);
db._drop(en2);
@ -946,7 +946,7 @@ function multiEdgeCollectionGraphSuite () {
return {
setUp: function() {
setUpAll: function() {
opts.allPlans = true;
opts.verbosePlans = true;
cleanup();
@ -974,7 +974,7 @@ function multiEdgeCollectionGraphSuite () {
edge.EA = ec2.save(vertex.E, vertex.A, {})._id;
},
tearDown: function() {
tearDownAll: function() {
gm._drop(gn);
db._drop(vn);
db._drop(en);
@ -1009,7 +1009,7 @@ function potentialErrorsSuite () {
return {
setUp: function () {
setUpAll: function () {
cleanup();
vc = db._create(vn);
ec = db._createEdgeCollection(en);
@ -1020,7 +1020,7 @@ function potentialErrorsSuite () {
ec.save(vertex.B, vertex.C, {});
},
tearDown: cleanup,
tearDownAll: cleanup,
testNonIntegerSteps: function () {
var query = "FOR x IN 2.5 OUTBOUND @startId @@eCol RETURN x";
@ -1446,7 +1446,7 @@ function optimizeInSuite () {
return {
setUp: function () {
setUpAll: function () {
cleanup();
vc = db._create(vn, {numberOfShards: 4});
ec = db._createEdgeCollection(en, {numberOfShards: 4});
@ -1462,7 +1462,7 @@ function optimizeInSuite () {
}
},
tearDown: cleanup,
tearDownAll: cleanup,
testSingleOptimize: function () {
var vertexQuery = `WITH ${vn}
@ -1660,7 +1660,7 @@ function complexFilteringSuite () {
***********************************************************************/
return {
setUp: function() {
setUpAll: function() {
cleanup();
var vc = db._create(vn, {numberOfShards: 4});
var ec = db._createEdgeCollection(en, {numberOfShards: 4});
@ -1688,7 +1688,7 @@ function complexFilteringSuite () {
edge.Tri31 = ec.save(vertex.Tri3, vertex.Tri1, {isLoop: true, lateLoop: true})._id;
},
tearDown: cleanup,
tearDownAll: cleanup,
testVertexEarlyPruneHighDepth: function () {
var query = `WITH ${vn}
@ -2071,7 +2071,7 @@ function brokenGraphSuite () {
return {
setUp: function () {
setUpAll: function () {
cleanup();
vc = db._create(vn, {numberOfShards: 4});
ec = db._createEdgeCollection(en, {numberOfShards: 4});
@ -2083,7 +2083,7 @@ function brokenGraphSuite () {
ec.save(vn + "/missing", vertex.B, {});
},
tearDown: cleanup,
tearDownAll: cleanup,
testRequestMissingVertex: function () {
var query = `WITH ${vn} FOR x IN OUTBOUND @startId @@eCol RETURN x._id`;
@ -2185,7 +2185,7 @@ function multiEdgeDirectionSuite () {
return {
setUp: function () {
setUpAll: function () {
cleanup();
db._drop(en2);
@ -2216,7 +2216,7 @@ function multiEdgeDirectionSuite () {
ec.save(vertex.E, vertex.F, {});
},
tearDown: function () {
tearDownAll: function () {
cleanup();
db._drop(en2);
},
@ -2315,7 +2315,7 @@ function subQuerySuite () {
*
*/
setUp: function () {
setUpAll: function () {
cleanup();
vc = db._create(vn, {numberOfShards: 4});
ec = db._createEdgeCollection(en, {numberOfShards: 4});
@ -2374,7 +2374,7 @@ function subQuerySuite () {
ec.save(vertex.D, vertex.D5, {});
},
tearDown: function () {
tearDownAll: function () {
try {
gm._drop(gn);
} catch (e) {
@ -2659,7 +2659,7 @@ function optimizeQuantifierSuite() {
let edges = {};
return {
setUp: function () {
setUpAll: function () {
cleanup();
vc = db._create(vn, {numberOfShards: 4});
ec = db._createEdgeCollection(en, {numberOfShards: 4});
@ -2687,7 +2687,7 @@ function optimizeQuantifierSuite() {
gm._create(gn, [gm._relation(en, vn, vn)]);
},
tearDown: function () {
tearDownAll: function () {
try {
gm._drop(gn);
} catch (e) {

View File

@ -52,7 +52,7 @@ function ahuacatlQueryEdgesTestSuite () {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
setUpAll : function () {
db._drop(vn);
db._drop("UnitTestsAhuacatlEdge");
@ -86,7 +86,7 @@ function ahuacatlQueryEdgesTestSuite () {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
tearDownAll : function () {
db._drop("UnitTestsAhuacatlVertex");
db._drop("UnitTestsAhuacatlEdge");
},
@ -410,7 +410,7 @@ function ahuacatlQueryNeighborsTestSuite () {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
setUpAll : function () {
db._drop(vn);
db._drop("UnitTestsAhuacatlEdge");
@ -444,7 +444,7 @@ function ahuacatlQueryNeighborsTestSuite () {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
tearDownAll : function () {
db._drop(vn);
db._drop("UnitTestsAhuacatlEdge");
},
@ -673,7 +673,7 @@ function ahuacatlQueryBreadthFirstTestSuite () {
/// +--> C <--+
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
setUpAll : function () {
cleanUp();
vertex = db._create(vn);
@ -709,7 +709,7 @@ function ahuacatlQueryBreadthFirstTestSuite () {
makeEdge("C","A","friend");
},
tearDown : cleanUp,
tearDownAll : cleanUp,
testNonUniqueVerticesDefaultDepth : function() {
var query = `WITH ${vn}
@ -843,7 +843,7 @@ function ahuacatlQueryShortestPathTestSuite () {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
setUpAll : function () {
db._drop(vn);
db._drop(en);
@ -866,7 +866,7 @@ function ahuacatlQueryShortestPathTestSuite () {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
tearDownAll : function () {
db._drop(vn);
db._drop(en);
@ -1005,7 +1005,7 @@ function ahuacatlQueryNeighborsErrorsSuite () {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
setUpAll : function () {
db._drop(vn);
db._drop(en);
internal.debugClearFailAt();
@ -1028,7 +1028,7 @@ function ahuacatlQueryNeighborsErrorsSuite () {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
tearDownAll : function () {
db._drop(vn);
db._drop(en);
internal.debugClearFailAt();
@ -1094,7 +1094,7 @@ function ahuacatlQueryShortestpathErrorsSuite () {
/// @brief set up
////////////////////////////////////////////////////////////////////////////////
setUp : function () {
setUpAll : function () {
db._drop(vn);
db._drop(en);
internal.debugClearFailAt();
@ -1117,7 +1117,7 @@ function ahuacatlQueryShortestpathErrorsSuite () {
/// @brief tear down
////////////////////////////////////////////////////////////////////////////////
tearDown : function () {
tearDownAll : function () {
db._drop(vn);
db._drop(en);
internal.debugClearFailAt();

View File

@ -1,6 +1,9 @@
#!/bin/bash
if [ -z "$XTERM" ] ; then
XTERM=xterm
XTERM=x-terminal-emulator
fi
if [ -z "$XTERMOPTIONS" ] ; then
XTERMOPTIONS="--geometry=80x43"
fi
if [ ! -d arangod ] || [ ! -d arangosh ] || [ ! -d UnitTests ] ; then