Fix benchmark compile errors (#2881)

* Fix benchmark compile errors

* Also check bench code during CI
This commit is contained in:
Hocuri
2021-12-09 22:52:53 +01:00
committed by GitHub
parent 46eb391a1b
commit b50f211c28
4 changed files with 4 additions and 8 deletions

View File

@@ -118,7 +118,7 @@ jobs:
RUSTFLAGS: -D warnings
with:
command: check
args: --all --bins --examples --tests --features repl
args: --all --bins --examples --tests --features repl --benches
- name: tests
uses: actions-rs/cargo@v1

View File

@@ -8,9 +8,7 @@ async fn address_book_benchmark(n: u32, read_count: u32) {
let dir = tempdir().unwrap();
let dbfile = dir.path().join("db.sqlite");
let id = 100;
let context = Context::new("FakeOS".into(), dbfile.into(), id)
.await
.unwrap();
let context = Context::new(dbfile.into(), id).await.unwrap();
let book = (0..n)
.map(|i| format!("Name {}\naddr{}@example.org\n", i, i))

View File

@@ -8,7 +8,7 @@ async fn create_accounts(n: u32) {
let dir = tempdir().unwrap();
let p: PathBuf = dir.path().join("accounts").into();
let accounts = Accounts::new("my_os".into(), p.clone()).await.unwrap();
let mut accounts = Accounts::new(p.clone()).await.unwrap();
for expected_id in 2..n {
let id = accounts.add_account().await.unwrap();

View File

@@ -6,9 +6,7 @@ use std::path::Path;
async fn search_benchmark(path: impl AsRef<Path>) {
let dbfile = path.as_ref();
let id = 100;
let context = Context::new("FakeOS".into(), dbfile.into(), id)
.await
.unwrap();
let context = Context::new(dbfile.into(), id).await.unwrap();
for _ in 0..10u32 {
context.search_msgs(None, "hello").await.unwrap();