Skip to content

Commit

Permalink
[feature-search-json] Review before merge to master (#349)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafie committed May 24, 2021
1 parent ab90b6c commit 5d07ce5
Show file tree
Hide file tree
Showing 10 changed files with 771 additions and 23 deletions.
1 change: 1 addition & 0 deletions .circleci/config.yml
Expand Up @@ -41,6 +41,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
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Expand Up @@ -14,7 +14,8 @@ serde_json = "1.0"
serde = "1.0"
libc = "0.2"
jsonpath_lib = { git="https://github.com/RedisJSON/jsonpath.git", branch="public-parser" }
redis-module = { version="0.15", features = ["experimental-api"]}
redis-module = { version="0.17", features = ["experimental-api"]}
# readies-wd40 = { path = "deps/readies/wd40" }

[features]
# Workaround to allow cfg(feature = "test") in redismodue-rs dependencies:
Expand Down
70 changes: 58 additions & 12 deletions Makefile
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

0 comments on commit 5d07ce5

Please sign in to comment.