diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index fa279943..fe55004d 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -79,15 +79,9 @@ jobs: check-all-features: name: Check all the features of the heed project - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - include: - - os: ubuntu-latest - - os: macos-latest steps: - uses: actions/checkout@v2 with: @@ -108,20 +102,15 @@ jobs: # Skip it if the CI is running with the heed3 Cargo.toml if: ${{ steps.check_toml.outputs.should_skip == 'false' }} run: | + sudo apt install -y valgrind cargo clean cargo check --all-features -p heed check-all-features-heed3: name: Check all the features of the heed3 project - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest env: RUSTFLAGS: -D warnings - strategy: - matrix: - os: [ubuntu-latest, macos-latest] - include: - - os: ubuntu-latest - - os: macos-latest steps: - uses: actions/checkout@v2 with: @@ -133,6 +122,7 @@ jobs: override: true - name: Run cargo test run: | + sudo apt install -y valgrind cargo clean bash convert-to-heed3.sh cargo check --all-features -p heed3 diff --git a/heed/Cargo.toml b/heed/Cargo.toml index d1f7e7f9..7705235c 100644 --- a/heed/Cargo.toml +++ b/heed/Cargo.toml @@ -10,13 +10,13 @@ categories = ["database", "data-structures"] readme = "../README.md" edition = "2021" include = [ - "../examples/all-types.rs", - "../examples/clear-database.rs", - "../examples/cursor-append.rs", - "../examples/custom-comparator.rs", - "../examples/multi-env.rs", - "../examples/nested.rs", - "../examples/rmp-serde.rs" + "../examples/all-types.rs", + "../examples/clear-database.rs", + "../examples/cursor-append.rs", + "../examples/custom-comparator.rs", + "../examples/multi-env.rs", + "../examples/nested.rs", + "../examples/rmp-serde.rs", ] [dependencies] @@ -105,6 +105,14 @@ mdb_idl_logn_16 = ["lmdb-master-sys/mdb_idl_logn_16"] # computers then you need to keep your keys within the smaller 1982 byte limit. longer-keys = ["lmdb-master-sys/longer-keys"] +# Enable a better Valgrind support. This builds LMDB with the -DUSE_VALGRIND=1 option. +# +# You have to install the RPM valgrind-devel which contains memcheck.h. +# +# More information can be found at: +# +use-valgrind = ["lmdb-master-sys/use-valgrind"] + # Examples are located outside the standard heed/examples directory to prevent # conflicts between heed3 and heed examples when working on both crates. [[example]] diff --git a/heed3/Cargo.toml b/heed3/Cargo.toml index 01f768fb..b3a75c22 100644 --- a/heed3/Cargo.toml +++ b/heed3/Cargo.toml @@ -9,10 +9,7 @@ keywords = ["lmdb", "database", "storage", "typed", "encryption"] categories = ["database", "data-structures"] readme = "../README.md" edition = "2021" -include = [ - "../examples/heed3-encrypted.rs", - "../examples/heed3-all-types.rs" -] +include = ["../examples/heed3-encrypted.rs", "../examples/heed3-all-types.rs"] [dependencies] aead = { version = "0.5.2", default-features = false } @@ -104,6 +101,14 @@ mdb_idl_logn_16 = ["lmdb-master3-sys/mdb_idl_logn_16"] # computers then you need to keep your keys within the smaller 1982 byte limit. longer-keys = ["lmdb-master3-sys/longer-keys"] +# Enable a better Valgrind support. This builds LMDB with the -DUSE_VALGRIND=1 option. +# +# You have to install the RPM valgrind-devel which contains memcheck.h. +# +# More information can be found at: +# +use-valgrind = ["lmdb-master3-sys/use-valgrind"] + # Examples are located outside the standard heed/examples directory to prevent # conflicts between heed3 and heed examples when working on both crates. [[example]] diff --git a/lmdb-master-sys/Cargo.toml b/lmdb-master-sys/Cargo.toml index 30cf8ecc..570e7cfa 100644 --- a/lmdb-master-sys/Cargo.toml +++ b/lmdb-master-sys/Cargo.toml @@ -27,7 +27,9 @@ doctest = false libc = "0.2.169" [build-dependencies] -bindgen = { version = "0.71.1", default-features = false, optional = true, features = ["runtime"] } +bindgen = { version = "0.71.1", default-features = false, optional = true, features = [ + "runtime", +] } cc = "1.2.7" doxygen-rs = "0.4.2" @@ -61,6 +63,11 @@ mdb_idl_logn_14 = [] mdb_idl_logn_15 = [] mdb_idl_logn_16 = [] +# Enable the USE_VALGRIND feature. +# +# You have to install the RPM valgrind-devel which contains memcheck.h. +use-valgrind = [] + # Setting this enables you to use keys longer than 511 bytes. The exact limit # is computed by LMDB at compile time. You can find the exact value by calling # Env::max_key_size(). This value varies by architecture. diff --git a/lmdb-master-sys/build.rs b/lmdb-master-sys/build.rs index af508f4a..3d2879c8 100644 --- a/lmdb-master-sys/build.rs +++ b/lmdb-master-sys/build.rs @@ -139,6 +139,10 @@ fn main() { builder.define("MDB_USE_POSIX_SEM", None); } + if cfg!(feature = "use-valgrind") { + builder.define("USE_VALGRIND", None); + } + if cfg!(feature = "asan") { builder.flag("-fsanitize=address"); } diff --git a/lmdb-master3-sys/Cargo.toml b/lmdb-master3-sys/Cargo.toml index 726ba05d..4e1ed66b 100644 --- a/lmdb-master3-sys/Cargo.toml +++ b/lmdb-master3-sys/Cargo.toml @@ -27,7 +27,9 @@ doctest = false libc = "0.2.169" [build-dependencies] -bindgen = { version = "0.71.1", default-features = false, optional = true, features = ["runtime"] } +bindgen = { version = "0.71.1", default-features = false, optional = true, features = [ + "runtime", +] } cc = "1.2.7" doxygen-rs = "0.4.2" @@ -61,6 +63,11 @@ mdb_idl_logn_14 = [] mdb_idl_logn_15 = [] mdb_idl_logn_16 = [] +# Enable the USE_VALGRIND feature. +# +# You have to install the RPM valgrind-devel which contains memcheck.h. +use-valgrind = [] + # Setting this enables you to use keys longer than 511 bytes. The exact limit # is computed by LMDB at compile time. You can find the exact value by calling # Env::max_key_size(). This value varies by architecture. diff --git a/lmdb-master3-sys/build.rs b/lmdb-master3-sys/build.rs index af508f4a..3d2879c8 100644 --- a/lmdb-master3-sys/build.rs +++ b/lmdb-master3-sys/build.rs @@ -139,6 +139,10 @@ fn main() { builder.define("MDB_USE_POSIX_SEM", None); } + if cfg!(feature = "use-valgrind") { + builder.define("USE_VALGRIND", None); + } + if cfg!(feature = "asan") { builder.flag("-fsanitize=address"); }