1
0
Fork 0

- make app folder a sub folder of the installation, so we don't get races.

- run the procdump window along with the tested arangod so we can analyse crashes.
This commit is contained in:
Willi Goesgens 2015-03-05 13:45:51 +01:00
parent 3a1559caa6
commit 9e7c429c0e
1 changed files with 32 additions and 22 deletions

View File

@ -217,13 +217,8 @@ function findTopDir () {
return topDir; return topDir;
} }
function findAppDir () { function makeTestingArgs (appDir) {
return fs.join(fs.getTempPath(), "js", "apps");
}
function makeTestingArgs () {
var topDir = findTopDir(); var topDir = findTopDir();
var appDir = findAppDir();
fs.makeDirectoryRecursive(appDir, true); fs.makeDirectoryRecursive(appDir, true);
return [ "--configuration", "none", return [ "--configuration", "none",
"--server.keyfile", fs.join(topDir, "UnitTests", "server.pem"), "--server.keyfile", fs.join(topDir, "UnitTests", "server.pem"),
@ -261,10 +256,12 @@ function startInstance (protocol, options, addArgs, testname) {
var instanceInfo = {}; var instanceInfo = {};
instanceInfo.topDir = topDir; instanceInfo.topDir = topDir;
var tmpDataDir = fs.getTempFile(); var tmpDataDir = fs.getTempFile();
var appDir;
instanceInfo.flatTmpDataDir = tmpDataDir; instanceInfo.flatTmpDataDir = tmpDataDir;
tmpDataDir = fs.join(tmpDataDir, testname); tmpDataDir = fs.join(tmpDataDir, testname);
appDir = fs.join(tmpDataDir, testname, "apps");
fs.makeDirectoryRecursive(tmpDataDir); fs.makeDirectoryRecursive(tmpDataDir);
instanceInfo.tmpDataDir = tmpDataDir; instanceInfo.tmpDataDir = tmpDataDir;
@ -273,7 +270,7 @@ function startInstance (protocol, options, addArgs, testname) {
var valgrindopts = []; var valgrindopts = [];
var dispatcher; var dispatcher;
if (options.cluster) { if (options.cluster) {
var extraargs = makeTestingArgs(); var extraargs = makeTestingArgs(appDir);
extraargs = extraargs.concat(options.extraargs); extraargs = extraargs.concat(options.extraargs);
if (addArgs !== undefined) { if (addArgs !== undefined) {
extraargs = extraargs.concat(addArgs); extraargs = extraargs.concat(addArgs);
@ -334,7 +331,7 @@ function startInstance (protocol, options, addArgs, testname) {
var pf = new PortFinder([8529 + options.portOffset],dispatcher); var pf = new PortFinder([8529 + options.portOffset],dispatcher);
var port = pf.next(); var port = pf.next();
instanceInfo.port = port; instanceInfo.port = port;
var args = makeTestingArgs(); var args = makeTestingArgs(appDir);
args.push("--server.endpoint"); args.push("--server.endpoint");
endpoint = protocol+"://127.0.0.1:"+port; endpoint = protocol+"://127.0.0.1:"+port;
args.push(endpoint); args.push(endpoint);
@ -386,6 +383,16 @@ function startInstance (protocol, options, addArgs, testname) {
} }
} }
print("up and Running in " + (time () - startTime) + " seconds"); print("up and Running in " + (time () - startTime) + " seconds");
if (!options.cluster && (require("internal").platform.substr(0,3) === 'win')) {
var procdumpArgs = [
'-accepteula',
'-e',
'-ma',
instanceInfo.pid.pid,
fs.join(tmpDataDir, 'core.dmp')
];
instanceInfo.monitor = executeExternal('procdump', procdumpArgs);
}
return instanceInfo; return instanceInfo;
} }
@ -437,7 +444,12 @@ function checkInstanceAlive(instanceInfo, options) {
instanceInfo.exitStatus = res; instanceInfo.exitStatus = res;
print(instanceInfo); print(instanceInfo);
if (res.hasOwnProperty('signal') && if (res.hasOwnProperty('signal') &&
((res.signal === 11) || (res.signal === 6))) ((res.signal === 11) ||
(res.signal === 6) ||
// Windows sometimes has random numbers in signal...
(require("internal").platform.substr(0,3) === 'win')
)
)
{ {
storeArangodPath = "/var/tmp/arangod_" + instanceInfo.pid.pid; storeArangodPath = "/var/tmp/arangod_" + instanceInfo.pid.pid;
print("Core dump written; copying arangod to " + print("Core dump written; copying arangod to " +
@ -446,6 +458,10 @@ function checkInstanceAlive(instanceInfo, options) {
storeArangodPath + storeArangodPath +
" /var/tmp/core*" + instanceInfo.pid.pid + "*'"; " /var/tmp/core*" + instanceInfo.pid.pid + "*'";
copy("bin/arangod", storeArangodPath); copy("bin/arangod", storeArangodPath);
if (require("internal").platform.substr(0,3) === 'win') {
// Windows: wait for procdump to do its job...
statusExternal(instanceInfo.monitor, true);
}
} }
} }
if (!ret) { if (!ret) {
@ -541,6 +557,10 @@ function shutdownInstance (instanceInfo, options) {
serverCrashed = true; serverCrashed = true;
break; break;
} }
if (require("internal").platform.substr(0,3) === 'win') {
// Windows: wait for procdump to do its job...
statusExternal(instanceInfo.monitor, true);
}
} }
else { else {
print("Server shutdown: Success."); print("Server shutdown: Success.");
@ -579,15 +599,6 @@ function cleanupDBDirectories(options) {
} }
} }
function cleanUpAppFolder() {
var path = findAppDir();
try {
fs.removeDirectoryRecursive(path, true);
} catch(e) {
// May not exist for various tests
}
}
function makePathUnix (path) { function makePathUnix (path) {
return fs.join.apply(null,path.split("/")); return fs.join.apply(null,path.split("/"));
} }
@ -1397,13 +1408,14 @@ testFuncs.upgrade = function (options) {
var tmpDataDir = fs.getTempFile(); var tmpDataDir = fs.getTempFile();
fs.makeDirectoryRecursive(tmpDataDir); fs.makeDirectoryRecursive(tmpDataDir);
var appDir = fs.join(tmpDataDir, "app");
// We use the PortFinder to find a free port for our subinstance, // We use the PortFinder to find a free port for our subinstance,
// to this end, we have to fake a dummy dispatcher: // to this end, we have to fake a dummy dispatcher:
var dispatcher = {endpoint: "tcp://127.0.0.1:", avoidPorts: [], id: "me"}; var dispatcher = {endpoint: "tcp://127.0.0.1:", avoidPorts: [], id: "me"};
var pf = new PortFinder([8529],dispatcher); var pf = new PortFinder([8529],dispatcher);
var port = pf.next(); var port = pf.next();
var args = makeTestingArgs(); var args = makeTestingArgs(appDir);
args.push("--server.endpoint"); args.push("--server.endpoint");
var endpoint = "tcp://127.0.0.1:"+port; var endpoint = "tcp://127.0.0.1:"+port;
args.push(endpoint); args.push(endpoint);
@ -1804,7 +1816,6 @@ function UnitTest (which, options) {
allok = false; allok = false;
} }
results.all_ok = allok; results.all_ok = allok;
cleanUpAppFolder();
} }
results.all_ok = allok; results.all_ok = allok;
results.crashed = serverCrashed; results.crashed = serverCrashed;
@ -1844,7 +1855,6 @@ function UnitTest (which, options) {
r.ok = ok; r.ok = ok;
results.all_ok = ok; results.all_ok = ok;
results.crashed = serverCrashed; results.crashed = serverCrashed;
cleanUpAppFolder();
if (allok) { if (allok) {
cleanupDBDirectories(options); cleanupDBDirectories(options);
} }