Test with 32-bit database on 32-bit systems (#72)

without.crypto
Myk Melez 5 years ago committed by Victor Porof
parent f1c3ba853c
commit b6e5ad193a
  1. BIN
      lmdb-sys/tests/fixtures/testdb-32/data.mdb
  2. BIN
      lmdb-sys/tests/fixtures/testdb-32/lock.mdb
  3. 17
      lmdb-sys/tests/simple.rs

Binary file not shown.

Binary file not shown.

@ -23,19 +23,18 @@ macro_rules! str {
} }
#[test] #[test]
#[cfg(all(target_os = "windows", target_arch = "x86"))] #[cfg(target_pointer_width = "32")]
#[should_panic(expected = "Failed with code -30793")] fn test_simple_32() {
fn test_simple_win_32() { test_simple("./tests/fixtures/testdb-32")
test_simple()
} }
#[test] #[test]
#[cfg(not(all(target_os = "windows", target_arch = "x86")))] #[cfg(target_pointer_width = "64")]
fn test_simple_other() { fn test_simple_64() {
test_simple() test_simple("./tests/fixtures/testdb")
} }
fn test_simple() { fn test_simple(env_path: &str) {
let mut env: *mut MDB_env = ptr::null_mut(); let mut env: *mut MDB_env = ptr::null_mut();
let mut dbi: MDB_dbi = 0; let mut dbi: MDB_dbi = 0;
let mut key = MDB_val { let mut key = MDB_val {
@ -53,7 +52,7 @@ fn test_simple() {
unsafe { unsafe {
E!(mdb_env_create(&mut env)); E!(mdb_env_create(&mut env));
E!(mdb_env_set_maxdbs(env, 2)); E!(mdb_env_set_maxdbs(env, 2));
E!(mdb_env_open(env, str!("./tests/fixtures/testdb"), 0, 0664)); E!(mdb_env_open(env, str!(env_path), 0, 0664));
E!(mdb_txn_begin(env, ptr::null_mut(), 0, &mut txn)); E!(mdb_txn_begin(env, ptr::null_mut(), 0, &mut txn));
E!(mdb_dbi_open(txn, str!("subdb"), MDB_CREATE, &mut dbi)); E!(mdb_dbi_open(txn, str!("subdb"), MDB_CREATE, &mut dbi));

Loading…
Cancel
Save