Skip to content

Commit

Permalink
chore: test with nextest (#20)
Browse files Browse the repository at this point in the history
* chore: use nextest for testing

* chore: replace write with write_all

* chore: use uniq directory name to avoid failure when testing with nextest
  • Loading branch information
zouguangxian authored Feb 7, 2025
1 parent 5a1c850 commit 29fe58e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ build: install-deps
cargo build --release

test: install-deps
cargo test --release
cargo nextest run

format:
cargo fmt --all
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cargo run --bin speed -- --entry-count 4000000
Run unit tests:

```bash
cargo test
cargo nextest run
```

## Getting started
Expand Down
4 changes: 2 additions & 2 deletions hpfile/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ impl HPFile {
buffer.resize(buffer.len() + IO_BLK_SIZE - tail_len, 0);
}
f.seek(SeekFrom::End(0)).unwrap();
f.write(buffer).unwrap();
f.write_all(buffer)?;
self.file_size_on_disk
.fetch_add(buffer.len() as i64, Ordering::SeqCst);
buffer.clear();
Expand Down Expand Up @@ -498,7 +498,7 @@ impl HPFile {
buffer.extend_from_slice(&bz[0..split_pos]);
let mut opt = self.file_map.get_mut(&largest_id);
let mut f = &opt.as_mut().unwrap().value().0;
if f.write(buffer).is_err() {
if f.write_all(buffer).is_err() {
panic!("Fail to write file");
}
self.file_size_on_disk
Expand Down
3 changes: 2 additions & 1 deletion install-prereqs-ubuntu.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
#!/bin/bash
sudo apt-get install g++ linux-libc-dev libclang-dev unzip libjemalloc-dev make -y
sudo apt-get install g++ linux-libc-dev libclang-dev unzip libjemalloc-dev make -y
cargo install cargo-nextest
2 changes: 1 addition & 1 deletion qmdb/tests/test_consistency_with_seqads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use std::time::Duration;
#[cfg(not(feature = "tee_cipher"))]
#[test]
fn test_consistency() {
let ads_dir = "./SEQADS";
let ads_dir = "./SEQADS-consistency";
let _tmp_dir = TempDir::new(ads_dir);

let config = Config::from_dir_and_compact_opt(ads_dir, 1, 1, 1);
Expand Down
2 changes: 1 addition & 1 deletion qmdb/tests/test_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ fn check_equal(pp: &ProofPath, other: &ProofPath) -> String {

#[test]
fn test_tree_proof() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-proof";
let _tmp_dir = TempDir::new(dir_name);

let deact_sn_list: Vec<u64> = (0..2048)
Expand Down
2 changes: 1 addition & 1 deletion qmdb/tests/test_recover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ fn compare_twigs(

#[test]
fn test_load_tree() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-loadtree";
let _tmp_dir = TempDir::new(dir_name);

let deact_sn_list = vec![101, 999, 1002];
Expand Down
12 changes: 6 additions & 6 deletions qmdb/tests/test_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use serial_test::serial;
#[test]
#[serial]
fn test_tree_new() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-new";
let _tmp_dir = TempDir::new(dir_name);

let tree = Tree::new(
Expand Down Expand Up @@ -189,7 +189,7 @@ fn test_max_n_at_level() {
#[test]
#[serial]
fn test_tree_prune_nodes() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-prune-nodes";
let _tmp_dir = TempDir::new(dir_name);

let mut tree = Tree::new(
Expand Down Expand Up @@ -354,7 +354,7 @@ fn test_tree_prune_nodes() {
#[test]
#[serial]
fn test_tree_sync_mt_for_youngest_twig() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-sync-mt-for-youngest-twig";
let _tmp_dir = TempDir::new(dir_name);

let mut tree = Tree::new(
Expand Down Expand Up @@ -414,7 +414,7 @@ fn test_tree_sync_mt_for_youngest_twig() {
#[test]
#[serial]
fn test_tree_sync_mt_for_active_bits() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-sync-mt-for-active-bits";
let _tmp_dir = TempDir::new(dir_name);

let mut tree = Tree::new(
Expand Down Expand Up @@ -472,7 +472,7 @@ fn test_tree_sync_mt_for_active_bits() {
#[test]
#[serial]
fn test_tree_sync_upper_nodes() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-sync-upper-nodes";
let _tmp_dir = TempDir::new(dir_name);

let mut tree = Tree::new(
Expand Down Expand Up @@ -519,7 +519,7 @@ fn test_tree_sync_upper_nodes() {
#[test]
#[serial]
fn test_tree_append_entry() {
let dir_name = "./DataTree";
let dir_name = "./DataTree-append-entry";
let _tmp_dir = TempDir::new(dir_name);

let deact_sn_list = vec![101, 999, 1002];
Expand Down

1 comment on commit 29fe58e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 29fe58e Previous: 3ea270e Ratio
Inserts Throughput 366780.49405875383 ops/s 3058783.736434638 ops/s 8.34

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.