2016-09-08 21:13:10 +04:00
|
|
|
|
2017-01-14 16:13:59 +04:00
|
|
|
TESTS := \
|
|
|
|
data-encoding \
|
|
|
|
store context state \
|
|
|
|
basic basic.sh \
|
2017-01-14 16:14:02 +04:00
|
|
|
p2p-io-scheduler \
|
|
|
|
p2p-connection \
|
2017-01-14 16:14:07 +04:00
|
|
|
p2p-connection-pool
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
all: test
|
|
|
|
|
2016-09-30 13:43:50 +04:00
|
|
|
INCLUDES = $(patsubst %, -I %, $(SOURCE_DIRECTORIES) lib)
|
2016-09-08 21:13:10 +04:00
|
|
|
OCAMLFLAGS = \
|
|
|
|
-g -safe-string -w -40 \
|
|
|
|
${INCLUDES} \
|
|
|
|
$(patsubst %, -package %, $(PACKAGES)) \
|
|
|
|
${EXTRA_OCAMLFLAGS}
|
|
|
|
|
2016-10-19 22:47:04 +04:00
|
|
|
SOURCE_DIRECTORIES := \
|
|
|
|
lib \
|
|
|
|
$(addprefix ../src/, \
|
2016-12-01 21:27:53 +04:00
|
|
|
minutils \
|
2016-09-08 21:13:10 +04:00
|
|
|
utils \
|
|
|
|
compiler \
|
|
|
|
node/db \
|
|
|
|
node/net \
|
|
|
|
node/updater \
|
|
|
|
node/shell \
|
|
|
|
proto \
|
|
|
|
)
|
|
|
|
|
|
|
|
PACKAGES := \
|
|
|
|
base64 \
|
|
|
|
calendar \
|
|
|
|
cohttp.lwt \
|
|
|
|
compiler-libs.optcomp \
|
|
|
|
config-file \
|
|
|
|
cstruct \
|
|
|
|
dynlink \
|
|
|
|
ezjsonm \
|
|
|
|
git \
|
2017-01-14 16:14:11 +04:00
|
|
|
ipv6-multicast \
|
2016-09-08 21:13:10 +04:00
|
|
|
irmin.unix \
|
|
|
|
lwt \
|
|
|
|
lwt.unix \
|
2017-01-14 16:13:59 +04:00
|
|
|
mtime.os \
|
2016-09-08 21:13:10 +04:00
|
|
|
ocplib-endian \
|
|
|
|
ocplib-ocamlres \
|
2016-12-01 21:27:53 +04:00
|
|
|
ocplib-json-typed.bson \
|
2016-09-08 21:13:10 +04:00
|
|
|
ocplib-resto.directory \
|
|
|
|
sodium \
|
2016-09-30 13:43:50 +04:00
|
|
|
unix \
|
2016-10-19 16:29:02 +04:00
|
|
|
kaputt \
|
2017-01-02 17:02:55 +04:00
|
|
|
|
|
|
|
ifeq ($(strip ${COVERAGE}),yes)
|
|
|
|
PACKAGES += bisect_ppx.runtime
|
|
|
|
endif
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
############################################################################
|
|
|
|
## External packages
|
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
NODELIB := \
|
|
|
|
../src/minutils.cmxa ../src/utils.cmxa \
|
|
|
|
../src/compiler.cmxa ../src/node.cmxa
|
2016-09-08 21:13:10 +04:00
|
|
|
CLIENTLIB := ../src/client.cmxa \
|
|
|
|
$(patsubst ../src/client/embedded/%/, \
|
|
|
|
../src/proto/client_embedded_proto_%.cmxa, \
|
|
|
|
$(shell ls -d ../src/client/embedded/*/)) \
|
|
|
|
$(patsubst ../src/client/embedded/%/, \
|
|
|
|
../src/client/embedded/client_%.cmx, \
|
|
|
|
$(shell ls -d ../src/client/embedded/*/))
|
|
|
|
|
|
|
|
${NODELIB} ${CLIENTLIB}:
|
|
|
|
${MAKE} -C ../src $@
|
|
|
|
|
|
|
|
.PHONY: build-test run-test test
|
2017-01-14 16:13:59 +04:00
|
|
|
build-test: ${addprefix build-test-,${TESTS}}
|
2016-09-08 21:13:10 +04:00
|
|
|
run-test:
|
2017-01-14 16:14:22 +04:00
|
|
|
@$(patsubst %,${MAKE} run-test-% && , ${TESTS}) \
|
2016-09-08 21:13:10 +04:00
|
|
|
echo && echo "Success" && echo
|
|
|
|
test:
|
|
|
|
@${MAKE} --no-print-directory build-test
|
|
|
|
@${MAKE} --no-print-directory run-test
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
## Store test program
|
|
|
|
|
|
|
|
.PHONY:build-test-store run-test-store
|
|
|
|
build-test-store: test-store
|
|
|
|
run-test-store:
|
|
|
|
./test-store
|
|
|
|
|
|
|
|
TEST_STORE_INTFS =
|
|
|
|
|
|
|
|
TEST_STORE_IMPLS = \
|
2016-09-30 13:43:50 +04:00
|
|
|
lib/assert.ml \
|
|
|
|
lib/test.ml \
|
|
|
|
test_store.ml
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
${TEST_STORE_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-store: ${NODELIB} ${TEST_STORE_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f test-store
|
|
|
|
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
## Context test program
|
|
|
|
|
|
|
|
.PHONY:build-test-context run-test-context
|
|
|
|
build-test-context: test-context
|
|
|
|
run-test-context:
|
|
|
|
./test-context
|
|
|
|
|
|
|
|
TEST_CONTEXT_INTFS =
|
|
|
|
|
|
|
|
TEST_CONTEXT_IMPLS = \
|
2016-09-30 13:43:50 +04:00
|
|
|
lib/assert.ml \
|
|
|
|
lib/test.ml \
|
|
|
|
test_context.ml
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
${TEST_CONTEXT_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-context: ${NODELIB} ${TEST_CONTEXT_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f test-context
|
|
|
|
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
## State test program
|
|
|
|
|
|
|
|
.PHONY:build-test-state run-test-state
|
|
|
|
build-test-state: test-state
|
|
|
|
run-test-state:
|
|
|
|
./test-state
|
|
|
|
|
|
|
|
TEST_STATE_INTFS =
|
|
|
|
|
|
|
|
TEST_STATE_IMPLS = \
|
2016-09-30 13:43:50 +04:00
|
|
|
lib/assert.ml \
|
|
|
|
lib/test.ml \
|
|
|
|
test_state.ml
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
${TEST_STATE_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-state: ${NODELIB} ../src/proto/embedded_proto_demo.cmxa ${TEST_STATE_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f test-state
|
|
|
|
|
|
|
|
|
|
|
|
############################################################################
|
|
|
|
## Basic-client-functionality test program
|
|
|
|
|
|
|
|
.PHONY:build-test-basic.sh run-test-basic.sh
|
|
|
|
build-test-basic.sh:
|
|
|
|
run-test-basic.sh:
|
|
|
|
./test-basic.sh
|
|
|
|
|
|
|
|
.PHONY:build-test-basic run-test-basic
|
|
|
|
build-test-basic: test-basic
|
|
|
|
run-test-basic:
|
|
|
|
./test-basic
|
|
|
|
|
|
|
|
TEST_BASIC_INTFS =
|
|
|
|
|
|
|
|
TEST_BASIC_IMPLS = \
|
2016-09-30 13:43:50 +04:00
|
|
|
lib/assert.ml \
|
|
|
|
lib/test.ml \
|
|
|
|
test_basic.ml
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
test-basic \
|
|
|
|
${TEST_BASIC_IMPLS:.ml=.cmx}: \
|
|
|
|
SOURCE_DIRECTORIES+=../src/client ../src/client/embedded/
|
|
|
|
|
|
|
|
${TEST_BASIC_IMPLS:.ml=.cmx}: ${NODELIB} ${CLIENTLIB}
|
|
|
|
test-basic: ${NODELIB} ${CLIENTLIB} ${TEST_BASIC_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f test-basic
|
|
|
|
|
2016-11-16 17:07:27 +04:00
|
|
|
############################################################################
|
|
|
|
## p2p test program
|
|
|
|
|
2017-01-14 16:14:02 +04:00
|
|
|
.PHONY:build-test-p2p-io-scheduler run-test-p2p-io-scheduler
|
2017-01-14 16:13:59 +04:00
|
|
|
build-test-p2p-io-scheduler: test-p2p-io-scheduler
|
|
|
|
run-test-p2p-io-scheduler:
|
|
|
|
./test-p2p-io-scheduler \
|
|
|
|
--delay 20 --clients 8 \
|
|
|
|
--max-upload-speed $$((1 << 18)) \
|
|
|
|
--max-download-speed $$((1 << 20))
|
2016-11-16 17:07:27 +04:00
|
|
|
|
2017-01-14 16:14:02 +04:00
|
|
|
.PHONY:build-test-p2p-connection run-test-p2p-connection
|
|
|
|
build-test-p2p-connection: test-p2p-connection
|
|
|
|
run-test-p2p-connection:
|
|
|
|
./test-p2p-connection
|
|
|
|
|
2017-01-14 16:14:07 +04:00
|
|
|
.PHONY:build-test-p2p-connection-pool run-test-p2p-connection-pool
|
|
|
|
build-test-p2p-connection-pool: test-p2p-connection-pool
|
|
|
|
run-test-p2p-connection-pool:
|
|
|
|
./test-p2p-connection-pool --clients 10 --repeat 5
|
|
|
|
|
2017-01-14 16:13:59 +04:00
|
|
|
TEST_P2P_IO_SCHEDULER_IMPLS = \
|
|
|
|
lib/process.ml \
|
|
|
|
test_p2p_io_scheduler.ml
|
|
|
|
|
2017-01-14 16:14:02 +04:00
|
|
|
TEST_P2P_CONNECTION_IMPLS = \
|
|
|
|
lib/process.ml \
|
|
|
|
test_p2p_connection.ml
|
|
|
|
|
2017-01-14 16:14:07 +04:00
|
|
|
TEST_P2P_CONNECTION_POOL_IMPLS = \
|
|
|
|
lib/process.ml \
|
|
|
|
test_p2p_connection_pool.ml
|
|
|
|
|
2017-01-14 16:13:59 +04:00
|
|
|
${TEST_P2P_IO_SCHEDULER_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-p2p-io-scheduler: ${NODELIB} ${TEST_P2P_IO_SCHEDULER_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
2017-01-14 16:14:02 +04:00
|
|
|
${TEST_P2P_CONNECTION_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-p2p-connection: ${NODELIB} ${TEST_P2P_CONNECTION_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
2017-01-14 16:14:07 +04:00
|
|
|
${TEST_P2P_CONNECTION_POOL_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-p2p-connection-pool: ${NODELIB} ${TEST_P2P_CONNECTION_POOL_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
2017-01-14 16:13:59 +04:00
|
|
|
clean::
|
2017-01-14 16:14:02 +04:00
|
|
|
-rm -f test-p2p-io_scheduler
|
|
|
|
-rm -f test-p2p-connection
|
2017-01-14 16:14:07 +04:00
|
|
|
-rm -f test-p2p-connection-pool
|
2017-01-14 16:13:59 +04:00
|
|
|
|
|
|
|
############################################################################
|
|
|
|
## lwt pipe test program
|
|
|
|
|
|
|
|
build-test-lwt-pipe: test-lwt-pipe
|
|
|
|
|
|
|
|
TEST_PIPE_IMPLS = \
|
|
|
|
test_lwt_pipe.ml
|
2016-11-16 17:07:27 +04:00
|
|
|
|
|
|
|
${TEST_BASIC_IMPLS:.ml=.cmx}: ${NODELIB}
|
2017-01-14 16:13:59 +04:00
|
|
|
test-lwt-pipe: ${NODELIB} ${TEST_PIPE_IMPLS:.ml=.cmx}
|
2016-11-16 17:07:27 +04:00
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f test-p2p
|
|
|
|
|
2016-10-20 18:15:31 +04:00
|
|
|
############################################################################
|
|
|
|
## data encoding test program
|
|
|
|
|
|
|
|
.PHONY:build-test-data-encoding run-test-data-encoding
|
|
|
|
build-test-data-encoding: test-data-encoding
|
|
|
|
run-test-data-encoding:
|
|
|
|
./test-data-encoding
|
|
|
|
|
|
|
|
TEST_DATA_ENCODING_INTFS =
|
|
|
|
|
|
|
|
TEST_DATA_ENCODING_IMPLS = \
|
|
|
|
lib/assert.ml \
|
|
|
|
lib/test.ml \
|
|
|
|
test_data_encoding.ml
|
|
|
|
|
|
|
|
${TEST_DATA_ENCODING_IMPLS:.ml=.cmx}: ${NODELIB}
|
|
|
|
test-data-encoding: ${NODELIB} ${TEST_DATA_ENCODING_IMPLS:.ml=.cmx}
|
|
|
|
ocamlfind ocamlopt -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
|
|
|
|
|
|
|
|
clean::
|
|
|
|
rm -f test-data-encoding
|
2016-09-08 21:13:10 +04:00
|
|
|
|
2016-10-19 16:29:02 +04:00
|
|
|
COVERAGESRCDIR= \
|
|
|
|
-I ../src \
|
|
|
|
-I ../src/client \
|
|
|
|
-I ../src/client/embedded \
|
2017-02-25 02:17:00 +04:00
|
|
|
-I ../src/client/embedded/alpha \
|
|
|
|
-I ../src/client/embedded/alpha/mining \
|
2016-10-19 16:29:02 +04:00
|
|
|
-I ../src/compiler \
|
|
|
|
-I ../src/node \
|
|
|
|
-I ../src/node/db \
|
|
|
|
-I ../src/node/updater \
|
|
|
|
-I ../src/node/net \
|
|
|
|
-I ../src/node/shell \
|
|
|
|
-I ../src/proto \
|
2017-02-25 02:17:00 +04:00
|
|
|
-I ../src/proto/alpha \
|
2016-10-19 16:29:02 +04:00
|
|
|
-I ../src/proto/demo \
|
2016-12-01 21:27:53 +04:00
|
|
|
-I ../src/minutils \
|
2016-10-19 16:29:02 +04:00
|
|
|
-I ../src/utils
|
|
|
|
|
|
|
|
bisect:
|
|
|
|
bisect-ppx-report $(COVERAGESRCDIR) \
|
|
|
|
-ignore-missing-files -html reports bisect*.out
|
|
|
|
|
2017-01-14 16:14:22 +04:00
|
|
|
#####
|
|
|
|
|
2017-02-19 21:22:32 +04:00
|
|
|
generate_hash: ../src/minutils/utils.cmx ../src/minutils/compare.cmx ../src/minutils/mBytes.cmx ../src/utils/base58.cmx ../src/minutils/hex_encode.cmx ../src/minutils/data_encoding.cmx ../src/utils/cli_entries.cmx ../src/utils/hash.cmx generate_hash.ml
|
|
|
|
ocamlfind ocamlopt -o $@ -linkpkg -package cstruct -package zarith -package ezjsonm -package sodium -package ocplib-json-typed.bson -package lwt.unix -package nocrypto -I ../src/utils/ -I ../src/minutils $^
|
|
|
|
|
|
|
|
|
|
|
|
#####
|
|
|
|
|
2017-01-14 16:14:22 +04:00
|
|
|
lib/assert.cmx: lib/assert.cmi
|
|
|
|
lib/assert.cmi: ../src/node/db/persist.cmi
|
|
|
|
|
|
|
|
lib/process.cmx: lib/process.cmi
|
|
|
|
lib/test.cmx: lib/test.cmi
|
|
|
|
|
2016-09-08 21:13:10 +04:00
|
|
|
############################################################################
|
|
|
|
## Generic rules
|
|
|
|
|
|
|
|
test.cmx: test.cmi
|
|
|
|
|
|
|
|
%.cmx: %.ml
|
|
|
|
ocamlfind ocamlopt ${OCAMLFLAGS} -c $<
|
|
|
|
|
|
|
|
%.cmo: %.ml
|
|
|
|
ocamlfind ocamlc ${OCAMLFLAGS} -c $<
|
|
|
|
|
|
|
|
%.cmi: %.mli
|
|
|
|
ocamlfind ocamlc ${OCAMLFLAGS} -c $<
|
|
|
|
|
|
|
|
clean::
|
2016-10-19 16:29:02 +04:00
|
|
|
-rm -f *.cm* lib/*.cm* *.out *.o
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
-include .depend
|
2016-09-30 13:43:50 +04:00
|
|
|
.depend: $(wildcard *.ml *.mli lib/*.ml lib/*.mli)
|
2016-10-12 17:00:19 +04:00
|
|
|
ocamldep -I lib $^ > .depend
|
2016-09-08 21:13:10 +04:00
|
|
|
|
|
|
|
clean::
|
|
|
|
-rm .depend
|