Skip to content

Commit

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

* update libtest-with

* adapt sysinfo 0.30

---------

Co-authored-by: yanganto <[email protected]>
Co-authored-by: Antonio Yang <[email protected]>
  • Loading branch information
3 people authored Dec 21, 2023
1 parent a7b3c54 commit 4be8826
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ regex = { version = "1" }

reqwest = { version = "0.11", features = ["blocking"], optional = true }
ping = { version = "0.5", optional = true }
sysinfo = { version = "0.29", optional = true }
sysinfo = { version = "0.30", 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-5", features = ["net", "resource", "user", "executable"] }
libtest-with = { version = "0.6.1-6", 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-5", features = ["net", "resource", "user", "executable"]}
libtest-with = { version = "0.6.1-6", features = ["net", "resource", "user", "executable"]}
44 changes: 22 additions & 22 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-5", features = ["net", "resource", "user", "executable"] }
//! libtest-with = { version = "0.6.1-6", features = ["net", "resource", "user", "executable"] }
//! ```
//!
//! ```rust
Expand Down Expand Up @@ -65,8 +65,6 @@ use syn::{parse_macro_input, ItemFn, ItemMod};
#[cfg(feature = "runtime")]
use syn::{Item, ItemStruct, ItemType};

#[cfg(feature = "resource")]
use sysinfo::SystemExt;
#[cfg(feature = "executable")]
use which::which;

Expand Down Expand Up @@ -1451,8 +1449,9 @@ pub fn mem(attr: TokenStream, stream: TokenStream) -> TokenStream {

#[cfg(feature = "resource")]
fn check_mem_condition(mem_size_str: String) -> (bool, String) {
let mut sys = sysinfo::System::new_all();
sys.refresh_all();
let sys = sysinfo::System::new_with_specifics(
sysinfo::RefreshKind::new().with_memory(sysinfo::MemoryRefreshKind::new().with_swap()),
);
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"),
Expand Down Expand Up @@ -1508,9 +1507,9 @@ pub fn runtime_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {

quote::quote! {
fn #check_ident() -> Result<(), libtest_with::Failed> {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let sys = libtest_with::sysinfo::System::new_with_specifics(
libtest_with::sysinfo::RefreshKind::new().with_memory(libtest_with::sysinfo::MemoryRefreshKind::new().with_ram()),
);
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"),
Expand Down Expand Up @@ -1573,9 +1572,9 @@ pub fn runtime_free_mem(attr: TokenStream, stream: TokenStream) -> TokenStream {

quote::quote! {
fn #check_ident() -> Result<(), libtest_with::Failed> {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let sys = libtest_with::sysinfo::System::new_with_specifics(
libtest_with::sysinfo::RefreshKind::new().with_memory(libtest_with::sysinfo::MemoryRefreshKind::new().with_ram()),
);
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"),
Expand Down Expand Up @@ -1638,9 +1637,9 @@ pub fn runtime_available_mem(attr: TokenStream, stream: TokenStream) -> TokenStr

quote::quote! {
fn #check_ident() -> Result<(), libtest_with::Failed> {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let sys = libtest_with::sysinfo::System::new_with_specifics(
libtest_with::sysinfo::RefreshKind::new().with_memory(libtest_with::sysinfo::MemoryRefreshKind::new().with_ram()),
);
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"),
Expand Down Expand Up @@ -1697,8 +1696,9 @@ pub fn swap(attr: TokenStream, stream: TokenStream) -> TokenStream {

#[cfg(feature = "resource")]
fn check_swap_condition(swap_size_str: String) -> (bool, String) {
let mut sys = sysinfo::System::new_all();
sys.refresh_all();
let sys = sysinfo::System::new_with_specifics(
sysinfo::RefreshKind::new().with_memory(sysinfo::MemoryRefreshKind::new().with_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"),
Expand Down Expand Up @@ -1754,9 +1754,9 @@ pub fn runtime_swap(attr: TokenStream, stream: TokenStream) -> TokenStream {

quote::quote! {
fn #check_ident() -> Result<(), libtest_with::Failed> {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let sys = libtest_with::sysinfo::System::new_with_specifics(
libtest_with::sysinfo::RefreshKind::new().with_memory(libtest_with::sysinfo::MemoryRefreshKind::new().with_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"),
Expand Down Expand Up @@ -1819,9 +1819,9 @@ pub fn runtime_free_swap(attr: TokenStream, stream: TokenStream) -> TokenStream

quote::quote! {
fn #check_ident() -> Result<(), libtest_with::Failed> {
use libtest_with::sysinfo::SystemExt;
let mut sys = libtest_with::sysinfo::System::new_all();
sys.refresh_all();
let sys = libtest_with::sysinfo::System::new_with_specifics(
libtest_with::sysinfo::RefreshKind::new().with_memory(libtest_with::sysinfo::MemoryRefreshKind::new().with_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"),
Expand Down

0 comments on commit 4be8826

Please sign in to comment.