chore: stabilize current head before Phase 10a QC
This commit is contained in:
@@ -91,7 +91,10 @@ fn resolve_app_data_dir() -> PathBuf {
|
||||
return PathBuf::from(xdg).join("magnotia");
|
||||
}
|
||||
}
|
||||
PathBuf::from(home).join(".local").join("share").join("magnotia")
|
||||
PathBuf::from(home)
|
||||
.join(".local")
|
||||
.join("share")
|
||||
.join("magnotia")
|
||||
}
|
||||
|
||||
#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))]
|
||||
@@ -112,7 +115,10 @@ mod tests {
|
||||
let paths = AppPaths {
|
||||
app_data_dir: PathBuf::from("/tmp/magnotia-test"),
|
||||
};
|
||||
assert_eq!(paths.database_path(), PathBuf::from("/tmp/magnotia-test/magnotia.db"));
|
||||
assert_eq!(
|
||||
paths.database_path(),
|
||||
PathBuf::from("/tmp/magnotia-test/magnotia.db")
|
||||
);
|
||||
assert_eq!(
|
||||
paths.speech_model_dir(&ModelId::new("whisper-base-en")),
|
||||
PathBuf::from("/tmp/magnotia-test/models/whisper-base-en")
|
||||
|
||||
@@ -162,7 +162,9 @@ static TEST_OVERRIDE: Mutex<Option<PowerState>> = Mutex::new(None);
|
||||
|
||||
#[cfg(test)]
|
||||
fn test_get_override() -> Option<PowerState> {
|
||||
*TEST_OVERRIDE.lock().expect("power test override mutex poisoned")
|
||||
*TEST_OVERRIDE
|
||||
.lock()
|
||||
.expect("power test override mutex poisoned")
|
||||
}
|
||||
|
||||
/// Drop-guard that resets `TEST_OVERRIDE` to `None` on drop (including on unwind).
|
||||
@@ -174,7 +176,9 @@ struct OverrideGuard;
|
||||
#[cfg(test)]
|
||||
impl Drop for OverrideGuard {
|
||||
fn drop(&mut self) {
|
||||
*TEST_OVERRIDE.lock().expect("power test override mutex poisoned") = None;
|
||||
*TEST_OVERRIDE
|
||||
.lock()
|
||||
.expect("power test override mutex poisoned") = None;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +192,9 @@ impl Drop for OverrideGuard {
|
||||
pub(crate) fn with_override<R>(state: Option<PowerState>, body: impl FnOnce() -> R) -> R {
|
||||
static TEST_LOCK: Mutex<()> = Mutex::new(());
|
||||
let _lock = TEST_LOCK.lock().expect("power TEST_LOCK poisoned");
|
||||
*TEST_OVERRIDE.lock().expect("power test override mutex poisoned") = state;
|
||||
*TEST_OVERRIDE
|
||||
.lock()
|
||||
.expect("power test override mutex poisoned") = state;
|
||||
let _guard = OverrideGuard;
|
||||
body()
|
||||
}
|
||||
@@ -226,7 +232,10 @@ mod tests {
|
||||
let dir = tempdir().unwrap();
|
||||
write_supply(dir.path(), "AC", "Mains", "0");
|
||||
write_supply(dir.path(), "BAT0", "Battery", "0");
|
||||
assert_eq!(parse_power_state_from_dir(dir.path()), PowerState::OnBattery);
|
||||
assert_eq!(
|
||||
parse_power_state_from_dir(dir.path()),
|
||||
PowerState::OnBattery
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -39,8 +39,7 @@ impl ProcessLister {
|
||||
/// Refresh the process table in place and return the current
|
||||
/// lowercased executable names.
|
||||
pub fn snapshot(&mut self) -> Vec<String> {
|
||||
self.system
|
||||
.refresh_processes(ProcessesToUpdate::All, true);
|
||||
self.system.refresh_processes(ProcessesToUpdate::All, true);
|
||||
self.system
|
||||
.processes()
|
||||
.values()
|
||||
|
||||
@@ -113,7 +113,9 @@ mod tests {
|
||||
fn with_thread_env_lock<R>(body: impl FnOnce() -> R) -> R {
|
||||
use std::sync::Mutex;
|
||||
static THREAD_ENV_LOCK: Mutex<()> = Mutex::new(());
|
||||
let _lock = THREAD_ENV_LOCK.lock().expect("tuning thread-env lock poisoned");
|
||||
let _lock = THREAD_ENV_LOCK
|
||||
.lock()
|
||||
.expect("tuning thread-env lock poisoned");
|
||||
body()
|
||||
}
|
||||
|
||||
@@ -126,8 +128,10 @@ mod tests {
|
||||
with_thread_env_lock(|| {
|
||||
std::env::remove_var("MAGNOTIA_INFERENCE_THREADS");
|
||||
let n = inference_thread_count(Workload::Llm, false);
|
||||
assert!(n >= MIN_INFERENCE_THREADS && n <= MAX_INFERENCE_THREADS,
|
||||
"got {n}, expected within [{MIN_INFERENCE_THREADS}, {MAX_INFERENCE_THREADS}]");
|
||||
assert!(
|
||||
(MIN_INFERENCE_THREADS..=MAX_INFERENCE_THREADS).contains(&n),
|
||||
"got {n}, expected within [{MIN_INFERENCE_THREADS}, {MAX_INFERENCE_THREADS}]"
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -175,8 +179,10 @@ mod tests {
|
||||
std::env::remove_var("MAGNOTIA_INFERENCE_THREADS");
|
||||
crate::power::with_override(Some(PowerState::OnAc), || {
|
||||
let n = inference_thread_count(Workload::Llm, true);
|
||||
assert!(n <= GPU_FLOOR_LLM.max(MIN_INFERENCE_THREADS),
|
||||
"Llm with GPU offload should clamp to {GPU_FLOOR_LLM}, got {n}");
|
||||
assert!(
|
||||
n <= GPU_FLOOR_LLM.max(MIN_INFERENCE_THREADS),
|
||||
"Llm with GPU offload should clamp to {GPU_FLOOR_LLM}, got {n}"
|
||||
);
|
||||
assert!(n >= MIN_INFERENCE_THREADS);
|
||||
});
|
||||
});
|
||||
@@ -196,11 +202,12 @@ mod tests {
|
||||
});
|
||||
}
|
||||
|
||||
const _: () = assert!(GPU_FLOOR_WHISPER >= GPU_FLOOR_LLM);
|
||||
|
||||
#[test]
|
||||
fn whisper_gpu_floor_is_at_least_llm_gpu_floor() {
|
||||
// Architectural invariant: whisper retains CPU work even when
|
||||
// GPU-offloaded; its floor must not be lower than the LLM's.
|
||||
assert!(GPU_FLOOR_WHISPER >= GPU_FLOOR_LLM);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
Reference in New Issue
Block a user