diff --git a/UnitTests/HttpInterface/api-async-spec.rb b/UnitTests/HttpInterface/api-async-spec-timecritical.rb similarity index 100% rename from UnitTests/HttpInterface/api-async-spec.rb rename to UnitTests/HttpInterface/api-async-spec-timecritical.rb diff --git a/UnitTests/Makefile.unittests b/UnitTests/Makefile.unittests index b725a50c61..1568b124b4 100755 --- a/UnitTests/Makefile.unittests +++ b/UnitTests/Makefile.unittests @@ -457,9 +457,9 @@ SHELL_SERVER_ONLY = \ @top_srcdir@/js/server/tests/shell-readonly-noncluster-disabled.js\ @top_srcdir@/js/server/tests/shell-wal-noncluster.js \ @top_srcdir@/js/server/tests/shell-sharding-helpers.js \ - @top_srcdir@/js/server/tests/shell-compaction-noncluster.js \ + @top_srcdir@/js/server/tests/shell-compaction-noncluster-timecritical.js \ @top_srcdir@/js/server/tests/shell-shaped-noncluster.js \ - @top_srcdir@/js/server/tests/shell-tasks.js \ + @top_srcdir@/js/server/tests/shell-tasks-timecritical.js \ @top_srcdir@/js/server/tests/shell-transactions-noncluster.js \ @top_srcdir@/js/server/tests/shell-routing.js \ @top_srcdir@/js/server/tests/shell-any-noncluster.js \ diff --git a/arangod/Aql/Arithmetic.h b/arangod/Aql/Arithmetic.h index 74754846d9..c619a305d5 100644 --- a/arangod/Aql/Arithmetic.h +++ b/arangod/Aql/Arithmetic.h @@ -35,37 +35,37 @@ namespace triagens { template bool IsUnsafeAddition (T l, T r) { - return ((r > 0 && l > std::numeric_limits::max() - r) || - (r < 0 && l < std::numeric_limits::min() - r)); + return ((r > 0 && l > (std::numeric_limits::max)() - r) || + (r < 0 && l < (std::numeric_limits::min)() - r)); } template bool IsUnsafeSubtraction (T l, T r) { - return ((r > 0 && l < std::numeric_limits::min() + r) || (r < 0 && l > std::numeric_limits::max() + r)); + return ((r > 0 && l < (std::numeric_limits::min)() + r) || (r < 0 && l > (std::numeric_limits::max)() + r)); } template bool IsUnsafeMultiplication (T l, T r) { if (l > 0) { if (r > 0) { - if (l > (std::numeric_limits::max() / r)) { + if (l > ((std::numeric_limits::max)() / r)) { return true; } } else { - if (r < (std::numeric_limits::min() / l)) { + if (r < ((std::numeric_limits::min)() / l)) { return true; } } } else { if (r > 0) { - if (l < (std::numeric_limits::min() / r)) { + if (l < ((std::numeric_limits::min)() / r)) { return true; } } else { - if ( (l != 0) && (r < (std::numeric_limits::max() / l))) { + if ( (l != 0) && (r < ((std::numeric_limits::max)() / l))) { return true; } } @@ -76,7 +76,7 @@ namespace triagens { template bool IsUnsafeDivision (T l, T r) { - return (l == std::numeric_limits::min() && r == -1); + return (l == (std::numeric_limits::min)() && r == -1); } } diff --git a/arangod/HashIndex/hash-array-multi.cpp b/arangod/HashIndex/hash-array-multi.cpp index f7b52bca6a..3b1d296c38 100644 --- a/arangod/HashIndex/hash-array-multi.cpp +++ b/arangod/HashIndex/hash-array-multi.cpp @@ -433,7 +433,7 @@ int TRI_ResizeHashArrayMulti (TRI_hash_array_multi_t* array, // use less than 1 element per number of documents // we does this because expect duplicate values, which are stored in the overflow // items (which are allocated separately) - size_t targetSize = 0.75 * size; + size_t targetSize = static_cast(0.75 * size); if ((targetSize & 1) == 0) { // make odd targetSize++; diff --git a/arangod/V8Server/v8-user-structures.cpp b/arangod/V8Server/v8-user-structures.cpp index ea4b6dcd90..8b689f02fc 100644 --- a/arangod/V8Server/v8-user-structures.cpp +++ b/arangod/V8Server/v8-user-structures.cpp @@ -683,23 +683,24 @@ class KeySpace { if (found == nullptr) { // TODO: change error code - return TRI_ERROR_INTERNAL; + return false; } else { if (! TRI_IsListJson(found->json)) { // TODO: change error code - return TRI_ERROR_INTERNAL; + return false; } size_t const n = found->json->_value._objects._length; if (index < 0) { // TODO: change error code - return TRI_ERROR_INTERNAL; + return false; } auto json = TRI_ObjectToJson(value); if (json == nullptr) { - return TRI_ERROR_OUT_OF_MEMORY; + // TODO: change error code + return false; } if (index >= static_cast(n)) { @@ -720,7 +721,7 @@ class KeySpace { TRI_Free(TRI_UNKNOWN_MEM_ZONE, json); } - return TRI_ERROR_NO_ERROR; + return true; } char const* keyType (std::string const& key) { diff --git a/js/server/modules/org/arangodb/testing.js b/js/server/modules/org/arangodb/testing.js index 323afa07b4..d19ab70394 100644 --- a/js/server/modules/org/arangodb/testing.js +++ b/js/server/modules/org/arangodb/testing.js @@ -68,6 +68,7 @@ /// - `skipAhuacatl`: if set to true the ahuacatl tests are skipped /// - `skipAql`: if set to true the AQL tests are skipped /// - `skipRanges`: if set to true the ranges tests are skipped +/// - `skipTimeCritical`: if set to true, time critical tests will be skipped. /// - `valgrind`: if set to true the arangods are run with the valgrind /// memory checker /// - `valgrindXmlFileBase`: string to prepend to the xml report name @@ -108,6 +109,7 @@ var optionsDefaults = { "cluster": false, "skipBoost": false, "skipGeo": false, "skipAhuacatl": false, + "skipTimeCritical": false, "skipAql": false, "skipRanges": false, "username": "root", @@ -253,7 +255,7 @@ function startInstance (protocol, options, addArgs, testname) { function checkInstanceAlive(instanceInfo) { var res = statusExternal(instanceInfo.pid, false); var ret = res.status === "RUNNING"; - if (!ret) { + if (! ret) { instanceInfo.exitStatus = res; } return ret; @@ -420,7 +422,7 @@ function executeAndWait (cmd, args) { var errorMessage = ' - '; if (res.status === "TERMINATED") { - print("Finished: " + res.status + " Exitcode: " + res.exit + " Time Elapsed: " + deltaTime); + print("Finished: " + res.status + " exit code: " + res.exit + " Time elapsed: " + deltaTime); if (res.exit === 0) { return { status: true, message: "", duration: deltaTime}; } @@ -429,15 +431,13 @@ function executeAndWait (cmd, args) { } } else if (res.status === "ABORTED") { -// var toppid = executeExternal("/usr/bin/top", ["-b", "-n1"]); if (typeof(res.errorMessage) !== 'undefined') { errorMessage += res.errorMessage; } -// statusExternal(toppid, true); - print("Finished: " + res.status + " Signal: " + res.signal + " Time Elapsed: " + deltaTime + errorMessage); + print("Finished: " + res.status + " Signal: " + res.signal + " Time elapsed: " + deltaTime + errorMessage); return { status: false, - message: "irregular termination: " + res.status + " Exit-Signal: " + res.signal + errorMessage, + message: "irregular termination: " + res.status + " exit signal: " + res.signal + errorMessage, duration: deltaTime }; } @@ -445,10 +445,10 @@ function executeAndWait (cmd, args) { if (typeof(res.errorMessage) !== 'undefined') { errorMessage += res.errorMessage; } - print("Finished: " + res.status + " Exitcode: " + res.signal + " Time Elapsed: " + deltaTime + errorMessage); + print("Finished: " + res.status + " exit code: " + res.signal + " Time elapsed: " + deltaTime + errorMessage); return { - status: res.status === 'RUNNING', - message: "irregular termination: " + res.status + " Exit-Code: " + res.exit + errorMessage, + status: false, + message: "irregular termination: " + res.status + " exit code: " + res.exit + errorMessage, duration: deltaTime }; } @@ -489,6 +489,7 @@ function performTests(options, testList, testname) { print("\nTrying",te,"..."); if ((te.indexOf("-cluster") === -1 || options.cluster) && (te.indexOf("-noncluster") === -1 || options.cluster === false) && + (te.indexOf("-timecritical") === -1 || options.skipTimeCritical === false) && (te.indexOf("-disabled") === -1)) { if (!continueTesting) { @@ -510,7 +511,7 @@ function performTests(options, testList, testname) { continueTesting = checkInstanceAlive(instanceInfo); } else { - print("Skipped because of cluster/non-cluster or disabled."); + print("Skipped because of cluster/non-cluster/timecritical or disabled."); } } print("Shutting down..."); @@ -583,6 +584,7 @@ testFuncs.shell_client = function(options) { print("\nTrying",te,"..."); if ((te.indexOf("-cluster") === -1 || options.cluster) && (te.indexOf("-noncluster") === -1 || options.cluster === false) && + (te.indexOf("-timecritical") === -1 || options.skipTimeCritical === false) && (te.indexOf("-disabled") === -1)) { if (!continueTesting) { @@ -600,7 +602,7 @@ testFuncs.shell_client = function(options) { continueTesting = checkInstanceAlive(instanceInfo); } else { - print("Skipped because of cluster/non-cluster."); + print("Skipped because of cluster/non-cluster/timecritical."); } } print("Shutting down..."); @@ -748,6 +750,7 @@ function rubyTests (options, ssl) { print("Considering",n,"..."); if ((n.indexOf("-cluster") === -1 || options.cluster) && (n.indexOf("-noncluster") === -1 || options.cluster === false) && + (n.indexOf("-timecritical") === -1 || options.skipTimeCritical === false) && n.indexOf("replication") === -1) { args = ["--color", "-I", fs.join("UnitTests","HttpInterface"), "--format", "d", "--require", tmpname, @@ -768,7 +771,7 @@ function rubyTests (options, ssl) { } else { - print("Skipped because of cluster/non-cluster or replication."); + print("Skipped because of cluster/non-cluster/timecritical or replication."); } } } diff --git a/js/server/tests/shell-compaction-noncluster.js b/js/server/tests/shell-compaction-noncluster-timecritical.js similarity index 100% rename from js/server/tests/shell-compaction-noncluster.js rename to js/server/tests/shell-compaction-noncluster-timecritical.js diff --git a/lib/Basics/process-utils.cpp b/lib/Basics/process-utils.cpp index f4abf7efa5..d2b848e166 100644 --- a/lib/Basics/process-utils.cpp +++ b/lib/Basics/process-utils.cpp @@ -244,7 +244,6 @@ static void StartExternalProcess (TRI_external_t* external, bool usePipes) { // child process if (processPid == 0) { - // set stdin and stdout of child process if (usePipes) { dup2(pipe_server_to_child[0], 0); @@ -999,7 +998,9 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid, else { opts = WNOHANG | WUNTRACED; } + res = waitpid(external->_pid, &loc, opts); + if (res == 0) { if (wait) { status._errorMessage = @@ -1029,8 +1030,9 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid, } else if (res == -1) { TRI_set_errno(TRI_ERROR_SYS_ERROR); - LOG_WARNING("waitpid returned error for pid %d: %s", + LOG_WARNING("waitpid returned error for pid %d (%d): %s", (int) external->_pid, + (int) wait, TRI_last_error()); status._errorMessage = std::string("waitpid returned error for pid ") +