Skip to content

Commit

Permalink
Dependency Update (#77)
Browse files Browse the repository at this point in the history
* automated dependency update

* bounce version

* fix Bytes::parse_str

---------

Co-authored-by: yanganto <[email protected]>
Co-authored-by: Antonio Yang <[email protected]>
  • Loading branch information
3 people authored Nov 28, 2023
1 parent 4914977 commit a7b3c54
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "test-with"
version = "0.12.0"
version = "0.12.1"
authors = ["Antonio Yang <[email protected]>"]
edition = "2021"
license = "MIT"
Expand All @@ -22,7 +22,7 @@ regex = { version = "1" }
reqwest = { version = "0.11", features = ["blocking"], optional = true }
ping = { version = "0.5", optional = true }
sysinfo = { version = "0.29", optional = true }
byte-unit = { version = "4.0", optional = true }
byte-unit = { version = "5.0", optional = true }
num_cpus = { version = "1.13", optional = true }
which = { version = "5.0", optional = true }

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ the test runner will treat it as the test in Rust and also provide the same summ
The `runtime` feature should be enabled and include as normal dependency, and also include the `libtest-with` with corresponding features in `Cargo.toml`.
```toml
test-with = { version = "0.10", features = ["runtime"] }
libtest-with = { version = "0.6.1-4", features = ["net", "resource", "user", "executable"] }
libtest-with = { version = "0.6.1-5", features = ["net", "resource", "user", "executable"] }
```

Create an example with the following runtime macros (`test_with::runner!`, `#[test_with::module]`, `#[test_with::runtime_env()]`).
Expand Down
2 changes: 1 addition & 1 deletion examples/runner/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ edition = "2021"

[dependencies]
test-with = { path = "../../", features = ["runtime"] }
libtest-with = { version = "0.6.1-3", features = ["net", "resource", "user", "executable"]}
libtest-with = { version = "0.6.1-5", features = ["net", "resource", "user", "executable"]}
40 changes: 20 additions & 20 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//! ```toml
//! [dependencies]
//! test-with = { version = "*", default-features = false, features = ["runtime"] }
//! libtest-with = { version = "0.6.1-4", features = ["net", "resource", "user", "executable"] }
//! libtest-with = { version = "0.6.1-5", features = ["net", "resource", "user", "executable"] }
//! ```
//!
//! ```rust
Expand Down Expand Up @@ -1453,11 +1453,11 @@ pub fn mem(attr: TokenStream, stream: TokenStream) -> TokenStream {
fn check_mem_condition(mem_size_str: String) -> (bool, String) {
let mut sys = sysinfo::System::new_all();
sys.refresh_all();
let mem_size = match byte_unit::Byte::from_str(format!("{} B", sys.total_memory())) {
let mem_size = match byte_unit::Byte::parse_str(format!("{} B", sys.total_memory()), false) {
Ok(b) => b,
Err(_) => abort_call_site!("memory size description is not correct"),
};
let mem_size_limitation = match byte_unit::Byte::from_str(&mem_size_str) {
let mem_size_limitation = match byte_unit::Byte::parse_str(&mem_size_str, true) {
Ok(b) => b,
Err(_) => abort_call_site!("system memory size can not get"),
};
Expand Down Expand Up @@ -1490,7 +1490,7 @@ pub fn runtime_mem(_attr: TokenStream, _stream: TokenStream) -> TokenStream {
#[proc_macro_error]
pub fn runtime_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {
let mem_limitation_str = attr.to_string().replace(' ', "");
if byte_unit::Byte::from_str(&mem_limitation_str).is_err() {
if byte_unit::Byte::parse_str(&mem_limitation_str, true).is_err() {
abort_call_site!("memory size description is not correct")
}

Expand All @@ -1511,11 +1511,11 @@ pub fn runtime_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let mem_size = match libtest_with::byte_unit::Byte::from_str(format!("{} B", sys.total_memory())) {
let mem_size = match libtest_with::byte_unit::Byte::parse_str(format!("{} B", sys.total_memory()), false) {
Ok(b) => b,
Err(_) => panic!("system memory size can not get"),
};
let mem_size_limitation = libtest_with::byte_unit::Byte::from_str(#mem_limitation_str).expect("mem limitation should correct");
let mem_size_limitation = libtest_with::byte_unit::Byte::parse_str(#mem_limitation_str, true).expect("mem limitation should correct");
if mem_size >= mem_size_limitation {
#ident();
Ok(())
Expand Down Expand Up @@ -1555,7 +1555,7 @@ pub fn runtime_free_mem(_attr: TokenStream, _stream: TokenStream) -> TokenStream
#[proc_macro_error]
pub fn runtime_free_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {
let mem_limitation_str = attr.to_string().replace(' ', "");
if byte_unit::Byte::from_str(&mem_limitation_str).is_err() {
if byte_unit::Byte::parse_str(&mem_limitation_str, true).is_err() {
abort_call_site!("memory size description is not correct")
}

Expand All @@ -1576,11 +1576,11 @@ pub fn runtime_free_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let mem_size = match libtest_with::byte_unit::Byte::from_str(format!("{} B", sys.free_memory())) {
let mem_size = match libtest_with::byte_unit::Byte::parse_str(format!("{} B", sys.free_memory()), false) {
Ok(b) => b,
Err(_) => panic!("system memory size can not get"),
};
let mem_size_limitation = libtest_with::byte_unit::Byte::from_str(#mem_limitation_str).expect("mem limitation should correct");
let mem_size_limitation = libtest_with::byte_unit::Byte::parse_str(#mem_limitation_str, true).expect("mem limitation should correct");
if mem_size >= mem_size_limitation {
#ident();
Ok(())
Expand Down Expand Up @@ -1620,7 +1620,7 @@ pub fn runtime_available_mem(_attr: TokenStream, _stream: TokenStream) -> TokenS
#[proc_macro_error]
pub fn runtime_available_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {
let mem_limitation_str = attr.to_string().replace(' ', "");
if byte_unit::Byte::from_str(&mem_limitation_str).is_err() {
if byte_unit::Byte::parse_str(&mem_limitation_str, true).is_err() {
abort_call_site!("memory size description is not correct")
}

Expand All @@ -1641,11 +1641,11 @@ pub fn runtime_available_mem(attr: TokenStream, stream: TokenStream) -> TokenStr
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let mem_size = match libtest_with::byte_unit::Byte::from_str(format!("{} B", sys.available_memory())) {
let mem_size = match libtest_with::byte_unit::Byte::parse_str(format!("{} B", sys.available_memory()), false) {
Ok(b) => b,
Err(_) => panic!("system memory size can not get"),
};
let mem_size_limitation = libtest_with::byte_unit::Byte::from_str(#mem_limitation_str).expect("mem limitation should correct");
let mem_size_limitation = libtest_with::byte_unit::Byte::parse_str(#mem_limitation_str, true).expect("mem limitation should correct");
if mem_size >= mem_size_limitation {
#ident();
Ok(())
Expand Down Expand Up @@ -1699,11 +1699,11 @@ pub fn swap(attr: TokenStream, stream: TokenStream) -> TokenStream {
fn check_swap_condition(swap_size_str: String) -> (bool, String) {
let mut sys = sysinfo::System::new_all();
sys.refresh_all();
let swap_size = match byte_unit::Byte::from_str(format!("{} B", sys.total_swap())) {
let swap_size = match byte_unit::Byte::parse_str(format!("{} B", sys.total_swap()), false) {
Ok(b) => b,
Err(_) => abort_call_site!("Swap size description is not correct"),
};
let swap_size_limitation = match byte_unit::Byte::from_str(&swap_size_str) {
let swap_size_limitation = match byte_unit::Byte::parse_str(&swap_size_str, true) {
Ok(b) => b,
Err(_) => abort_call_site!("Can not get system swap size"),
};
Expand Down Expand Up @@ -1736,7 +1736,7 @@ pub fn runtime_swap(_attr: TokenStream, _stream: TokenStream) -> TokenStream {
#[proc_macro_error]
pub fn runtime_swap(attr: TokenStream, stream: TokenStream) -> TokenStream {
let swap_limitation_str = attr.to_string().replace(' ', "");
if byte_unit::Byte::from_str(&swap_limitation_str).is_err() {
if byte_unit::Byte::parse_str(&swap_limitation_str, true).is_err() {
abort_call_site!("swap size description is not correct")
}

Expand All @@ -1757,11 +1757,11 @@ pub fn runtime_swap(attr: TokenStream, stream: TokenStream) -> TokenStream {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let swap_size = match libtest_with::byte_unit::Byte::from_str(format!("{} B", sys.total_swap())) {
let swap_size = match libtest_with::byte_unit::Byte::parse_str(format!("{} B", sys.total_swap()), false) {
Ok(b) => b,
Err(_) => panic!("system swap size can not get"),
};
let swap_size_limitation = libtest_with::byte_unit::Byte::from_str(#swap_limitation_str).expect("swap limitation should correct");
let swap_size_limitation = libtest_with::byte_unit::Byte::parse_str(#swap_limitation_str, true).expect("swap limitation should correct");
if swap_size >= swap_size_limitation {
#ident();
Ok(())
Expand Down Expand Up @@ -1801,7 +1801,7 @@ pub fn runtime_free_swap(_attr: TokenStream, _stream: TokenStream) -> TokenStrea
#[proc_macro_error]
pub fn runtime_free_swap(attr: TokenStream, stream: TokenStream) -> TokenStream {
let swap_limitation_str = attr.to_string().replace(' ', "");
if byte_unit::Byte::from_str(&swap_limitation_str).is_err() {
if byte_unit::Byte::parse_str(&swap_limitation_str, true).is_err() {
abort_call_site!("swap size description is not correct")
}

Expand All @@ -1822,11 +1822,11 @@ pub fn runtime_free_swap(attr: TokenStream, stream: TokenStream) -> TokenStream
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let swap_size = match libtest_with::byte_unit::Byte::from_str(format!("{} B", sys.free_swap())) {
let swap_size = match libtest_with::byte_unit::Byte::parse_str(format!("{} B", sys.free_swap()), false) {
Ok(b) => b,
Err(_) => panic!("system swap size can not get"),
};
let swap_size_limitation = libtest_with::byte_unit::Byte::from_str(#swap_limitation_str).expect("swap limitation should correct");
let swap_size_limitation = libtest_with::byte_unit::Byte::parse_str(#swap_limitation_str, true).expect("swap limitation should correct");
if swap_size >= swap_size_limitation {
#ident();
Ok(())
Expand Down

0 comments on commit a7b3c54

Please sign in to comment.