Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose USE_VALGRIND compilation flag as use-valgrind feature #288

Merged
merged 4 commits into from
Mar 4, 2025
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
18 changes: 4 additions & 14 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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
Expand Down
22 changes: 15 additions & 7 deletions heed/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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:
# <https://github.com/LMDB/lmdb/blob/f20e41de09d97e4461946b7e26ec831d0c24fac7/libraries/liblmdb/mdb.c#L205-L218>
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]]
Expand Down
13 changes: 9 additions & 4 deletions heed3/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down Expand Up @@ -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:
# <https://github.com/LMDB/lmdb/blob/f20e41de09d97e4461946b7e26ec831d0c24fac7/libraries/liblmdb/mdb.c#L205-L218>
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]]
Expand Down
9 changes: 8 additions & 1 deletion lmdb-master-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions lmdb-master-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
9 changes: 8 additions & 1 deletion lmdb-master3-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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.
Expand Down
4 changes: 4 additions & 0 deletions lmdb-master3-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Loading