From f09e440539cc07f7dbfbd1a49a1a0f67796d9646 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 10:27:11 +0200 Subject: [PATCH 1/8] fix attempt --- lib/Basics/process-utils.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Basics/process-utils.cpp b/lib/Basics/process-utils.cpp index f4abf7efa5..0f1c5e2960 100644 --- a/lib/Basics/process-utils.cpp +++ b/lib/Basics/process-utils.cpp @@ -293,7 +293,7 @@ static void StartExternalProcess (TRI_external_t* external, bool usePipes) { return; } - LOG_DEBUG("fork succeeded, child pid: %d", (int) processPid); + LOG_INFO("fork succeeded, child pid: %d", (int) processPid); if (usePipes) { close(pipe_server_to_child[0]); @@ -999,7 +999,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 +1031,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 ") + From ae99fbda3a7cf2a083bc5fb852762ea11f4f8563 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 10:43:40 +0200 Subject: [PATCH 2/8] added usleep for testing --- lib/Basics/process-utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Basics/process-utils.cpp b/lib/Basics/process-utils.cpp index 0f1c5e2960..739d0e7487 100644 --- a/lib/Basics/process-utils.cpp +++ b/lib/Basics/process-utils.cpp @@ -244,7 +244,7 @@ static void StartExternalProcess (TRI_external_t* external, bool usePipes) { // child process if (processPid == 0) { - + usleep(1000 * 1000); // TODO: just for testing, remove me // set stdin and stdout of child process if (usePipes) { dup2(pipe_server_to_child[0], 0); From 47bd3f060b71cbf87172cfff4e0eb70ea8aef634 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 10:52:25 +0200 Subject: [PATCH 3/8] increased sleep --- lib/Basics/process-utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Basics/process-utils.cpp b/lib/Basics/process-utils.cpp index 739d0e7487..e1811e6241 100644 --- a/lib/Basics/process-utils.cpp +++ b/lib/Basics/process-utils.cpp @@ -244,7 +244,7 @@ static void StartExternalProcess (TRI_external_t* external, bool usePipes) { // child process if (processPid == 0) { - usleep(1000 * 1000); // TODO: just for testing, remove me + usleep(5000 * 1000); // TODO: just for testing, remove me // set stdin and stdout of child process if (usePipes) { dup2(pipe_server_to_child[0], 0); From 47fece8a2268ca17e69518258482fcacb2273126 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 11:03:42 +0200 Subject: [PATCH 4/8] removed sleep --- lib/Basics/process-utils.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Basics/process-utils.cpp b/lib/Basics/process-utils.cpp index e1811e6241..66e04b5326 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) { - usleep(5000 * 1000); // TODO: just for testing, remove me // set stdin and stdout of child process if (usePipes) { dup2(pipe_server_to_child[0], 0); From 3886d6ef0915f40622190fb1af55ce17ef41d280 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 11:04:28 +0200 Subject: [PATCH 5/8] fixes for Visual Studio --- arangod/Aql/Arithmetic.h | 16 ++++++++-------- arangod/HashIndex/hash-array-multi.cpp | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) 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++; From fa926a48a7a731955c9806a4c049d7b3be1436c8 Mon Sep 17 00:00:00 2001 From: Willi Goesgens Date: Tue, 14 Oct 2014 11:04:45 +0200 Subject: [PATCH 6/8] Add timecritical option to the unittests --- ...i-async-spec.rb => api-async-spec-timecritical.rb} | 0 UnitTests/Makefile.unittests | 4 ++-- js/server/modules/org/arangodb/testing.js | 11 ++++++++--- ...js => shell-compaction-noncluster-timecritical.js} | 0 4 files changed, 10 insertions(+), 5 deletions(-) rename UnitTests/HttpInterface/{api-async-spec.rb => api-async-spec-timecritical.rb} (100%) rename js/server/tests/{shell-compaction-noncluster.js => shell-compaction-noncluster-timecritical.js} (100%) 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/js/server/modules/org/arangodb/testing.js b/js/server/modules/org/arangodb/testing.js index 323afa07b4..fca516dac5 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", @@ -489,6 +491,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 +513,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 +586,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 +604,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 +752,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 +773,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 From f3e72a80dc4fa075501d67c3de6ff5b8a5cd8517 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 11:13:01 +0200 Subject: [PATCH 7/8] fixed compile warnings --- arangod/V8Server/v8-user-structures.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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) { From 95cfbd705185250d15e3fb85d66a6e5ce8b09d04 Mon Sep 17 00:00:00 2001 From: Jan Steemann Date: Tue, 14 Oct 2014 11:18:16 +0200 Subject: [PATCH 8/8] test fix --- js/server/modules/org/arangodb/testing.js | 16 +++++++--------- lib/Basics/process-utils.cpp | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/js/server/modules/org/arangodb/testing.js b/js/server/modules/org/arangodb/testing.js index 323afa07b4..da1de2c620 100644 --- a/js/server/modules/org/arangodb/testing.js +++ b/js/server/modules/org/arangodb/testing.js @@ -253,7 +253,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 +420,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 +429,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 +443,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 }; } diff --git a/lib/Basics/process-utils.cpp b/lib/Basics/process-utils.cpp index 66e04b5326..d2b848e166 100644 --- a/lib/Basics/process-utils.cpp +++ b/lib/Basics/process-utils.cpp @@ -292,7 +292,7 @@ static void StartExternalProcess (TRI_external_t* external, bool usePipes) { return; } - LOG_INFO("fork succeeded, child pid: %d", (int) processPid); + LOG_DEBUG("fork succeeded, child pid: %d", (int) processPid); if (usePipes) { close(pipe_server_to_child[0]);