Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: dcf09cf899
Fetching contributors…

Cannot retrieve contributors at this time

executable file 322 lines (243 sloc) 13.128 kb
# -*- mode: Makefile; -*-
FORCE = 0
SKIP_BOOST = 0
VALGRIND =
################################################################################
## unittests target
################################################################################
.PHONY: unittests unittests-brief unittests-verbose
unittests: unittests-verbose unittests-brief
unittests-brief: \
unittests-boost \
unittests-shell-server \
unittests-shell-server-ahuacatl \
unittests-http-server \
unittests-shell-client
unittests-verbose:
@echo "################################################################################"
@echo "## ##"
@echo "## ArangoDB Unit-Tests ##"
@echo "## ##"
@echo "## > make unittests ##"
@echo "## > make unittests FORCE=1 ##"
@echo "## > make unittests SKIP_BOOST=1 ##"
@echo "## > make unittests SKIP_GEO=1 ##"
@echo "## > make unittests SKIP_RANGES=1 ##"
@echo "## > make unittests VALGRIND=valgrind ##"
@echo "## ##"
@echo "################################################################################"
@echo
@sleep 1
################################################################################
## start the arango server
################################################################################
PID := $(shell echo $$PPID)
PIDFILE := /tmp/arango.$(PID).pid
VOCDIR := /tmp/vocdir.$(PID)
VOCPORT := $(shell printf "3%04d" `expr $(PID) % 10000`)
VOCHOST := 127.0.0.1
SERVER_OPT := --configuration none --javascript.startup-directory ./js --javascript.modules-path ./js/server/modules:./js/common/modules --javascript.action-directory ./js/actions/system --database.maximal-journal-size 1000000 --javascript.gc-interval 1
CLIENT_OPT := --javascript.startup-directory ./js --javascript.modules-path ./js/client/modules:./js/common/modules --no-colors --quiet
STARTFILE := $(VOCDIR)/startup
.PHONY: start-server
start-server:
@echo
@echo "================================================================================"
@echo "<< STARTING SERVER >>"
@echo "================================================================================"
@echo
rm -f "$(PIDFILE)"
rm -rf "$(VOCDIR)"
mkdir -p "$(VOCDIR)"
@test -d "$(VOCDIR)"
($(VALGRIND) @builddir@/bin/arangod "$(VOCDIR)" $(SERVER_OPT) --pid-file $(PIDFILE) --watch-process $(PID) --server.http-port $(VOCHOST):$(VOCPORT) && rm -rf "$(VOCDIR)") &
while [ ! -s "$(STARTFILE)" ]; do curl -s "http://$(VOCHOST):$(VOCPORT)/_api/version" > "$(STARTFILE)" || sleep 2; done
@rm "$(STARTFILE)"
@echo "server has been started."
@if [ "$(VALGRIND)" != "" ]; then echo "adding valgrind memorial time..."; sleep 30; else sleep 2; fi
@echo
################################################################################
## BOOST TESTS
################################################################################
.PHONY: unittests-boost
if ENABLE_BOOST_TEST
unittests-boost: UnitTests/basics_suite UnitTests/geo_suite
@echo
@echo "================================================================================"
@echo "<< BOOST TESTS >>"
@echo "================================================================================"
@echo
test "x$(SKIP_BOOST)" == "x1" || $(VALGRIND) @builddir@/UnitTests/basics_suite --show_progress || test "x$(FORCE)" == "x1"
test "x$(SKIP_GEO)" == "x1" || $(VALGRIND) @builddir@/UnitTests/geo_suite --show_progress || test "x$(FORCE)" == "x1"
@echo
noinst_PROGRAMS += UnitTests/basics_suite UnitTests/geo_suite
UnitTests_basics_suite_LDADD = -L@top_builddir@/lib -larango -lboost_unit_test_framework
UnitTests_basics_suite_DEPENDENCIES = @top_builddir@/lib/libarango.a
UnitTests_basics_suite_SOURCES = \
UnitTests/Runner.cpp \
UnitTests/Philadelphia/json-test.cpp \
UnitTests/Philadelphia/json-utilities-test.cpp \
UnitTests/Philadelphia/hashes-test.cpp \
UnitTests/Philadelphia/associative-pointer-test.cpp \
UnitTests/Philadelphia/string-buffer-test.cpp \
UnitTests/Philadelphia/string-utf8-test.cpp \
UnitTests/Philadelphia/string-test.cpp \
UnitTests/Philadelphia/vector-pointer-test.cpp \
UnitTests/Philadelphia/vector-test.cpp \
UnitTests/Jutland/StringBufferTest.cpp \
UnitTests/Jutland/StringUtilsTest.cpp
UnitTests_geo_suite_CPPFLAGS = -I@top_builddir@/arangod -I@top_builddir@/lib
UnitTests_geo_suite_LDADD = -L@top_builddir@/lib -larango -lboost_unit_test_framework
UnitTests_geo_suite_DEPENDENCIES = @top_builddir@/lib/libarango.a
UnitTests_geo_suite_SOURCES = \
UnitTests/Cambridge/Runner.cpp \
UnitTests/Cambridge/georeg.cpp \
arangod/GeoIndex/GeoIndex.c
else
unittests-boost:
@echo
@echo "================================================================================"
@echo "<< BOOST TESTS >>"
@echo "================================================================================"
@echo
@echo "enable unit-testing with 'configure --with-boost-test'"
@echo
endif
################################################################################
## SHELL SERVER TESTS (BASICS)
################################################################################
SHELL_COMMON = @srcdir@/js/common/tests/shell-document.js \
@srcdir@/js/common/tests/shell-edge.js \
@srcdir@/js/common/tests/shell-collection.js \
@srcdir@/js/common/tests/shell-simple-query.js \
@srcdir@/js/common/tests/shell-index.js \
@srcdir@/js/common/tests/shell-index-geo.js \
@srcdir@/js/common/tests/shell-cap-constraint.js \
@srcdir@/js/common/tests/shell-unique-constraint.js \
@srcdir@/js/common/tests/shell-hash-index.js
SHELL_SERVER = $(SHELL_COMMON) \
@srcdir@/js/server/tests/routing.js
.PHONY: unittests-shell-server
UNITTESTS_SERVER = $(addprefix --javascript.unit-tests ,$(SHELL_SERVER))
unittests-shell-server:
@echo
@echo "================================================================================"
@echo "<< SHELL SERVER TESTS (BASICS) >>"
@echo "================================================================================"
@echo
@rm -rf "$(VOCDIR)"
@mkdir "$(VOCDIR)"
$(VALGRIND) @builddir@/bin/arangod "$(VOCDIR)" $(SERVER_OPT) $(UNITTESTS_SERVER) || test "x$(FORCE)" == "x1"
@rm -rf "$(VOCDIR)"
@echo
################################################################################
## SHELL SERVER TESTS (AHUACATL)
################################################################################
SHELL_SERVER_AHUACATL = @srcdir@/js/server/tests/ahuacatl-ranges.js \
@srcdir@/js/server/tests/ahuacatl-queries-optimiser.js \
@srcdir@/js/server/tests/ahuacatl-escaping.js \
@srcdir@/js/server/tests/ahuacatl-functions.js \
@srcdir@/js/server/tests/ahuacatl-variables.js \
@srcdir@/js/server/tests/ahuacatl-bind.js \
@srcdir@/js/server/tests/ahuacatl-complex.js \
@srcdir@/js/server/tests/ahuacatl-logical.js \
@srcdir@/js/server/tests/ahuacatl-arithmetic.js \
@srcdir@/js/server/tests/ahuacatl-relational.js \
@srcdir@/js/server/tests/ahuacatl-ternary.js \
@srcdir@/js/server/tests/ahuacatl-parse.js \
@srcdir@/js/server/tests/ahuacatl-hash.js \
@srcdir@/js/server/tests/ahuacatl-skiplist.js \
@srcdir@/js/server/tests/ahuacatl-refaccess-variable.js \
@srcdir@/js/server/tests/ahuacatl-refaccess-attribute.js \
@srcdir@/js/server/tests/ahuacatl-skiplist.js \
@srcdir@/js/server/tests/ahuacatl-queries-simple.js \
@srcdir@/js/server/tests/ahuacatl-queries-variables.js \
@srcdir@/js/server/tests/ahuacatl-queries-geo.js \
@srcdir@/js/server/tests/ahuacatl-queries-collection.js \
@srcdir@/js/server/tests/ahuacatl-queries-noncollection.js \
@srcdir@/js/server/tests/ahuacatl-operators.js
SHELL_SERVER_AHUACATL_EXTENDED = \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-1.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-2.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-3.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-4.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-5.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-6.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-7.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-8.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-9.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-10.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-11.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-12.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-13.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-14.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-15.js \
@srcdir@/js/server/tests/ahuacatl-ranges-combined-16.js
.PHONY: unittests-shell-server-ahuacatl
UNITTESTS_SERVER_AHUACATL = $(addprefix --javascript.unit-tests ,$(SHELL_SERVER_AHUACATL))
UNITTESTS_SERVER_AHUACATL_EXTENDED = $(addprefix --javascript.unit-tests ,$(SHELL_SERVER_AHUACATL_EXTENDED))
unittests-shell-server-ahuacatl:
@echo
@echo "================================================================================"
@echo "<< SHELL SERVER TESTS (AHUACATL) >>"
@echo "================================================================================"
@echo
@rm -rf "$(VOCDIR)"
@mkdir "$(VOCDIR)"
$(VALGRIND) @builddir@/bin/arangod "$(VOCDIR)" $(SERVER_OPT) $(UNITTESTS_SERVER_AHUACATL) || test "x$(FORCE)" == "x1"
@test "x$(SKIP_RANGES)" == "x1" || $(VALGRIND) @builddir@/bin/arangod "$(VOCDIR)" $(SERVER_OPT) $(UNITTESTS_SERVER_AHUACATL_EXTENDED) || test "x$(FORCE)" == "x1"
@rm -rf "$(VOCDIR)"
@echo
################################################################################
## SHELL CLIENT TESTS
################################################################################
SHELL_CLIENT = $(SHELL_COMMON) js/client/tests/client.js
.PHONY: unittests-shell-client
UNITTESTS_CLIENT = $(addprefix --javascript.unit-tests ,$(SHELL_CLIENT))
unittests-shell-client:
$(MAKE) start-server PID=$(PID)
@echo
@echo "================================================================================"
@echo "<< SHELL CLIENT TESTS >>"
@echo "================================================================================"
@echo
$(VALGRIND) @builddir@/bin/arangosh $(CLIENT_OPT) --server $(VOCHOST):$(VOCPORT) $(UNITTESTS_CLIENT) || 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
################################################################################
.PHONY: unittests-http-server
unittests-http-server:
$(MAKE) start-server PID=$(PID)
@echo
@echo "================================================================================"
@echo "<< HTTP SERVER TESTS >>"
@echo "================================================================================"
@echo
cd @srcdir@/UnitTests/HttpInterface && ARANGO_SERVER="$(VOCHOST):$(VOCPORT)" ./run-tests || 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
################################################################################
BITARRAY_COMMON = @srcdir@/js/common/tests/shell-bitarray-index.js
.PHONY: unittests-bitarray-index
UNITTESTS_SERVER_BITARRAY = $(addprefix --javascript.unit-tests ,$(BITARRAY_COMMON))
unittests-bitarray-index:
@echo
@echo "================================================================================"
@echo "<< BITARRAY INDEX TESTS >>"
@echo "================================================================================"
@echo
@rm -rf "$(VOCDIR)"
@mkdir "$(VOCDIR)"
$(VALGRIND) @builddir@/bin/arangod "$(VOCDIR)" $(SERVER_OPT) $(UNITTESTS_SERVER_BITARRAY) || test "x$(FORCE)" == "x1"
@ rm -rf "$(VOCDIR)"
@echo
Jump to Line
Something went wrong with that request. Please try again.