fix: cargo formatting for ci/cd
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use ghost_core::{AnomalyDetector, ProcessInfo, MemoryRegion, MemoryProtection};
|
||||
use ghost_core::{AnomalyDetector, MemoryProtection, MemoryRegion, ProcessInfo};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[test]
|
||||
@@ -53,14 +53,12 @@ fn test_anomaly_analysis() {
|
||||
thread_count: 5,
|
||||
};
|
||||
|
||||
let regions = vec![
|
||||
MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
},
|
||||
];
|
||||
let regions = vec![MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
}];
|
||||
|
||||
let features = detector.extract_features(&process, ®ions, None);
|
||||
|
||||
@@ -84,14 +82,12 @@ fn test_profile_persistence() {
|
||||
thread_count: 5,
|
||||
};
|
||||
|
||||
let regions = vec![
|
||||
MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
},
|
||||
];
|
||||
let regions = vec![MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
}];
|
||||
|
||||
for _ in 0..15 {
|
||||
let features = detector.extract_features(&process, ®ions, None);
|
||||
@@ -101,11 +97,19 @@ fn test_profile_persistence() {
|
||||
let temp_path = PathBuf::from("/tmp/ghost_test_profiles.json");
|
||||
|
||||
let save_result = detector.save_profiles(&temp_path);
|
||||
assert!(save_result.is_ok(), "Failed to save profiles: {:?}", save_result.err());
|
||||
assert!(
|
||||
save_result.is_ok(),
|
||||
"Failed to save profiles: {:?}",
|
||||
save_result.err()
|
||||
);
|
||||
|
||||
let mut detector2 = AnomalyDetector::new();
|
||||
let load_result = detector2.load_profiles(&temp_path);
|
||||
assert!(load_result.is_ok(), "Failed to load profiles: {:?}", load_result.err());
|
||||
assert!(
|
||||
load_result.is_ok(),
|
||||
"Failed to load profiles: {:?}",
|
||||
load_result.err()
|
||||
);
|
||||
|
||||
assert!(!detector2.get_all_profiles().is_empty());
|
||||
|
||||
@@ -125,14 +129,12 @@ fn test_global_baseline_computation() {
|
||||
thread_count: 5,
|
||||
};
|
||||
|
||||
let regions = vec![
|
||||
MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
},
|
||||
];
|
||||
let regions = vec![MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
}];
|
||||
|
||||
for _ in 0..15 {
|
||||
let features = detector.extract_features(&process, ®ions, None);
|
||||
@@ -157,14 +159,12 @@ fn test_profile_cleanup() {
|
||||
thread_count: 5,
|
||||
};
|
||||
|
||||
let regions = vec![
|
||||
MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
},
|
||||
];
|
||||
let regions = vec![MemoryRegion {
|
||||
base_address: 0x1000,
|
||||
size: 4096,
|
||||
protection: MemoryProtection::ReadExecute,
|
||||
region_type: "IMAGE".to_string(),
|
||||
}];
|
||||
|
||||
for _ in 0..15 {
|
||||
let features = detector.extract_features(&process, ®ions, None);
|
||||
|
||||
@@ -10,7 +10,10 @@ fn test_macos_process_enumeration() {
|
||||
println!("Found {} processes", processes.len());
|
||||
|
||||
for proc in processes.iter().filter(|p| p.pid > 0).take(5) {
|
||||
println!("PID: {}, Name: {}, Path: {:?}", proc.pid, proc.name, proc.path);
|
||||
println!(
|
||||
"PID: {}, Name: {}, Path: {:?}",
|
||||
proc.pid, proc.name, proc.path
|
||||
);
|
||||
assert!(proc.pid > 0, "PID should be positive");
|
||||
assert!(!proc.name.is_empty(), "Process name should not be empty");
|
||||
}
|
||||
@@ -19,12 +22,21 @@ fn test_macos_process_enumeration() {
|
||||
let current_process = processes.iter().find(|p| p.pid == current_pid);
|
||||
|
||||
if let Some(proc) = current_process {
|
||||
println!("Current process found: PID={}, Name={}", proc.pid, proc.name);
|
||||
println!(
|
||||
"Current process found: PID={}, Name={}",
|
||||
proc.pid, proc.name
|
||||
);
|
||||
} else {
|
||||
println!("Current process (PID={}) not in list - this is OK for test processes", current_pid);
|
||||
println!(
|
||||
"Current process (PID={}) not in list - this is OK for test processes",
|
||||
current_pid
|
||||
);
|
||||
}
|
||||
|
||||
assert!(processes.iter().any(|p| p.pid == 1), "Should at least find launchd (PID 1)");
|
||||
assert!(
|
||||
processes.iter().any(|p| p.pid == 1),
|
||||
"Should at least find launchd (PID 1)"
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(target_os = "macos")]
|
||||
|
||||
Reference in New Issue
Block a user