Commit 9f606d34 authored by siddontang's avatar siddontang Committed by zhangjinpeng1987

*: add Makefile and adjust test folder (#14)

parent 4894f435
......@@ -11,7 +11,7 @@ exclude = [
".gitignore",
".travis.yml",
"deploy.sh",
"test/**/*",
"tests/**/*",
]
[features]
......@@ -23,7 +23,7 @@ portable = ["librocksdb_sys/portable"]
[[test]]
name = "test"
path = "test/test.rs"
path = "tests/test.rs"
[dependencies]
libc = "0.2.11"
......
.PHONY: all format
# format rust code using the specified command for the specified file or directory.
# $(call do-format-with-cmd,cmd,file-or-dir)
define do-format-with-cmd
$1 --write-mode diff $2 | grep -E "Diff .*at line" > /dev/null && $1 --write-mode overwrite $2 || exit 0
endef
# format rust code in the specified file or directory
# a file of rust code follows the convention of having suffix '.rs'
# $(call format-code-in,file-or-dir)
define format-code-in
$(if $(filter %.rs, $1), \
$(call do-format-with-cmd, rustfmt, $1), \
cd $1 && $(call do-format-with-cmd, cargo fmt --))
endef
all: format build test
build:
@cargo build
test:
@export RUST_BACKTRACE=1 && cargo test -- --nocapture
format:
@$(call format-code-in, .)
@$(call format-code-in, tests/test.rs)
@$(call format-code-in, librocksdb_sys)
clean:
@cargo clean
@cd librocksdb_sys && cargo clean
\ No newline at end of file
......@@ -490,7 +490,8 @@ extern "C" {
klen: size_t));
pub fn crocksdb_writebatch_data(batch: *mut DBWriteBatch, size: *mut size_t) -> *const u8;
pub fn crocksdb_writebatch_set_save_point(batch: *mut DBWriteBatch);
pub fn crocksdb_writebatch_rollback_to_save_point(batch: *mut DBWriteBatch, err: *mut *mut c_char);
pub fn crocksdb_writebatch_rollback_to_save_point(batch: *mut DBWriteBatch,
err: *mut *mut c_char);
// Comparator
pub fn crocksdb_options_set_comparator(options: *mut DBOptions, cb: *mut DBComparator);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment