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 2b89a58
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
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
22 changes: 22 additions & 0 deletions tests/components.rs
@@ -0,0 +1,22 @@
// 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 in the CI...
if !sysinfo::IS_SUPPORTED_SYSTEM
|| cfg!(windows)
|| var("FREEBSD_CI").is_ok()
|| var("LINUX_CI").is_ok()
|| var("APPLE_CI").is_ok()
{
return;
}

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

0 comments on commit 2b89a58

Please sign in to comment.