1
0
Fork 0

Merge branch 'devel' of ssh://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
James 2014-10-14 10:19:38 +01:00
commit 3442f298ea
8 changed files with 36 additions and 30 deletions

View File

@ -457,9 +457,9 @@ SHELL_SERVER_ONLY = \
@top_srcdir@/js/server/tests/shell-readonly-noncluster-disabled.js\ @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-wal-noncluster.js \
@top_srcdir@/js/server/tests/shell-sharding-helpers.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-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-transactions-noncluster.js \
@top_srcdir@/js/server/tests/shell-routing.js \ @top_srcdir@/js/server/tests/shell-routing.js \
@top_srcdir@/js/server/tests/shell-any-noncluster.js \ @top_srcdir@/js/server/tests/shell-any-noncluster.js \

View File

@ -35,37 +35,37 @@ namespace triagens {
template<typename T> template<typename T>
bool IsUnsafeAddition (T l, T r) { bool IsUnsafeAddition (T l, T r) {
return ((r > 0 && l > std::numeric_limits<T>::max() - r) || return ((r > 0 && l > (std::numeric_limits<T>::max)() - r) ||
(r < 0 && l < std::numeric_limits<T>::min() - r)); (r < 0 && l < (std::numeric_limits<T>::min)() - r));
} }
template<typename T> template<typename T>
bool IsUnsafeSubtraction (T l, T r) { bool IsUnsafeSubtraction (T l, T r) {
return ((r > 0 && l < std::numeric_limits<T>::min() + r) || (r < 0 && l > std::numeric_limits<T>::max() + r)); return ((r > 0 && l < (std::numeric_limits<T>::min)() + r) || (r < 0 && l > (std::numeric_limits<T>::max)() + r));
} }
template<typename T> template<typename T>
bool IsUnsafeMultiplication (T l, T r) { bool IsUnsafeMultiplication (T l, T r) {
if (l > 0) { if (l > 0) {
if (r > 0) { if (r > 0) {
if (l > (std::numeric_limits<T>::max() / r)) { if (l > ((std::numeric_limits<T>::max)() / r)) {
return true; return true;
} }
} }
else { else {
if (r < (std::numeric_limits<T>::min() / l)) { if (r < ((std::numeric_limits<T>::min)() / l)) {
return true; return true;
} }
} }
} }
else { else {
if (r > 0) { if (r > 0) {
if (l < (std::numeric_limits<T>::min() / r)) { if (l < ((std::numeric_limits<T>::min)() / r)) {
return true; return true;
} }
} }
else { else {
if ( (l != 0) && (r < (std::numeric_limits<T>::max() / l))) { if ( (l != 0) && (r < ((std::numeric_limits<T>::max)() / l))) {
return true; return true;
} }
} }
@ -76,7 +76,7 @@ namespace triagens {
template<typename T> template<typename T>
bool IsUnsafeDivision (T l, T r) { bool IsUnsafeDivision (T l, T r) {
return (l == std::numeric_limits<T>::min() && r == -1); return (l == (std::numeric_limits<T>::min)() && r == -1);
} }
} }

View File

@ -433,7 +433,7 @@ int TRI_ResizeHashArrayMulti (TRI_hash_array_multi_t* array,
// use less than 1 element per number of documents // use less than 1 element per number of documents
// we does this because expect duplicate values, which are stored in the overflow // we does this because expect duplicate values, which are stored in the overflow
// items (which are allocated separately) // items (which are allocated separately)
size_t targetSize = 0.75 * size; size_t targetSize = static_cast<size_t>(0.75 * size);
if ((targetSize & 1) == 0) { if ((targetSize & 1) == 0) {
// make odd // make odd
targetSize++; targetSize++;

View File

@ -683,23 +683,24 @@ class KeySpace {
if (found == nullptr) { if (found == nullptr) {
// TODO: change error code // TODO: change error code
return TRI_ERROR_INTERNAL; return false;
} }
else { else {
if (! TRI_IsListJson(found->json)) { if (! TRI_IsListJson(found->json)) {
// TODO: change error code // TODO: change error code
return TRI_ERROR_INTERNAL; return false;
} }
size_t const n = found->json->_value._objects._length; size_t const n = found->json->_value._objects._length;
if (index < 0) { if (index < 0) {
// TODO: change error code // TODO: change error code
return TRI_ERROR_INTERNAL; return false;
} }
auto json = TRI_ObjectToJson(value); auto json = TRI_ObjectToJson(value);
if (json == nullptr) { if (json == nullptr) {
return TRI_ERROR_OUT_OF_MEMORY; // TODO: change error code
return false;
} }
if (index >= static_cast<int64_t>(n)) { if (index >= static_cast<int64_t>(n)) {
@ -720,7 +721,7 @@ class KeySpace {
TRI_Free(TRI_UNKNOWN_MEM_ZONE, json); TRI_Free(TRI_UNKNOWN_MEM_ZONE, json);
} }
return TRI_ERROR_NO_ERROR; return true;
} }
char const* keyType (std::string const& key) { char const* keyType (std::string const& key) {

View File

@ -68,6 +68,7 @@
/// - `skipAhuacatl`: if set to true the ahuacatl tests are skipped /// - `skipAhuacatl`: if set to true the ahuacatl tests are skipped
/// - `skipAql`: if set to true the AQL tests are skipped /// - `skipAql`: if set to true the AQL tests are skipped
/// - `skipRanges`: if set to true the ranges 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 /// - `valgrind`: if set to true the arangods are run with the valgrind
/// memory checker /// memory checker
/// - `valgrindXmlFileBase`: string to prepend to the xml report name /// - `valgrindXmlFileBase`: string to prepend to the xml report name
@ -108,6 +109,7 @@ var optionsDefaults = { "cluster": false,
"skipBoost": false, "skipBoost": false,
"skipGeo": false, "skipGeo": false,
"skipAhuacatl": false, "skipAhuacatl": false,
"skipTimeCritical": false,
"skipAql": false, "skipAql": false,
"skipRanges": false, "skipRanges": false,
"username": "root", "username": "root",
@ -420,7 +422,7 @@ function executeAndWait (cmd, args) {
var errorMessage = ' - '; var errorMessage = ' - ';
if (res.status === "TERMINATED") { 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) { if (res.exit === 0) {
return { status: true, message: "", duration: deltaTime}; return { status: true, message: "", duration: deltaTime};
} }
@ -429,15 +431,13 @@ function executeAndWait (cmd, args) {
} }
} }
else if (res.status === "ABORTED") { else if (res.status === "ABORTED") {
// var toppid = executeExternal("/usr/bin/top", ["-b", "-n1"]);
if (typeof(res.errorMessage) !== 'undefined') { if (typeof(res.errorMessage) !== 'undefined') {
errorMessage += res.errorMessage; 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 { return {
status: false, status: false,
message: "irregular termination: " + res.status + " Exit-Signal: " + res.signal + errorMessage, message: "irregular termination: " + res.status + " exit signal: " + res.signal + errorMessage,
duration: deltaTime duration: deltaTime
}; };
} }
@ -445,10 +445,10 @@ function executeAndWait (cmd, args) {
if (typeof(res.errorMessage) !== 'undefined') { if (typeof(res.errorMessage) !== 'undefined') {
errorMessage += res.errorMessage; 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 { return {
status: res.status === 'RUNNING', status: false,
message: "irregular termination: " + res.status + " Exit-Code: " + res.exit + errorMessage, message: "irregular termination: " + res.status + " exit code: " + res.exit + errorMessage,
duration: deltaTime duration: deltaTime
}; };
} }
@ -489,6 +489,7 @@ function performTests(options, testList, testname) {
print("\nTrying",te,"..."); print("\nTrying",te,"...");
if ((te.indexOf("-cluster") === -1 || options.cluster) && if ((te.indexOf("-cluster") === -1 || options.cluster) &&
(te.indexOf("-noncluster") === -1 || options.cluster === false) && (te.indexOf("-noncluster") === -1 || options.cluster === false) &&
(te.indexOf("-timecritical") === -1 || options.skipTimeCritical === false) &&
(te.indexOf("-disabled") === -1)) { (te.indexOf("-disabled") === -1)) {
if (!continueTesting) { if (!continueTesting) {
@ -510,7 +511,7 @@ function performTests(options, testList, testname) {
continueTesting = checkInstanceAlive(instanceInfo); continueTesting = checkInstanceAlive(instanceInfo);
} }
else { else {
print("Skipped because of cluster/non-cluster or disabled."); print("Skipped because of cluster/non-cluster/timecritical or disabled.");
} }
} }
print("Shutting down..."); print("Shutting down...");
@ -583,6 +584,7 @@ testFuncs.shell_client = function(options) {
print("\nTrying",te,"..."); print("\nTrying",te,"...");
if ((te.indexOf("-cluster") === -1 || options.cluster) && if ((te.indexOf("-cluster") === -1 || options.cluster) &&
(te.indexOf("-noncluster") === -1 || options.cluster === false) && (te.indexOf("-noncluster") === -1 || options.cluster === false) &&
(te.indexOf("-timecritical") === -1 || options.skipTimeCritical === false) &&
(te.indexOf("-disabled") === -1)) { (te.indexOf("-disabled") === -1)) {
if (!continueTesting) { if (!continueTesting) {
@ -600,7 +602,7 @@ testFuncs.shell_client = function(options) {
continueTesting = checkInstanceAlive(instanceInfo); continueTesting = checkInstanceAlive(instanceInfo);
} }
else { else {
print("Skipped because of cluster/non-cluster."); print("Skipped because of cluster/non-cluster/timecritical.");
} }
} }
print("Shutting down..."); print("Shutting down...");
@ -748,6 +750,7 @@ function rubyTests (options, ssl) {
print("Considering",n,"..."); print("Considering",n,"...");
if ((n.indexOf("-cluster") === -1 || options.cluster) && if ((n.indexOf("-cluster") === -1 || options.cluster) &&
(n.indexOf("-noncluster") === -1 || options.cluster === false) && (n.indexOf("-noncluster") === -1 || options.cluster === false) &&
(n.indexOf("-timecritical") === -1 || options.skipTimeCritical === false) &&
n.indexOf("replication") === -1) { n.indexOf("replication") === -1) {
args = ["--color", "-I", fs.join("UnitTests","HttpInterface"), args = ["--color", "-I", fs.join("UnitTests","HttpInterface"),
"--format", "d", "--require", tmpname, "--format", "d", "--require", tmpname,
@ -768,7 +771,7 @@ function rubyTests (options, ssl) {
} }
else { else {
print("Skipped because of cluster/non-cluster or replication."); print("Skipped because of cluster/non-cluster/timecritical or replication.");
} }
} }
} }

View File

@ -244,7 +244,6 @@ static void StartExternalProcess (TRI_external_t* external, bool usePipes) {
// child process // child process
if (processPid == 0) { if (processPid == 0) {
// set stdin and stdout of child process // set stdin and stdout of child process
if (usePipes) { if (usePipes) {
dup2(pipe_server_to_child[0], 0); dup2(pipe_server_to_child[0], 0);
@ -999,7 +998,9 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
else { else {
opts = WNOHANG | WUNTRACED; opts = WNOHANG | WUNTRACED;
} }
res = waitpid(external->_pid, &loc, opts); res = waitpid(external->_pid, &loc, opts);
if (res == 0) { if (res == 0) {
if (wait) { if (wait) {
status._errorMessage = status._errorMessage =
@ -1029,8 +1030,9 @@ TRI_external_status_t TRI_CheckExternalProcess (TRI_external_id_t pid,
} }
else if (res == -1) { else if (res == -1) {
TRI_set_errno(TRI_ERROR_SYS_ERROR); 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) external->_pid,
(int) wait,
TRI_last_error()); TRI_last_error());
status._errorMessage = status._errorMessage =
std::string("waitpid returned error for pid ") + std::string("waitpid returned error for pid ") +