Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ commands:
apt-get -q install -y git openssh-client curl ca-certificates make tar gzip
bash <(curl -fsSL https://get.docker.com)
- setup_remote_docker:
version: 20.10.2
docker_layer_caching: true

setup-automation:
Expand Down
70 changes: 58 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ $(error Submodules not present. Please run 'git submodule update --init --recurs
endif
include $(ROOT)/deps/readies/mk/main

ifneq ($(SAN),)
override DEBUG:=1
ifeq ($(SAN),mem)
else ifeq ($(SAN),memory)
else ifeq ($(SAN),addr)
else ifeq ($(SAN),address)
else ifeq ($(SAN),leak)
else ifeq ($(SAN),thread)
else
$(error SAN=mem|addr|leak|thread)
endif
endif

#----------------------------------------------------------------------------------------------

define HELP
make setup # install prerequisites

make build
DEBUG=1 # build debug variant
SAN=type # build with LLVM sanitizer (type=address|memory|leak|thread)
VALGRIND|VG=1 # build for testing with Valgrind
make clean # remove binary files
ALL=1 # remove binary directories

Expand All @@ -25,7 +40,7 @@ make pytest # run tests
AOF=0|1 # run AOF persistency tests on a standalone Redis topology
SLAVES=0|1 # run replication tests on standalone Redis topology
CLUSTER=0|1 # run general tests on a OSS Redis Cluster topology
VALGRIND|VD=1 # run specified tests with Valgrind
VALGRIND|VG=1 # run specified tests with Valgrind

make pack # build package (RAMP file)

Expand All @@ -44,6 +59,10 @@ make builddocs
make localdocs
make deploydocs

make nightly # set rust default to nightly
make stable # set rust default to stable


endef

#----------------------------------------------------------------------------------------------
Expand All @@ -58,9 +77,19 @@ include $(MK)/rules

MODULE_NAME=rejson.so

RUST_TARGET:=$(shell eval $$(rustc --print cfg | grep =); echo $$target_arch-$$target_vendor-$$target_os-$$target_env)
CARGO_TOOLCHAIN=
CARGO_FLAGS=

ifeq ($(DEBUG),1)
ifeq ($(SAN),)
TARGET_DIR=target/debug
else
TARGET_DIR=target/$(RUST_TARGET)/debug
CARGO_TOOLCHAIN = +nightly
CARGO_FLAGS += -Zbuild-std
endif
else
CARGO_FLAGS += --release
TARGET_DIR=target/release
endif
Expand Down Expand Up @@ -95,7 +124,13 @@ RUST_SOEXT.freebsd=so
RUST_SOEXT.macos=dylib

build:
ifeq ($(SAN),)
cargo build --all --all-targets $(CARGO_FLAGS)
else
export RUSTFLAGS=-Zsanitizer=$(SAN) ;\
export RUSTDOCFLAGS=-Zsanitizer=$(SAN) ;\
cargo $(CARGO_TOOLCHAIN) build --target $(RUST_TARGET) $(CARGO_FLAGS)
endif
cp $(TARGET_DIR)/librejson.$(RUST_SOEXT.$(OS)) $(TARGET)

clean:
Expand All @@ -115,29 +150,29 @@ pytest:
MODULE=$(abspath $(TARGET)) ./tests/pytest/tests.sh

cargo_test:
cargo test --features test --all
cargo $(CARGO_TOOLCHAIN) test --features test --all

.PHONY: pytest cargo_test

#----------------------------------------------------------------------------------------------

BENCHMARK_ARGS = redisbench-admin run-local

ifneq ($(REMOTE),)
BENCHMARK_ARGS = redisbench-admin run-remote
BENCHMARK_ARGS = run-remote
else
BENCHMARK_ARGS = run-local
endif

BENCHMARK_ARGS += --module_path $(realpath $(TARGET)) \
--required-module ReJSON
BENCHMARK_ARGS += --module_path $(realpath $(TARGET)) --required-module ReJSON

ifneq ($(BENCHMARK),)
BENCHMARK_ARGS += --test $(BENCHMARK)
BENCHMARK_ARGS += --test $(BENCHMARK)
endif

bench benchmark: $(TARGET)
cd ./tests/benchmarks ;\
redisbench-admin $(BENCHMARK_ARGS)

benchmark: $(TARGET)
cd ./tests/benchmarks; $(BENCHMARK_ARGS) ; cd ../../

.PHONY: benchmark
.PHONY: bench benchmark

#----------------------------------------------------------------------------------------------

Expand Down Expand Up @@ -176,3 +211,14 @@ deploydocs: builddocs
mkdocs gh-deploy

.PHONY: builddocs localdocs deploydocs

#----------------------------------------------------------------------------------------------

nightly:
rustup default nightly
rustup component add rust-src

stable:
rustup default stable

.PHONY: nightly stable
2 changes: 1 addition & 1 deletion deps/readies
Submodule readies updated 2 files
+3 −4 bin/getbazel
+2 −0 paella/setup.py
1 change: 1 addition & 0 deletions tests/pytest/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ if [[ ! -z $TEST ]]; then
RLTEST_ARGS+=" -s"
export BB=${BB:-1}
fi
export RUST_BACKTRACE=1

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider using
RUST_BACKTRACE=full

(If I understand correctly, when RUST_BACKTRACE=1, you also get a hint telling you about full backtrace:

note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

)

fi

[[ $VERBOSE == 1 ]] && RLTEST_ARGS+=" -v"
Expand Down