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

iter getter test that segfaults #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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: 18 additions & 0 deletions src/cursor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ mod test {
use flags::*;
use super::*;
use test_utils::*;
use transaction::RoTransaction;

#[test]
fn test_get() {
Expand Down Expand Up @@ -592,4 +593,21 @@ mod test {
mdb_cursor_close(cursor);
});
}

/// "error: process didn't exit successfully…
/// (signal: 11, SIGSEGV: invalid memory reference)"
#[test]
fn test_iter_getter_segfaults() {
let dir = TempDir::new("test").unwrap();
let env = Environment::new().open(dir.path()).unwrap();
let db = env.open_db(None).unwrap();
let txn = env.begin_ro_txn().unwrap();

fn get_iter<'a>(db: Database, txn: &'a RoTransaction<'a>) -> Iter {
let mut cursor = txn.open_ro_cursor(db).unwrap();
cursor.iter()
}

let _result: Vec<_> = get_iter(db, &txn).collect();
}
}