Skip to content

Commit

Permalink
Add regression test for components
Browse files Browse the repository at this point in the history
  • Loading branch information
GuillaumeGomez committed Apr 9, 2024
1 parent 1533bbe commit cfd3d41
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ jobs:
if: matrix.os != 'macos-latest'
env:
RUST_BACKTRACE: full
LINUX_CI: 1 # Needed for components...
- name: Execute tests (mac, no features)
run: cargo test --no-default-features -- --test-threads 1
if: matrix.os == 'macos-latest'
Expand All @@ -180,6 +181,7 @@ jobs:
cargo test --features serde --doc
env:
RUST_BACKTRACE: full
LINUX_CI: 1 # Needed for components...

c_interface:
runs-on: ubuntu-latest
Expand Down
21 changes: 21 additions & 0 deletions tests/components.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Take a look at the license at the top of the repository in the LICENSE file.

#[test]
fn test_components() {
use std::env::var;

let mut c = sysinfo::Components::new();
assert!(c.is_empty());

// Unfortunately, we can't get components on linux and freebsd in the CI...
if !sysinfo::IS_SUPPORTED_SYSTEM
|| cfg!(windows)
|| var("FREEBSD_CI").is_ok()
|| var("LINUX_CI").is_ok()
{
return;
}

c.refresh_list();
assert!(!c.is_empty());
}

0 comments on commit cfd3d41

Please sign in to comment.