Commit 5030e8f2 authored by Jaromil's avatar Jaromil
Browse files

modularization of makefile and py2 and py3 targets

parent e4c1ce6c
......@@ -15,3 +15,16 @@ docs/fonts
lib/musl
src/zenroom.wasm
src/zenroom-shared
build/Zenroom-*
build/xtensa-*
build/*wasm
build/*js
build/*dll
build/*exe
build/*command
build/*py
build/python2
build/python3
build/*go
build/*java
build/*x86
......@@ -33,8 +33,8 @@ before_install:
script:
- mkdir -p build
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make osx && make check-osx && cp -v src/zenroom.command build/zenroom.command; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make osx-python && cp -v src/_zenroom.so build/_zenroom.so; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make osx && make check-osx; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make osx-python2 && make osx-python3; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make clean && cd lib/milagro-crypto-c && git clean -fd && cd - ;fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make ios-armv7; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make clean && cd lib/milagro-crypto-c && git clean -fd && cd - ;fi
......
......@@ -19,6 +19,7 @@
pwd := $(shell pwd)
ARCH=$(shell uname -m)
# include platform specific configurations pattern-matching target labels
include ${pwd}/build/config.mk
test-exec := ${pwd}/src/zenroom-shared -c ${pwd}/test/decode-test.conf
......@@ -44,147 +45,26 @@ embed-lua:
apply-patches:
${pwd}/build/apply-patches
# TODO: improve flags according to
# https://github.com/kripken/emscripten/blob/master/src/settings.js
javascript-node: cflags += -DARCH_JS -D'ARCH=\"JS\"' --memory-init-file 1
javascript-node: ldflags += --memory-init-file 1 -s WASM=0
javascript-node: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js
@mkdir -p build/nodejs
@cp -v src/zenroom.js build/nodejs/
@cp -v src/zenroom.js.mem build/nodejs/
# build targets for javascript (emscripten)
include ${pwd}/build/javascript.mk
# build targets for windows (mingw32 cross compile on Linux)
include ${pwd}/build/windows.mk
javascript-rn: cflags += -DARCH_JS -D'ARCH=\"JS\"' --memory-init-file 0
javascript-rn: ldflags += -s WASM=0 --memory-init-file 0 -s MEM_INIT_METHOD=0 -s ASSERTIONS=1 -s NO_EXIT_RUNTIME=0 -s LEGACY_VM_SUPPORT=1 -s MODULARIZE=1
javascript-rn: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js
@mkdir -p build/rnjs
sed -i 's/require("crypto")/require(".\/crypto")/g' src/zenroom.js
sed -i 's/require("[^\.]/console.log("/g' src/zenroom.js
sed -i 's/console.warn.bind/console.log.bind/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_SHELL=[^;]*;/;ENVIRONMENT_IS_SHELL=true;/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_NODE=[^;]*;/;ENVIRONMENT_IS_NODE=false;/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_WORKER=[^;]*;/;ENVIRONMENT_IS_WORKER=false;/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_WEB=[^;]*;/;ENVIRONMENT_IS_WEB=false;/g' src/zenroom.js
@cp -v src/zenroom.js build/rnjs/
# build targets for linux systems (also musl and android)
include ${pwd}/build/linux.mk
javascript-wasm: cflags += -DARCH_WASM -D'ARCH=\"WASM\"'
javascript-wasm: ldflags += -s WASM=1 -s MODULARIZE=1
javascript-wasm: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js
@mkdir -p build/wasm
@cp -v src/zenroom.js build/wasm/
@cp -v src/zenroom.wasm build/wasm/
javascript-demo: cflags += -DARCH_WASM -D'ARCH=\"WASM\"'
javascript-demo: ldflags += -s WASM=1 -s ASSERTIONS=1 --shell-file ${extras}/shell_minimal.html -s NO_EXIT_RUNTIME=1
javascript-demo: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js-demo
win: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src win-exe
win-dll: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src win-dll
musl: ldadd += /usr/lib/${ARCH}-linux-musl/libc.a
musl: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src musl
musl-local: ldadd += /usr/local/musl/lib/libc.a
musl-local: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src musl
musl-system: gcc := gcc
musl-system: ldadd += -lm
musl-system: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src musl
linux: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src linux
linux-debug:
linux-debug: cflags := -O1 -ggdb -D'ARCH=\"LINUX\"' ${cflags_protection} -DARCH_LINUX -DDEBUG=1
linux-debug: apply-patches lua53 milagro lpeglabel linux
linux-clang: gcc := clang
linux-clang: apply-patches lua53 milagro lpeglabel linux
linux-sanitizer: gcc := clang
linux-sanitizer: cflags := -O1 -ggdb -D'ARCH=\"LINUX\"' ${cflags_protection} -DARCH_LINUX -DDEBUG=1 -fsanitize=address -fno-omit-frame-pointer
linux-sanitizer: apply-patches lua53 milagro lpeglabel linux
ASAN_OPTIONS=verbosity=1:log_threads=1 \
ASAN_SYMBOLIZER_PATH=/usr/bin/asan_symbolizer \
ASAN_OPTIONS=abort_on_error=1 \
./src/zenroom-shared -i -d
linux-lib: cflags += -shared -DLIBRARY
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src linux-lib
linux-python: apply-patches lua53 milagro lpeglabel
swig -python -py3 ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c \
-o src/zen_python.o
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src python
osx-python: apply-patches lua53 milagro lpeglabel
swig -python -py3 ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c \
-o src/zen_python.o
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src python
linux-go: apply-patches lua53 milagro lpeglabel
swig -go -cgo -intgosize 32 ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c -o src/zen_go.o
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src go
linux-java: cflags += -I /opt/jdk/include -I /opt/jdk/include/linux
linux-java: apply-patches lua53 milagro lpeglabel
swig -java ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c -o src/zen_java.o
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src java
# build targets for apple systems (OSX and IOS)
include ${pwd}/build/osx.mk
# experimental target for xtensa embedded boards
esp32: apply-patches lua53 milagro lpeglabel
CC=${pwd}/build/xtensa-esp32-elf/bin/xtensa-esp32-elf-${gcc} \
LD=${pwd}/build/xtensa-esp32-elf/bin/xtensa-esp32-elf-ld \
CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src linux
osx: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src osx
# ------------------
# ios build recepies
include ${pwd}/build/ios.mk
android: gcc := $(CC)
android: ar := $(AR)
android: ranlib := $(RANLIB)
android: ld := $(ld)
android: cflags := ${cflags} -std=c99 -shared -DLUA_USE_DLOPEN
android: apply-patches lua53 milagro lpeglabel
LDFLAGS="--sysroot=/tmp/ndk-arch-21/sysroot" CC=${gcc} CFLAGS="${cflags}" make -C src android
# static dependencies in lib
lpeglabel:
CC=${gcc} CFLAGS="${cflags} -I${pwd}/lib/lua53/src" AR="${ar}" make -C lib/lpeglabel
......@@ -207,148 +87,9 @@ milagro:
check-milagro: milagro
CC=${gcc} CFLAGS="${cflags}" make -C ${pwd}/lib/milagro-crypto-c test
## tests that require too much memory
himem-tests = \
@${1} test/sort.lua && \
${1} test/literals.lua && \
${1} test/pm.lua && \
${1} test/nextvar.lua
## GC tests break memory management with umm
# in particular steps (2)
# ${1} test/gc.lua && \
# ${1} test/calls.lua && \
lowmem-tests = \
@${1} test/vararg.lua && \
${1} test/utf8.lua && \
${1} test/tpack.lua && \
${1} test/strings.lua && \
${1} test/math.lua && \
${1} test/goto.lua && \
${1} test/events.lua && \
${1} test/code.lua && \
${1} test/locals.lua && \
${1} test/schema.lua && \
${1} test/octet.lua && \
${1} test/hash.lua && \
${1} test/ecdh.lua && \
${1} test/ecdh_aes-gcm_vectors.lua && \
${1} test/ecp_bls383.lua
crypto-tests = \
@${1} test/octet.lua && \
${1} test/hash.lua && \
${1} test/ecdh.lua && \
${1} test/ecdh_aes-gcm_vectors.lua && \
${1} test/ecp_bls383.lua
shell-tests = \
test/octet-json.sh ${1} && \
test/integration_asymmetric_crypto.sh ${1}
# ${1} test/closure.lua && \
# failing js tests due to larger memory required:
# abort("Cannot enlarge memory arrays. Either (1) compile with -s
# TOTAL_MEMORY=X with X higher than the current value 16777216, (2)
# compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the
# size at runtime but prevents some optimizations, (3) set
# Module.TOTAL_MEMORY to a higher value before the program runs, or
# (4) if you want malloc to return NULL (0) instead of this abort,
# compile with -s ABORTING_MALLOC=0 ") at Error
# himem:
# ${1} test/constructs.lua && \
# ${1} test/cjson-test.lua
# lowmem:
# ${1} test/coroutine.lua && \
# these all pass but require cjson_full to run
# ${test-exec} test/cjson-test.lua
# these require the debug extension too much
# ${test-exec} test/coroutine.lua
# these may serve to verify the boundary of maximum memory
# since some trigger warnings when compiled with full debug
# $(call himem-tests,${test-exec})
check:
@echo "Test target 'check' supports various modes, please specify one:"
@echo "\t check-osx, check-shared, check-static, check-js"
@echo "\t check-debug, check-crypto, debug-crypto"
check-osx: test-exec-lowmem := ${pwd}/src/zenroom.command
check-osx: test-exec := ${pwd}/src/zenroom.command
check-osx:
${test-exec} test/constructs.lua
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec-lowmem})
$(call shell-tests,${test-exec-lowmem})
@echo "----------------"
@echo "All tests passed for SHARED binary build"
@echo "----------------"
check-shared: test-exec-lowmem := ${pwd}/src/zenroom-shared
check-shared: test-exec := ${pwd}/src/zenroom-shared
check-shared:
${test-exec} test/constructs.lua
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec-lowmem})
$(call shell-tests,${test-exec-lowmem})
@echo "----------------"
@echo "All tests passed for SHARED binary build"
@echo "----------------"
check-static: test-exec := ${pwd}/src/zenroom-static
check-static: test-exec-lowmem := ${pwd}/src/zenroom-static
check-static:
${test-exec} test/constructs.lua
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec-lowmem})
$(call shell-tests,${test-exec-lowmem})
@echo "----------------"
@echo "All tests passed for STATIC binary build"
@echo "----------------"
check-js: test-exec := nodejs ${pwd}/test/zenroom_exec.js ${pwd}/src/zenroom.js
check-js:
cp src/zenroom.js.mem .
$(call lowmem-tests,${test-exec})
$(call crypto-tests,${test-exec})
@echo "----------------"
@echo "All tests passed for JS binary build"
@echo "----------------"
check-debug: test-exec-lowmem := valgrind --max-stackframe=2064480 ${pwd}/src/zenroom-shared -u -d
check-debug: test-exec := valgrind --max-stackframe=2064480 ${pwd}/src/zenroom-shared -u -d
check-debug:
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec})
@echo "----------------"
@echo "All tests passed for DEBUG binary build"
@echo "----------------"
check-crypto: test-exec := ./src/zenroom-shared -d
check-crypto:
$(call crypto-tests,${test-exec})
@echo "-----------------------"
@echo "All CRYPTO tests passed"
@echo "-----------------------"
debug-crypto: test-exec := valgrind --max-stackframe=2064480 ${pwd}/src/zenroom-shared -u -d
debug-crypto:
$(call crypto-tests,${test-exec})
$(call shell-tests,${test-exec-lowmem})
# ./test/integration_asymmetric_crypto.sh ${test-exec}
# ./test/octet-json.sh ${test-exec}
# -------------------
# Test suites for all platforms
include ${pwd}/build/tests.mk
clean:
make clean -C ${pwd}/lib/lua53/src
......
# TODO: improve flags according to
# https://github.com/kripken/emscripten/blob/master/src/settings.js
javascript-node: cflags += -DARCH_JS -D'ARCH=\"JS\"' --memory-init-file 1
javascript-node: ldflags += --memory-init-file 1 -s WASM=0
javascript-node: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js
@mkdir -p build/nodejs
@cp -v src/zenroom.js build/nodejs/
@cp -v src/zenroom.js.mem build/nodejs/
javascript-rn: cflags += -DARCH_JS -D'ARCH=\"JS\"' --memory-init-file 0
javascript-rn: ldflags += -s WASM=0 --memory-init-file 0 -s MEM_INIT_METHOD=0 -s ASSERTIONS=1 -s NO_EXIT_RUNTIME=0 -s LEGACY_VM_SUPPORT=1 -s MODULARIZE=1
javascript-rn: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js
@mkdir -p build/rnjs
sed -i 's/require("crypto")/require(".\/crypto")/g' src/zenroom.js
sed -i 's/require("[^\.]/console.log("/g' src/zenroom.js
sed -i 's/console.warn.bind/console.log.bind/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_SHELL=[^;]*;/;ENVIRONMENT_IS_SHELL=true;/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_NODE=[^;]*;/;ENVIRONMENT_IS_NODE=false;/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_WORKER=[^;]*;/;ENVIRONMENT_IS_WORKER=false;/g' src/zenroom.js
sed -i 's/;ENVIRONMENT_IS_WEB=[^;]*;/;ENVIRONMENT_IS_WEB=false;/g' src/zenroom.js
@cp -v src/zenroom.js build/rnjs/
javascript-wasm: cflags += -DARCH_WASM -D'ARCH=\"WASM\"'
javascript-wasm: ldflags += -s WASM=1 -s MODULARIZE=1
javascript-wasm: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js
@mkdir -p build/wasm
@cp -v src/zenroom.js build/wasm/
@cp -v src/zenroom.wasm build/wasm/
javascript-demo: cflags += -DARCH_WASM -D'ARCH=\"WASM\"'
javascript-demo: ldflags += -s WASM=1 -s ASSERTIONS=1 --shell-file ${extras}/shell_minimal.html -s NO_EXIT_RUNTIME=1
javascript-demo: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src js-demo
musl: ldadd += /usr/lib/${ARCH}-linux-musl/libc.a
musl: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src musl
musl-local: ldadd += /usr/local/musl/lib/libc.a
musl-local: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src musl
musl-system: gcc := gcc
musl-system: ldadd += -lm
musl-system: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src musl
linux: apply-patches lua53 milagro lpeglabel
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src linux
linux-debug:
linux-debug: cflags := -O1 -ggdb -D'ARCH=\"LINUX\"' ${cflags_protection} -DARCH_LINUX -DDEBUG=1
linux-debug: apply-patches lua53 milagro lpeglabel linux
linux-clang: gcc := clang
linux-clang: apply-patches lua53 milagro lpeglabel linux
linux-sanitizer: gcc := clang
linux-sanitizer: cflags := -O1 -ggdb -D'ARCH=\"LINUX\"' ${cflags_protection} -DARCH_LINUX -DDEBUG=1 -fsanitize=address -fno-omit-frame-pointer
linux-sanitizer: apply-patches lua53 milagro lpeglabel linux
ASAN_OPTIONS=verbosity=1:log_threads=1 \
ASAN_SYMBOLIZER_PATH=/usr/bin/asan_symbolizer \
ASAN_OPTIONS=abort_on_error=1 \
./src/zenroom-shared -i -d
linux-lib: cflags += -shared -DLIBRARY
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src linux-lib
linux-python3: apply-patches lua53 milagro lpeglabel
swig -python -py3 ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c \
-o src/zen_python.o
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src python
@mkdir -p ${pwd}/build/python3 && cp -v ${pwd}/src/_zenroom.so ${pwd}/build/python3
linux-python2: apply-patches lua53 milagro lpeglabel
swig -python ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c \
-o src/zen_python.o
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src python
@mkdir -p ${pwd}/build/python2 && cp -v ${pwd}/src/_zenroom.so ${pwd}/build/python2
linux-go: apply-patches lua53 milagro lpeglabel
swig -go -cgo -intgosize 32 ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c -o src/zen_go.o
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src go
linux-java: cflags += -I /opt/jdk/include -I /opt/jdk/include/linux
linux-java: apply-patches lua53 milagro lpeglabel
swig -java ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c -o src/zen_java.o
CC=${gcc} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src java
android: gcc := $(CC)
android: ar := $(AR)
android: ranlib := $(RANLIB)
android: ld := $(ld)
android: cflags := ${cflags} -std=c99 -shared -DLUA_USE_DLOPEN
android: apply-patches lua53 milagro lpeglabel
LDFLAGS="--sysroot=/tmp/ndk-arch-21/sysroot" CC=${gcc} CFLAGS="${cflags}" make -C src android
osx: apply-patches lua53 milagro lpeglabel
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src osx
@cp -v ${pwd}/src/zenroom.command ${pwd}/build
osx-python2: apply-patches lua53 milagro lpeglabel
swig -python ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c \
-o src/zen_python.o
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src python
@mkdir -p ${pwd}/build/python2 && cp -v ${pwd}/src/_zenroom.so ${pwd}/build/python2
osx-python3: apply-patches lua53 milagro lpeglabel
swig -python -py3 ${pwd}/build/swig.i
${gcc} ${cflags} -c ${pwd}/build/swig_wrap.c \
-o src/zen_python.o
CC=${gcc} LD=${ld} CFLAGS="${cflags}" LDFLAGS="${ldflags}" LDADD="${ldadd}" \
make -C src python
@mkdir -p ${pwd}/build/python2 && cp -v ${pwd}/src/_zenroom.so ${pwd}/build/python3
ios-lib:
TARGET=${ARCH} AR=${ar} CC=${gcc} CFLAGS="${cflags}" make -C src ios-lib
......
## tests that require too much memory
himem-tests = \
@${1} test/sort.lua && \
${1} test/literals.lua && \
${1} test/pm.lua && \
${1} test/nextvar.lua
## GC tests break memory management with umm
# in particular steps (2)
# ${1} test/gc.lua && \
# ${1} test/calls.lua && \
lowmem-tests = \
@${1} test/vararg.lua && \
${1} test/utf8.lua && \
${1} test/tpack.lua && \
${1} test/strings.lua && \
${1} test/math.lua && \
${1} test/goto.lua && \
${1} test/events.lua && \
${1} test/code.lua && \
${1} test/locals.lua && \
${1} test/schema.lua && \
${1} test/octet.lua && \
${1} test/hash.lua && \
${1} test/ecdh.lua && \
${1} test/ecdh_aes-gcm_vectors.lua && \
${1} test/ecp_bls383.lua
crypto-tests = \
@${1} test/octet.lua && \
${1} test/hash.lua && \
${1} test/ecdh.lua && \
${1} test/ecdh_aes-gcm_vectors.lua && \
${1} test/ecp_bls383.lua
shell-tests = \
test/octet-json.sh ${1} && \
test/integration_asymmetric_crypto.sh ${1}
# ${1} test/closure.lua && \
# failing js tests due to larger memory required:
# abort("Cannot enlarge memory arrays. Either (1) compile with -s
# TOTAL_MEMORY=X with X higher than the current value 16777216, (2)
# compile with -s ALLOW_MEMORY_GROWTH=1 which allows increasing the
# size at runtime but prevents some optimizations, (3) set
# Module.TOTAL_MEMORY to a higher value before the program runs, or
# (4) if you want malloc to return NULL (0) instead of this abort,
# compile with -s ABORTING_MALLOC=0 ") at Error
# himem:
# ${1} test/constructs.lua && \
# ${1} test/cjson-test.lua
# lowmem:
# ${1} test/coroutine.lua && \
# these all pass but require cjson_full to run
# ${test-exec} test/cjson-test.lua
# these require the debug extension too much
# ${test-exec} test/coroutine.lua
# these may serve to verify the boundary of maximum memory
# since some trigger warnings when compiled with full debug
# $(call himem-tests,${test-exec})
check:
@echo "Test target 'check' supports various modes, please specify one:"
@echo "\t check-osx, check-shared, check-static, check-js"
@echo "\t check-debug, check-crypto, debug-crypto"
check-osx: test-exec-lowmem := ${pwd}/src/zenroom.command
check-osx: test-exec := ${pwd}/src/zenroom.command
check-osx:
${test-exec} test/constructs.lua
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec-lowmem})
$(call shell-tests,${test-exec-lowmem})
@echo "----------------"
@echo "All tests passed for SHARED binary build"
@echo "----------------"
check-shared: test-exec-lowmem := ${pwd}/src/zenroom-shared
check-shared: test-exec := ${pwd}/src/zenroom-shared
check-shared:
${test-exec} test/constructs.lua
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec-lowmem})
$(call shell-tests,${test-exec-lowmem})
@echo "----------------"
@echo "All tests passed for SHARED binary build"
@echo "----------------"
check-static: test-exec := ${pwd}/src/zenroom-static
check-static: test-exec-lowmem := ${pwd}/src/zenroom-static
check-static:
${test-exec} test/constructs.lua
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec-lowmem})
$(call shell-tests,${test-exec-lowmem})
@echo "----------------"
@echo "All tests passed for STATIC binary build"
@echo "----------------"
check-js: test-exec := nodejs ${pwd}/test/zenroom_exec.js ${pwd}/src/zenroom.js
check-js:
cp src/zenroom.js.mem .
$(call lowmem-tests,${test-exec})
$(call crypto-tests,${test-exec})
@echo "----------------"
@echo "All tests passed for JS binary build"
@echo "----------------"
check-debug: test-exec-lowmem := valgrind --max-stackframe=2064480 ${pwd}/src/zenroom-shared -u -d
check-debug: test-exec := valgrind --max-stackframe=2064480 ${pwd}/src/zenroom-shared -u -d
check-debug:
$(call lowmem-tests,${test-exec-lowmem})
$(call crypto-tests,${test-exec})
@echo "----------------"
@echo "All tests passed for DEBUG binary build"
@echo "----------------"
check-crypto: test-exec := ./src/zenroom-shared -d
check-crypto:
$(call crypto-tests,${test-exec})
@echo "-----------------------"
@echo "All CRYPTO tests passed"
@echo "-----------------------"
debug-crypto: test-exec := valgrind --max-stackframe=2064480 ${pwd}/src/zenroom-shared -u -d
debug-crypto:
$(call crypto-tests,${test-exec})
$(call shell-tests,${test-exec-lowmem})
# ./test/integration_asymmetric_crypto.sh ${test-exec}