diff --git a/Makefile.in b/Makefile.in index 6bb36fbbfe..74f02a81ff 100644 --- a/Makefile.in +++ b/Makefile.in @@ -5327,6 +5327,7 @@ unittests-brief: \ unittests-http-server \ unittests-ssl-server \ unittests-shell-client \ + unittests-arangob \ unittests-import unittests-verbose: @@ -5473,34 +5474,6 @@ unittests-shell-client: ################################################################################ ################################################################################ -.PHONY: unittests-import - -unittests-import: - $(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix - - @echo - @echo "================================================================================" - @echo "<< IMPORT TESTS >>" - @echo "================================================================================" - @echo - - $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1" - for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --type json || test "x$(FORCE)" == "x1"; done - for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done - $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1" - $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-teardown.js || test "x$(FORCE)" == "x1" - - kill `cat $(PIDFILE)` - - while test -f $(PIDFILE); do sleep 1; done - @if [ "$(VALGRIND)" != "" ]; then sleep 60; fi - - @rm -rf "$(VOCDIR)" - @echo - -################################################################################ -################################################################################ - .PHONY: unittests-http-server unittests-http-server: @@ -5546,6 +5519,34 @@ unittests-ssl-server: @rm -rf "$(VOCDIR)" @echo +################################################################################ +################################################################################ + +.PHONY: unittests-import + +unittests-import: + $(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix + + @echo + @echo "================================================================================" + @echo "<< IMPORT TESTS >>" + @echo "================================================================================" + @echo + + $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1" + for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --type json || test "x$(FORCE)" == "x1"; done + for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done + $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1" + $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-teardown.js || test "x$(FORCE)" == "x1" + + kill `cat $(PIDFILE)` + + while test -f $(PIDFILE); do sleep 1; done + @if [ "$(VALGRIND)" != "" ]; then sleep 60; fi + + @rm -rf "$(VOCDIR)" + @echo + .PHONY: unittests-bitarray-index unittests-bitarray-index: @@ -5564,6 +5565,34 @@ unittests-bitarray-index: @ rm -rf "$(VOCDIR)" @echo +################################################################################ +################################################################################ + +.PHONY: unittests-arangob + +@ENABLE_ARANGOB_TRUE@unittests-arangob: +@ENABLE_ARANGOB_TRUE@ $(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix + +@ENABLE_ARANGOB_TRUE@ @echo +@ENABLE_ARANGOB_TRUE@ @echo "================================================================================" +@ENABLE_ARANGOB_TRUE@ @echo "<< ARANGOB TESTS >>" +@ENABLE_ARANGOB_TRUE@ @echo "================================================================================" +@ENABLE_ARANGOB_TRUE@ @echo + +@ENABLE_ARANGOB_TRUE@ $(VALGRIND) @builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 1000 --batch-size 16 --concurrency 2 --test version || test "x$(FORCE)" == "x1" +@ENABLE_ARANGOB_TRUE@ $(VALGRIND) @builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --batch-size 0 --concurrency 1 --test version || test "x$(FORCE)" == "x1" + +@ENABLE_ARANGOB_TRUE@ kill `cat $(PIDFILE)` + +@ENABLE_ARANGOB_TRUE@ while test -f $(PIDFILE); do sleep 1; done +@ENABLE_ARANGOB_TRUE@ @if [ "$(VALGRIND)" != "" ]; then sleep 60; fi + +@ENABLE_ARANGOB_TRUE@ @rm -rf "$(VOCDIR)" +@ENABLE_ARANGOB_TRUE@ @echo + +@ENABLE_ARANGOB_FALSE@unittests-arangob: +@ENABLE_ARANGOB_FALSE@ @echo + ################################################################################ ### @brief source files ################################################################################ diff --git a/UnitTests/Makefile.files b/UnitTests/Makefile.files index d119d5fcab..a60e55c1b3 100755 --- a/UnitTests/Makefile.files +++ b/UnitTests/Makefile.files @@ -34,6 +34,7 @@ unittests-brief: \ unittests-http-server \ unittests-ssl-server \ unittests-shell-client \ + unittests-arangob \ unittests-import unittests-verbose: @@ -331,35 +332,6 @@ unittests-shell-client: @rm -rf "$(VOCDIR)" @echo -################################################################################ -## IMPORT TESTS -################################################################################ - -.PHONY: unittests-import - -unittests-import: - $(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix - - @echo - @echo "================================================================================" - @echo "<< IMPORT TESTS >>" - @echo "================================================================================" - @echo - - $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1" - for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --type json || test "x$(FORCE)" == "x1"; done - for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done - $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1" - $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-teardown.js || test "x$(FORCE)" == "x1" - - kill `cat $(PIDFILE)` - - while test -f $(PIDFILE); do sleep 1; done - @if [ "$(VALGRIND)" != "" ]; then sleep 60; fi - - @rm -rf "$(VOCDIR)" - @echo - ################################################################################ ## HTTP SERVER TESTS ################################################################################ @@ -411,6 +383,34 @@ unittests-ssl-server: @rm -rf "$(VOCDIR)" @echo +################################################################################ +## IMPORT TESTS +################################################################################ + +.PHONY: unittests-import + +unittests-import: + $(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix + + @echo + @echo "================================================================================" + @echo "<< IMPORT TESTS >>" + @echo "================================================================================" + @echo + + $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-setup.js || test "x$(FORCE)" == "x1" + for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.json --collection UnitTestsImportJson$$i --type json || test "x$(FORCE)" == "x1"; done + for i in 1 2; do $(VALGRIND) @builddir@/bin/arangoimp --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --file UnitTests/import-$$i.csv --collection UnitTestsImportCsv$$i --create-collection true --type csv || test "x$(FORCE)" == "x1"; done + $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import.js || test "x$(FORCE)" == "x1" + $(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --javascript.unit-tests @top_srcdir@/js/server/tests/import-teardown.js || test "x$(FORCE)" == "x1" + + kill `cat $(PIDFILE)` + + while test -f $(PIDFILE); do sleep 1; done + @if [ "$(VALGRIND)" != "" ]; then sleep 60; fi + + @rm -rf "$(VOCDIR)" + @echo ################################################################################ ## BITARRAY INDEXES TESTS @@ -437,3 +437,38 @@ unittests-bitarray-index: @ rm -rf "$(VOCDIR)" @echo + +################################################################################ +## ARANGOB TESTS +################################################################################ + +.PHONY: unittests-arangob + +if ENABLE_ARANGOB + +unittests-arangob: + $(MAKE) start-server PID=$(PID) SERVER_START="--server.endpoint unix://$(VOCDIR)/arango.sock --server.disable-authentication true" PROTO=unix + + @echo + @echo "================================================================================" + @echo "<< ARANGOB TESTS >>" + @echo "================================================================================" + @echo + + $(VALGRIND) @builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 1000 --batch-size 16 --concurrency 2 --test version || test "x$(FORCE)" == "x1" + $(VALGRIND) @builddir@/bin/arangob --configuration none --quiet --server.username "$(USERNAME)" --server.password "$(PASSWORD)" --server.endpoint unix://$(VOCDIR)/arango.sock --requests 100 --batch-size 0 --concurrency 1 --test version || test "x$(FORCE)" == "x1" + + kill `cat $(PIDFILE)` + + while test -f $(PIDFILE); do sleep 1; done + @if [ "$(VALGRIND)" != "" ]; then sleep 60; fi + + @rm -rf "$(VOCDIR)" + @echo + +else + +unittests-arangob: + @echo + +endif diff --git a/arangosh/V8Client/arangob.cpp b/arangosh/V8Client/arangob.cpp index 93b9736943..807cb15b22 100644 --- a/arangosh/V8Client/arangob.cpp +++ b/arangosh/V8Client/arangob.cpp @@ -409,20 +409,28 @@ int main (int argc, char* argv[]) { requestTime += threads[i]->getTime(); } - cout << endl; + size_t failures = operationsCounter.failures(); - cout << "Total number of operations: " << Operations << ", batch size: " << BatchSize << ", concurrency level (threads): " << Concurrency << endl; - cout << "Total request/response duration (sum of all threads): " << fixed << requestTime << " s" << endl; - cout << "Request/response duration (per thread): " << fixed << (requestTime / (double) Concurrency) << " s" << endl; - cout << "Time needed per operation: " << fixed << (time / Operations) << " s" << endl; - cout << "Time needed per operation per thread: " << fixed << (time / (double) Operations * (double) Concurrency) << " s" << endl; - cout << "Operations per second rate: " << fixed << ((double) Operations / time) << endl; - cout << "Elapsed time since start: " << fixed << time << " s" << endl; + if (! BaseClient.quiet()) { + cout << endl; + cout << "Total number of operations: " << Operations << ", batch size: " << BatchSize << ", concurrency level (threads): " << Concurrency << endl; + cout << "Total request/response duration (sum of all threads): " << fixed << requestTime << " s" << endl; + cout << "Request/response duration (per thread): " << fixed << (requestTime / (double) Concurrency) << " s" << endl; + cout << "Time needed per operation: " << fixed << (time / Operations) << " s" << endl; + cout << "Time needed per operation per thread: " << fixed << (time / (double) Operations * (double) Concurrency) << " s" << endl; + cout << "Operations per second rate: " << fixed << ((double) Operations / time) << endl; + cout << "Elapsed time since start: " << fixed << time << " s" << endl; - cout << endl; + cout << endl; - if (operationsCounter.failures() > 0) { - cout << "WARNING: " << operationsCounter.failures() << " request(s) failed!!" << endl << endl; + if (failures > 0) { + cerr << "WARNING: " << failures << " request(s) failed!!" << endl << endl; + } + } + else { + if (failures > 0) { + cerr << "WARNING: " << failures << " arangob request(s) failed!!" << endl; + } } for (int i = 0; i < Concurrency; ++i) { @@ -435,7 +443,7 @@ int main (int argc, char* argv[]) { TRIAGENS_REST_SHUTDOWN; - return EXIT_SUCCESS; + return (failures == 0) ? EXIT_SUCCESS : 2; } ////////////////////////////////////////////////////////////////////////////////