Skip to content

Commit

Permalink
add runtime resource macro (#71)
Browse files Browse the repository at this point in the history
* fix docs

* add runtime resource macros

* bounce version
  • Loading branch information
yanganto authored Oct 7, 2023
1 parent 2580d7e commit 3decaa8
Show file tree
Hide file tree
Showing 3 changed files with 491 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test-with"
version = "0.10.5"
version = "0.10.6"
authors = ["Antonio Yang <[email protected]>"]
edition = "2021"
license = "MIT"
Expand Down
47 changes: 46 additions & 1 deletion examples/runner/examples/test.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
test_with::runner!(env, file, path, net, user, exe);
test_with::runner!(env, file, path, net, user, exe, resource);

#[test_with::module]
mod env {
Expand Down Expand Up @@ -103,3 +103,48 @@ mod exe {
assert!(true);
}
}

#[test_with::module]
mod resource {
// Only works with enough cpu core
#[test_with::runtime_cpu_core(32)]
fn test_ignored_core_not_enough() {
panic!("should be ignored")
}

// Only works with enough physical cpu core
#[test_with::runtime_phy_cpu_core(32)]
fn test_ignored_phy_core_not_enough() {
panic!("should be ignored")
}

// Only works with enough memory size
#[test_with::runtime_mem(100GB)]
fn test_ignored_mem_not_enough() {
panic!("should be ignored")
}

// Only works with enough free memory size
#[test_with::runtime_free_mem(100GB)]
fn test_ignored_free_mem_not_enough() {
panic!("should be ignored")
}

// Only works with enough available memory size
#[test_with::runtime_available_mem(100GB)]
fn test_ignored_available_mem_not_enough() {
panic!("should be ignored")
}

// Only works with enough swap size
#[test_with::runtime_swap(100GB)]
fn test_ignored_swap_not_enough() {
panic!("should be ignored")
}

// Only works with enough free swap size
#[test_with::runtime_free_swap(100GB)]
fn test_ignored_free_swap_not_enough() {
panic!("should be ignored")
}
}
Loading

0 comments on commit 3decaa8

Please sign in to comment.