mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 17:06:35 +03:00
Fix benchmark compile errors (#2881)
* Fix benchmark compile errors * Also check bench code during CI
This commit is contained in:
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
@@ -118,7 +118,7 @@ jobs:
|
|||||||
RUSTFLAGS: -D warnings
|
RUSTFLAGS: -D warnings
|
||||||
with:
|
with:
|
||||||
command: check
|
command: check
|
||||||
args: --all --bins --examples --tests --features repl
|
args: --all --bins --examples --tests --features repl --benches
|
||||||
|
|
||||||
- name: tests
|
- name: tests
|
||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
|
|||||||
@@ -8,9 +8,7 @@ async fn address_book_benchmark(n: u32, read_count: u32) {
|
|||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let dbfile = dir.path().join("db.sqlite");
|
let dbfile = dir.path().join("db.sqlite");
|
||||||
let id = 100;
|
let id = 100;
|
||||||
let context = Context::new("FakeOS".into(), dbfile.into(), id)
|
let context = Context::new(dbfile.into(), id).await.unwrap();
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let book = (0..n)
|
let book = (0..n)
|
||||||
.map(|i| format!("Name {}\naddr{}@example.org\n", i, i))
|
.map(|i| format!("Name {}\naddr{}@example.org\n", i, i))
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ async fn create_accounts(n: u32) {
|
|||||||
let dir = tempdir().unwrap();
|
let dir = tempdir().unwrap();
|
||||||
let p: PathBuf = dir.path().join("accounts").into();
|
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 {
|
for expected_id in 2..n {
|
||||||
let id = accounts.add_account().await.unwrap();
|
let id = accounts.add_account().await.unwrap();
|
||||||
|
|||||||
@@ -6,9 +6,7 @@ use std::path::Path;
|
|||||||
async fn search_benchmark(path: impl AsRef<Path>) {
|
async fn search_benchmark(path: impl AsRef<Path>) {
|
||||||
let dbfile = path.as_ref();
|
let dbfile = path.as_ref();
|
||||||
let id = 100;
|
let id = 100;
|
||||||
let context = Context::new("FakeOS".into(), dbfile.into(), id)
|
let context = Context::new(dbfile.into(), id).await.unwrap();
|
||||||
.await
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
for _ in 0..10u32 {
|
for _ in 0..10u32 {
|
||||||
context.search_msgs(None, "hello").await.unwrap();
|
context.search_msgs(None, "hello").await.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user