|
|
@@ -1,4 +1,4 @@
|
|
|
-// main.rs — Entrypoint for stl_native_server (v0.8.1.19)
|
|
|
+// main.rs — Entrypoint for stl_native_server
|
|
|
#![allow(special_module_name)]
|
|
|
#![allow(dead_code)]
|
|
|
|
|
|
@@ -12,6 +12,7 @@ mod json;
|
|
|
mod lib;
|
|
|
mod n540;
|
|
|
mod pxe;
|
|
|
+mod pxe_dhcp;
|
|
|
mod results;
|
|
|
mod storage;
|
|
|
mod thermal_mcu;
|
|
|
@@ -24,6 +25,7 @@ use config::ServerArgs;
|
|
|
use std::net::TcpListener;
|
|
|
use std::path::PathBuf;
|
|
|
use std::process;
|
|
|
+use std::sync::atomic::{AtomicUsize, Ordering};
|
|
|
use std::sync::Arc;
|
|
|
use std::thread;
|
|
|
|
|
|
@@ -34,19 +36,27 @@ fn main() {
|
|
|
if let Some(pos) = raw_args.iter().position(|a| a == "--replay-trace") {
|
|
|
let dir = raw_args
|
|
|
.get(pos + 1)
|
|
|
+ .filter(|a| !a.starts_with("--"))
|
|
|
.map(PathBuf::from)
|
|
|
.unwrap_or_else(|| PathBuf::from("data/trace"));
|
|
|
let mut station: Option<String> = None;
|
|
|
- let mut at_ms: i64 = i64::MAX;
|
|
|
+ let mut at_ms: i64 = -1;
|
|
|
let mut idx = 1;
|
|
|
while idx < raw_args.len() {
|
|
|
match raw_args[idx].as_str() {
|
|
|
+ "--replay-trace" => {
|
|
|
+ idx += if raw_args.get(idx + 1).map(|a| !a.starts_with("--")).unwrap_or(false) {
|
|
|
+ 2
|
|
|
+ } else {
|
|
|
+ 1
|
|
|
+ };
|
|
|
+ }
|
|
|
"--station" if idx + 1 < raw_args.len() => {
|
|
|
station = Some(raw_args[idx + 1].clone());
|
|
|
idx += 2;
|
|
|
}
|
|
|
"--at-ms" if idx + 1 < raw_args.len() => {
|
|
|
- at_ms = raw_args[idx + 1].parse::<i64>().unwrap_or(i64::MAX);
|
|
|
+ at_ms = raw_args[idx + 1].parse::<i64>().unwrap_or(-1);
|
|
|
idx += 2;
|
|
|
}
|
|
|
_ => idx += 1,
|
|
|
@@ -78,17 +88,35 @@ fn main() {
|
|
|
|
|
|
let listener = TcpListener::bind(&args.web_listen).expect("Failed to bind web-listen port");
|
|
|
eprintln!(
|
|
|
- "[stl_native_server] v{} ({}) HTTP+WebSocket listening on http://{} (web_dir={})",
|
|
|
+ "[stl_native_server] v{} ({}) HTTP+WebSocket listening on http://{} (web_dir={}, shards={}, ipmi_workers={}, pxe_mode={})",
|
|
|
args.version,
|
|
|
args.commit,
|
|
|
args.web_listen,
|
|
|
- args.web_dir.display()
|
|
|
+ args.web_dir.display(),
|
|
|
+ hub.reactor_pool.shard_count(),
|
|
|
+ hub.reactor_pool.ipmi_worker_count(),
|
|
|
+ hub.pxe_dhcp_hub.get_config().mode.as_str()
|
|
|
);
|
|
|
|
|
|
+ const MAX_HTTP_CONNS: usize = 128;
|
|
|
+ let active_http = Arc::new(AtomicUsize::new(0));
|
|
|
for stream in listener.incoming() {
|
|
|
- if let Ok(s) = stream {
|
|
|
+ if let Ok(mut s) = stream {
|
|
|
+ let prev = active_http.fetch_add(1, Ordering::AcqRel);
|
|
|
+ if prev >= MAX_HTTP_CONNS {
|
|
|
+ active_http.fetch_sub(1, Ordering::AcqRel);
|
|
|
+ use std::io::Write;
|
|
|
+ let _ = s.write_all(
|
|
|
+ b"HTTP/1.1 503 Service Unavailable\r\nContent-Length: 11\r\nConnection: close\r\n\r\nServer Busy",
|
|
|
+ );
|
|
|
+ continue;
|
|
|
+ }
|
|
|
let h = Arc::clone(&hub);
|
|
|
- thread::spawn(move || handle_http_client(s, h));
|
|
|
+ let cnt = Arc::clone(&active_http);
|
|
|
+ thread::spawn(move || {
|
|
|
+ handle_http_client(s, h);
|
|
|
+ cnt.fetch_sub(1, Ordering::AcqRel);
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -341,6 +369,13 @@ mod tests {
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -634,6 +669,13 @@ mod tests {
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -812,6 +854,13 @@ mod tests {
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -873,6 +922,13 @@ mod tests {
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.19".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -2128,6 +2184,13 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "test".to_string(),
|
|
|
@@ -2328,6 +2391,13 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -2475,6 +2545,13 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -2586,6 +2663,13 @@ Finished pass #1 (of 1) (Cumulative error count: 9, buffer full count: 0)\r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -2766,6 +2850,13 @@ N1.C11.D0: FPT: DisableDIMM()\r\n\
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -2931,7 +3022,7 @@ Reset Type: Warm Reset\r\n\
|
|
|
}
|
|
|
assert_eq!(s167_st.dimms[0].presence, "present");
|
|
|
|
|
|
- // 10. load_station_settings clears persisted failed/running task_batch on backend startup
|
|
|
+ // 10. load_station_settings preserves failed task_batch history and marks persisted running task_batch as interrupted
|
|
|
let mut saved_st = StationState::new("S2", "Station 2", "192.168.2.165", "");
|
|
|
saved_st.task_batch.set("state", JsonVal::Str("failed".to_string()));
|
|
|
saved_st.task_batch.set("batch_id", JsonVal::Str("TB-OLD".to_string()));
|
|
|
@@ -2940,8 +3031,19 @@ Reset Type: Warm Reset\r\n\
|
|
|
loaded_map.insert("S2".to_string(), StationState::new("S2", "Station 2", "", ""));
|
|
|
crate::storage::load_station_settings(&tmp_dir, &mut loaded_map);
|
|
|
let loaded_tb = &loaded_map.get("S2").unwrap().task_batch;
|
|
|
- assert_eq!(loaded_tb.get_str_or("state", ""), "idle");
|
|
|
- assert_eq!(loaded_tb.get_str_or("batch_id", ""), "");
|
|
|
+ assert_eq!(loaded_tb.get_str_or("state", ""), "failed");
|
|
|
+ assert_eq!(loaded_tb.get_str_or("batch_id", ""), "TB-OLD");
|
|
|
+
|
|
|
+ saved_st.task_batch.set("state", JsonVal::Str("running".to_string()));
|
|
|
+ saved_st.task_batch.set("batch_id", JsonVal::Str("TB-RUN".to_string()));
|
|
|
+ crate::storage::save_station_settings(&tmp_dir, &saved_st);
|
|
|
+ let mut loaded_map2 = std::collections::BTreeMap::new();
|
|
|
+ loaded_map2.insert("S2".to_string(), StationState::new("S2", "Station 2", "", ""));
|
|
|
+ crate::storage::load_station_settings(&tmp_dir, &mut loaded_map2);
|
|
|
+ let loaded_tb2 = &loaded_map2.get("S2").unwrap().task_batch;
|
|
|
+ assert_eq!(loaded_tb2.get_str_or("state", ""), "interrupted");
|
|
|
+ assert_eq!(loaded_tb2.get_str_or("halt_reason", ""), "server_restarted");
|
|
|
+ assert_eq!(loaded_tb2.get_str_or("batch_id", ""), "TB-RUN");
|
|
|
|
|
|
let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
|
}
|
|
|
@@ -2970,6 +3072,13 @@ Reset Type: Warm Reset\r\n\
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.24".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -3120,6 +3229,13 @@ UEFI Interactive Shell v2.2\r\nFS0:\\EFI\\> \r\n\
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.25".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -3323,6 +3439,13 @@ Please press ENTER to start UIP\r\n\
|
|
|
web_password: Some("xjkj123456!".to_string()),
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.27".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -3544,6 +3667,13 @@ Please press ENTER to start UIP\r\n\
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.27".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -3704,6 +3834,13 @@ FS0:\\EFI\\> \r\n",
|
|
|
web_password: Some("xjkj123456!".to_string()),
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.28".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -3919,6 +4056,13 @@ FS0:\\EFI\\> \r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.29".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -4315,6 +4459,13 @@ FS0:\\EFI\\> \r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.30".to_string(),
|
|
|
commit: "unit-test".to_string(),
|
|
|
@@ -4421,14 +4572,14 @@ FS0:\\EFI\\> \r\n",
|
|
|
st_l2.observed_unix_ms = t_r1;
|
|
|
st_l2.hot.last_rx_unix_ms = t_r1;
|
|
|
|
|
|
- // Hang #1 at t_r1 + 6s -> should auto-advance to R2 and queue `smart_restart`!
|
|
|
+ // Hang #1 at t_r1 + 6s -> retries unfinished R1 (`retry_current_task`) and queues `smart_restart`!
|
|
|
assert!(evaluate_stage_watchdog(&mut st_l2, t_r1 + 6_000));
|
|
|
assert_eq!(st_l2.consecutive_hang_count, 1);
|
|
|
assert!(!st_l2.hang_scene_preserved);
|
|
|
step_boot_plan(&mut st_l2, &contract);
|
|
|
step_task_batch(&mut st_l2, &contract, &mut pxe_l2, &tmp_dir, &tmp_dir);
|
|
|
assert_eq!(st_l2.task_batch.get_str_or("state", ""), "running");
|
|
|
- assert_eq!(st_l2.task_batch.get_i64("current_repeat"), Some(2));
|
|
|
+ assert_eq!(st_l2.task_batch.get_i64("current_repeat"), Some(1));
|
|
|
assert_eq!(
|
|
|
st_l2.pending_bmc_power_action.take().as_deref(),
|
|
|
Some("smart_restart"),
|
|
|
@@ -4498,6 +4649,13 @@ FS0:\\EFI\\> \r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.8.1.30".to_string(),
|
|
|
commit: "phase0-test".to_string(),
|
|
|
@@ -4652,6 +4810,13 @@ FS0:\\EFI\\> \r\n",
|
|
|
web_password: Some("xjkj123456!".to_string()),
|
|
|
raw_ring_mb: 4,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(false),
|
|
|
version: "0.9.0.0".to_string(),
|
|
|
commit: "phase1-test".to_string(),
|
|
|
@@ -4853,6 +5018,13 @@ FS0:\\EFI\\> \r\n",
|
|
|
web_password: None,
|
|
|
raw_ring_mb: 2,
|
|
|
clean_ring_mb: 2,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
detail_log_cli: Some(true),
|
|
|
version: "0.9.1.0".to_string(),
|
|
|
commit: "phase2-test".to_string(),
|
|
|
@@ -5070,4 +5242,295 @@ FS0:\\EFI\\> \r\n",
|
|
|
assert_eq!(hw_json.get_bool("available"), Some(true));
|
|
|
assert!(hw_json.get("opencl_igpu").is_some());
|
|
|
}
|
|
|
+
|
|
|
+ #[test]
|
|
|
+ fn test_phase4_pxe_proxy_rmt_hang3_bmc_thermal_trace_and_200_stations() {
|
|
|
+ use std::net::Ipv4Addr;
|
|
|
+
|
|
|
+ let tmp_dir = env::temp_dir().join(format!(
|
|
|
+ "stl-phase4-{}-{}",
|
|
|
+ std::process::id(),
|
|
|
+ now_ms()
|
|
|
+ ));
|
|
|
+ let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
|
+ std::fs::create_dir_all(&tmp_dir).unwrap();
|
|
|
+
|
|
|
+ // 1. JSON parser rejects trailing non-whitespace garbage
|
|
|
+ assert!(parse_json(r#"{"a":1}"#).is_ok());
|
|
|
+ assert!(parse_json(r#"{"a":1} "#).is_ok());
|
|
|
+ assert!(parse_json(r#"{"a":1} garbage"#).is_err());
|
|
|
+
|
|
|
+ // 2. Built-in ProxyDHCP (UDP 67/4011), UEFI HTTP Boot, MAC whitelist & Isolated DHCP pool
|
|
|
+ let trace_dummy = crate::trace::TraceHub::init(
|
|
|
+ &tmp_dir,
|
|
|
+ Some(false),
|
|
|
+ std::sync::Arc::new(crate::actors::PushBroadcaster::new()),
|
|
|
+ );
|
|
|
+ let mut pxe_cfg = crate::pxe_dhcp::PxeDhcpConfig::default_with_ports(8080, 0, 0);
|
|
|
+ pxe_cfg.mode = crate::pxe_dhcp::PxeBootMode::Proxy;
|
|
|
+ pxe_cfg.server_ip = "192.168.2.68".to_string();
|
|
|
+ let pxe_hub = crate::pxe_dhcp::PxeDhcpHub::init(
|
|
|
+ pxe_cfg,
|
|
|
+ tmp_dir.clone(),
|
|
|
+ tmp_dir.join("pxe"),
|
|
|
+ trace_dummy,
|
|
|
+ false,
|
|
|
+ );
|
|
|
+
|
|
|
+ let build_dhcp_req = |msg_type: u8, mac: [u8; 6], vendor: Option<&[u8]>, arch: Option<u16>, ciaddr: Ipv4Addr| -> Vec<u8> {
|
|
|
+ let mut pkt = vec![0u8; 240];
|
|
|
+ pkt[0] = crate::pxe_dhcp::DHCP_OP_BOOTREQUEST;
|
|
|
+ pkt[1] = 1;
|
|
|
+ pkt[2] = 6;
|
|
|
+ pkt[4..8].copy_from_slice(&[0x11, 0x22, 0x33, 0x44]);
|
|
|
+ pkt[10..12].copy_from_slice(&0x8000u16.to_be_bytes());
|
|
|
+ pkt[12..16].copy_from_slice(&ciaddr.octets());
|
|
|
+ pkt[28..34].copy_from_slice(&mac);
|
|
|
+ pkt[236..240].copy_from_slice(&crate::pxe_dhcp::DHCP_MAGIC_COOKIE);
|
|
|
+ pkt.extend_from_slice(&[53, 1, msg_type]);
|
|
|
+ if let Some(v) = vendor {
|
|
|
+ pkt.push(60);
|
|
|
+ pkt.push(v.len() as u8);
|
|
|
+ pkt.extend_from_slice(v);
|
|
|
+ }
|
|
|
+ if let Some(a) = arch {
|
|
|
+ pkt.extend_from_slice(&[93, 2, (a >> 8) as u8, (a & 0xff) as u8]);
|
|
|
+ }
|
|
|
+ pkt.push(255);
|
|
|
+ if pkt.len() < 300 { pkt.resize(300, 0); }
|
|
|
+ pkt
|
|
|
+ };
|
|
|
+
|
|
|
+ let srv_ip = Ipv4Addr::new(192, 168, 2, 68);
|
|
|
+ // 2a. Non-PXE office PC DISCOVER MUST be ignored in proxy mode
|
|
|
+ let office_pkt = build_dhcp_req(crate::pxe_dhcp::DHCP_MSG_DISCOVER, [0xaa, 0xbb, 0xcc, 0x00, 0x00, 0x01], Some(b"MSFT 5.0"), None, Ipv4Addr::UNSPECIFIED);
|
|
|
+ assert!(pxe_hub.process_dhcp_packet(&office_pkt, Ipv4Addr::UNSPECIFIED, 68, srv_ip, false).is_none());
|
|
|
+ assert_eq!(pxe_hub.build_status_json().get_i64("packets_ignored_non_pxe"), Some(1));
|
|
|
+
|
|
|
+ // 2b. UEFI x64 PXEClient DISCOVER on UDP 67 -> Proxy DHCPOFFER (yiaddr=0.0.0.0, siaddr=server_ip, file=118.efi)
|
|
|
+ let pxe_disc = build_dhcp_req(crate::pxe_dhcp::DHCP_MSG_DISCOVER, [0x52, 0x54, 0x00, 0x12, 0x34, 0x56], Some(b"PXEClient:Arch:00007:UNDI:003016"), Some(7), Ipv4Addr::UNSPECIFIED);
|
|
|
+ let offer = pxe_hub.process_dhcp_packet(&pxe_disc, Ipv4Addr::UNSPECIFIED, 68, srv_ip, false).expect("ProxyDHCP must reply OFFER to UEFI PXEClient");
|
|
|
+ let parsed_offer = crate::pxe_dhcp::parse_dhcp_packet(&offer.packet).unwrap();
|
|
|
+ assert_eq!(parsed_offer.msg_type, crate::pxe_dhcp::DHCP_MSG_OFFER);
|
|
|
+ assert_eq!(parsed_offer.yiaddr, Ipv4Addr::UNSPECIFIED, "ProxyDHCP must NEVER assign client IP");
|
|
|
+ assert_eq!(parsed_offer.siaddr, srv_ip);
|
|
|
+ assert_eq!(parsed_offer.file_field, "118.efi");
|
|
|
+
|
|
|
+ // 2c. Proxy UDP 67 REQUEST -> None (router handles IP lease), UDP 4011 REQUEST -> DHCPACK with 118.efi
|
|
|
+ let pxe_req = build_dhcp_req(crate::pxe_dhcp::DHCP_MSG_REQUEST, [0x52, 0x54, 0x00, 0x12, 0x34, 0x56], Some(b"PXEClient:Arch:00007:UNDI:003016"), Some(7), Ipv4Addr::new(192, 168, 2, 180));
|
|
|
+ assert!(pxe_hub.process_dhcp_packet(&pxe_req, Ipv4Addr::new(192, 168, 2, 180), 68, srv_ip, false).is_none());
|
|
|
+ let ack4011 = pxe_hub.process_dhcp_packet(&pxe_req, Ipv4Addr::new(192, 168, 2, 180), 4011, srv_ip, true).expect("ProxyDHCP UDP 4011 must ACK bootfile");
|
|
|
+ let parsed_ack = crate::pxe_dhcp::parse_dhcp_packet(&ack4011.packet).unwrap();
|
|
|
+ assert_eq!(parsed_ack.msg_type, crate::pxe_dhcp::DHCP_MSG_ACK);
|
|
|
+ assert_eq!(parsed_ack.file_field, "118.efi");
|
|
|
+ assert_eq!(pxe_hub.lookup_mac_by_ip("192.168.2.180").as_deref(), Some("52:54:00:12:34:56"));
|
|
|
+
|
|
|
+ // 2d. UEFI HTTP Boot (arch 16 / HTTPClient) -> http://192.168.2.68:8080/pxe/118.efi
|
|
|
+ let http_disc = build_dhcp_req(crate::pxe_dhcp::DHCP_MSG_DISCOVER, [0x52, 0x54, 0x00, 0x12, 0x34, 0x77], Some(b"HTTPClient:Arch:00016:UNDI:003001"), Some(16), Ipv4Addr::UNSPECIFIED);
|
|
|
+ let http_offer = pxe_hub.process_dhcp_packet(&http_disc, Ipv4Addr::UNSPECIFIED, 68, srv_ip, false).expect("HTTPClient must receive UEFI HTTP Boot offer");
|
|
|
+ let parsed_http = crate::pxe_dhcp::parse_dhcp_packet(&http_offer.packet).unwrap();
|
|
|
+ assert_eq!(parsed_http.file_field, "http://192.168.2.68:8080/pxe/118.efi");
|
|
|
+ assert_eq!(parsed_http.vendor_class, "HTTPClient");
|
|
|
+
|
|
|
+ // 2e. MAC whitelist + Isolated DHCP IP assignment
|
|
|
+ let _ = pxe_hub.reconfigure(&parse_json(r#"{"pxe_mode":"isolated","pxe_dhcp_range_start":"10.88.0.100","pxe_dhcp_range_end":"10.88.0.110","pxe_mac_whitelist":["52:54:00:12:34:56"]}"#).unwrap());
|
|
|
+ let blocked_disc = build_dhcp_req(crate::pxe_dhcp::DHCP_MSG_DISCOVER, [0x52, 0x54, 0x00, 0x99, 0x99, 0x99], Some(b"PXEClient:Arch:00007"), Some(7), Ipv4Addr::UNSPECIFIED);
|
|
|
+ assert!(pxe_hub.process_dhcp_packet(&blocked_disc, Ipv4Addr::UNSPECIFIED, 68, Ipv4Addr::new(10, 88, 0, 1), false).is_none());
|
|
|
+ let iso_offer = pxe_hub.process_dhcp_packet(&pxe_disc, Ipv4Addr::UNSPECIFIED, 68, Ipv4Addr::new(10, 88, 0, 1), false).expect("Whitelisted MAC in isolated mode gets IP lease");
|
|
|
+ let parsed_iso = crate::pxe_dhcp::parse_dhcp_packet(&iso_offer.packet).unwrap();
|
|
|
+ assert_eq!(parsed_iso.yiaddr, Ipv4Addr::new(10, 88, 0, 100));
|
|
|
+
|
|
|
+ // 3. RMT stage calibration: `...` never enters RMT; Skipped / Disabled / unrequested Time=0 -> rmt_status="skipped", rmt_complete=false
|
|
|
+ let mut st = StationState::new("S1", "Station 1", "192.168.2.166", "");
|
|
|
+ let t = now_ms();
|
|
|
+ st.observe_serial_chunk(b"[HS_BIOS]Version:108_VD012\r\n[0][Hovsee]Current stage is 1\r\n...\r\n");
|
|
|
+ assert_ne!(st.observed_phase, "rmt", "Progress dots must never jump into RMT phase");
|
|
|
+
|
|
|
+ st.observe_serial_chunk(b"[HS_BIOS][Training][ScktId: 0][48]Rank Margin Tool -- Skipped,Time=0 ms\r\n");
|
|
|
+ assert_eq!(st.rmt_status, "skipped");
|
|
|
+ assert!(!st.hot.rmt_complete);
|
|
|
+ assert!(!st.observed_stages.contains("rmt"));
|
|
|
+
|
|
|
+ // Unrequested RMT (default uip_overrides without rmt enable) + Time=18 ms with 0 rows -> skipped (NOT completed!)
|
|
|
+ let mut st2 = StationState::new("S2", "Station 2", "192.168.2.165", "");
|
|
|
+ st2.observe_serial_chunk(b"[HS_BIOS]Version:108_VD012\r\n[HS_BIOS][Training][ScktId: 0][48]Rank Margin Tool -- SUCCEEDED,Time=18 ms\r\n");
|
|
|
+ assert_eq!(st2.rmt_status, "skipped");
|
|
|
+ assert!(!st2.hot.rmt_complete);
|
|
|
+
|
|
|
+ // Real RMT measurement row -> completed + RX & TX margins populated!
|
|
|
+ st2.uip_overrides.push(parse_json(r#"{"id":"rmt","mode":"override","value":"enable"}"#).unwrap());
|
|
|
+ st2.observe_serial_chunk(b"[HS_BIOS][Training][ScktId: 0][48]Rank Margin Tool\r\nN0.C0.D0.R0 : -14 16 -12 14\r\n[HS_BIOS][Training][ScktId: 0][48]Rank Margin Tool -- SUCCEEDED,Time=4200 ms\r\n");
|
|
|
+ assert_eq!(st2.rmt_status, "completed");
|
|
|
+ assert!(st2.hot.rmt_complete);
|
|
|
+ assert_eq!(st2.rmt_results.values().map(|r| r.measurement_rows).sum::<usize>(), 1);
|
|
|
+ assert_eq!(st2.dimm_soa.rmt_rx_dq_lo[0], -14);
|
|
|
+ assert_eq!(st2.dimm_soa.rmt_tx_dq_hi[0], 14);
|
|
|
+
|
|
|
+ // 4. Full BMC sensors (Temp/Voltage/Fan/Current/Power/Discrete) + DIMM curve fallback (TEMP-2)
|
|
|
+ let s_temp = crate::results::BmcSensorReading { name: "DIMM_A0 Temp".into(), sensor_type: "Temperature".into(), category: "temp".into(), value: Some(58.5), unit: "C".into(), status: "OK".into(), raw_hex: String::new(), updated_ms: t };
|
|
|
+ let s_volt = crate::results::BmcSensorReading { name: "P12V".into(), sensor_type: "Voltage".into(), category: "voltage".into(), value: Some(12.04), unit: "V".into(), status: "OK".into(), raw_hex: String::new(), updated_ms: t };
|
|
|
+ let s_fan = crate::results::BmcSensorReading { name: "FAN1".into(), sensor_type: "Fan".into(), category: "fan".into(), value: Some(5400.0), unit: "RPM".into(), status: "OK".into(), raw_hex: String::new(), updated_ms: t };
|
|
|
+ let s_pwr = crate::results::BmcSensorReading { name: "PSU1_PIN".into(), sensor_type: "Current".into(), category: "power".into(), value: Some(312.0), unit: "W".into(), status: "OK".into(), raw_hex: String::new(), updated_ms: t };
|
|
|
+ let s_disc = crate::results::BmcSensorReading { name: "PSU1 Status".into(), sensor_type: "Power Supply".into(), category: "discrete".into(), value: None, unit: "".into(), status: "Presence detected".into(), raw_hex: "0x01".into(), updated_ms: t };
|
|
|
+ st2.update_bmc_sensors_snapshot(vec![s_temp, s_volt, s_fan, s_pwr, s_disc], t);
|
|
|
+ st2.record_dimm_temp_sample(0, t, 58.5);
|
|
|
+ st2.record_dimm_temp_sample(0, t + 5000, 61.0);
|
|
|
+ assert_eq!(st2.bmc_sensors.len(), 5);
|
|
|
+ assert_eq!(st2.bmc_sensor_history.len(), 1);
|
|
|
+ let fallback_curve = st2.build_dimm_curve_fallback_json(0);
|
|
|
+ assert_eq!(fallback_curve.get_arr("points").unwrap().len(), 2);
|
|
|
+
|
|
|
+ // 5. 3-Mode Hang Recovery (stop / retry_current_task / restart_full_plan) + Thermal CL-3
|
|
|
+ use crate::workflow::{evaluate_stage_watchdog, step_boot_plan, step_task_batch, submit_task_batch};
|
|
|
+ assert_eq!(std::mem::size_of::<crate::trace::StationCoreBinary>(), 320);
|
|
|
+ let contract = FirmwareContract::load(Path::new("contracts/firmware-vd012.json"));
|
|
|
+ let mut st_h = StationState::new("S1", "Station 1", "192.168.2.166", "");
|
|
|
+ let mut pxe_dummy = JsonVal::obj();
|
|
|
+ st_h.bmc_state = "online".to_string();
|
|
|
+ st_h.server_power = "on".to_string();
|
|
|
+ st_h.console_online = true;
|
|
|
+ st_h.diag_state = "online".to_string();
|
|
|
+ st_h.watchdog.dense_stage_silence_timeout_ms = 5_000;
|
|
|
+ st_h.watchdog.hang_action = "retry_current_task".to_string();
|
|
|
+ st_h.watchdog.reboot_on_hang = true;
|
|
|
+ st_h.watchdog.max_consecutive_hangs = 0; // unlimited!
|
|
|
+ let batch_args = parse_json(r#"{"stop_on_fail":false,"hang_action":"retry_current_task","max_consecutive_hangs":0,"auto_start":true,"profiles":[{"name":"P1","repeat":1,"run_amt":false,"run_mt":false,"thermal_auto_enabled":false},{"name":"P2","repeat":2,"run_amt":false,"run_mt":false,"thermal_auto_enabled":false}]}"#).unwrap();
|
|
|
+ let _ = submit_task_batch(
|
|
|
+ &mut st_h,
|
|
|
+ &batch_args,
|
|
|
+ &contract,
|
|
|
+ &mut pxe_dummy,
|
|
|
+ &tmp_dir,
|
|
|
+ &tmp_dir,
|
|
|
+ ).unwrap();
|
|
|
+ // Complete P1 Round 1 -> advances to P2 Round 1
|
|
|
+ st_h.power_seq_in_progress = false;
|
|
|
+ st_h.observe_serial_chunk(b"[HS_BIOS]Version:108_VD012\r\nUEFI Interactive Shell v2.2\r\nFS0:\\EFI\\> ");
|
|
|
+ step_boot_plan(&mut st_h, &contract);
|
|
|
+ step_task_batch(&mut st_h, &contract, &mut pxe_dummy, &tmp_dir, &tmp_dir);
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_profile_index"), Some(1));
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_repeat"), Some(1));
|
|
|
+ // Complete P2 Round 1 -> advances to P2 Round 2
|
|
|
+ st_h.power_seq_in_progress = false;
|
|
|
+ st_h.observe_serial_chunk(b"[HS_BIOS]Version:108_VD012\r\nUEFI Interactive Shell v2.2\r\nFS0:\\EFI\\> ");
|
|
|
+ step_boot_plan(&mut st_h, &contract);
|
|
|
+ step_task_batch(&mut st_h, &contract, &mut pxe_dummy, &tmp_dir, &tmp_dir);
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_profile_index"), Some(1));
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_repeat"), Some(2));
|
|
|
+ // Trigger hang silence on P2 Round 2 -> retry_current_task MUST keep (1, 2) and request reboot!
|
|
|
+ st_h.power_seq_in_progress = false;
|
|
|
+ st_h.observe_serial_chunk(b"[HS_BIOS]Version:108_VD012\r\n[HS_BIOS][Training][ScktId: 0][10]Wait\r\n");
|
|
|
+ let hang_ts = st_h.last_activity_anchor_ms() + 10_000;
|
|
|
+ assert!(evaluate_stage_watchdog(&mut st_h, hang_ts));
|
|
|
+ step_task_batch(&mut st_h, &contract, &mut pxe_dummy, &tmp_dir, &tmp_dir);
|
|
|
+ assert_eq!(st_h.task_batch.get_str_or("state", ""), "running", "retry_current_task must keep batch running");
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_profile_index"), Some(1), "retry_current_task must stay on Profile 2");
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_repeat"), Some(2), "retry_current_task must redo unfinished Round 2");
|
|
|
+
|
|
|
+ // Switch to restart_full_plan -> hang resets to Profile 1 Round 1!
|
|
|
+ st_h.watchdog.hang_action = "restart_full_plan".to_string();
|
|
|
+ st_h.task_batch.set("hang_action", JsonVal::Str("restart_full_plan".to_string()));
|
|
|
+ st_h.power_seq_in_progress = false;
|
|
|
+ st_h.observe_serial_chunk(b"[HS_BIOS]Version:108_VD012\r\n[HS_BIOS][Training][ScktId: 0][11]Wait\r\n");
|
|
|
+ let hang_ts2 = st_h.last_activity_anchor_ms() + 10_000;
|
|
|
+ assert!(evaluate_stage_watchdog(&mut st_h, hang_ts2));
|
|
|
+ step_task_batch(&mut st_h, &contract, &mut pxe_dummy, &tmp_dir, &tmp_dir);
|
|
|
+ assert_eq!(st_h.task_batch.get_str_or("state", ""), "running");
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_profile_index"), Some(0), "restart_full_plan must reset to Profile 1");
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("current_repeat"), Some(1), "restart_full_plan must reset to Round 1");
|
|
|
+ assert_eq!(st_h.task_batch.get_i64("total_runs_completed"), Some(0));
|
|
|
+
|
|
|
+ // 5c. CL-3: ControlTaskBatch("stop") triggers cooling purge on online hood
|
|
|
+ let args = ServerArgs {
|
|
|
+ config_path: tmp_dir.join("missing.json"),
|
|
|
+ data_dir: tmp_dir.clone(),
|
|
|
+ web_listen: "127.0.0.1:0".to_string(),
|
|
|
+ tftp_listen: "disabled".to_string(),
|
|
|
+ web_dir: std::path::PathBuf::from("web"),
|
|
|
+ contracts_path: std::path::PathBuf::from("contracts/firmware-vd012.json"),
|
|
|
+ web_password: Some("xjkj123456!".to_string()),
|
|
|
+ raw_ring_mb: 2,
|
|
|
+ clean_ring_mb: 1,
|
|
|
+ raw_ring_explicit: true,
|
|
|
+ clean_ring_explicit: true,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 20,
|
|
|
+ detail_log_cli: Some(true),
|
|
|
+ version: "0.9.5-preview.1".to_string(),
|
|
|
+ commit: "phase4-test".to_string(),
|
|
|
+ };
|
|
|
+ let hub = AppHub::init_for_test(&args);
|
|
|
+ let _ = hub.dispatch_rpc("ThermalAction", &parse_json(r#"{"station_id":"S2","action":"connect","mode":"mock"}"#).unwrap()).unwrap();
|
|
|
+ std::thread::sleep(Duration::from_millis(80));
|
|
|
+ let _ = hub.dispatch_rpc("ThermalAction", &parse_json(r#"{"station_id":"S2","action":"set_temp","target_c":75}"#).unwrap()).unwrap();
|
|
|
+ std::thread::sleep(Duration::from_millis(80));
|
|
|
+ let _ = hub.dispatch_rpc("EnqueueCommand", &parse_json(r#"{"command_id":"p4-cl3","station_id":"S2","method":"ControlTaskBatch","arguments":{"action":"stop"}}"#).unwrap()).unwrap();
|
|
|
+ std::thread::sleep(Duration::from_millis(120));
|
|
|
+ assert_eq!(hub.thermal_hub.get_live_summary("S2").unwrap().mcu_mode, "cooling_purge", "CL-3: ControlTaskBatch stop must cool hood");
|
|
|
+
|
|
|
+ // 6. 200-station scale test: Sharded Reactor Pool boots 200 stations on <= 8 shards + <= 8 IPMI workers with auto-scaled rings!
|
|
|
+ let tmp_200 = env::temp_dir().join(format!("stl-scale200-{}-{}", std::process::id(), now_ms()));
|
|
|
+ let _ = std::fs::remove_dir_all(&tmp_200);
|
|
|
+ std::fs::create_dir_all(&tmp_200).unwrap();
|
|
|
+ let mut cfg_stations = Vec::with_capacity(200);
|
|
|
+ for i in 1..=200 {
|
|
|
+ let mut s = JsonVal::obj();
|
|
|
+ s.set("station_id", JsonVal::Str(format!("S{:03}", i)));
|
|
|
+ s.set("name", JsonVal::Str(format!("Station {:03}", i)));
|
|
|
+ s.set("bmc_host", JsonVal::Str(format!("10.200.{}.{}", i / 250, (i % 250) + 1)));
|
|
|
+ s.set("console_enabled", JsonVal::Bool(false));
|
|
|
+ s.set("bmc_enabled", JsonVal::Bool(false));
|
|
|
+ cfg_stations.push(s);
|
|
|
+ }
|
|
|
+ let mut cfg_root = JsonVal::obj();
|
|
|
+ cfg_root.set("stations", JsonVal::Arr(cfg_stations));
|
|
|
+ let cfg_200_path = tmp_200.join("stations200.json");
|
|
|
+ std::fs::write(&cfg_200_path, cfg_root.to_json()).unwrap();
|
|
|
+
|
|
|
+ let args_200 = ServerArgs {
|
|
|
+ config_path: cfg_200_path,
|
|
|
+ data_dir: tmp_200.clone(),
|
|
|
+ web_listen: "127.0.0.1:0".to_string(),
|
|
|
+ tftp_listen: "disabled".to_string(),
|
|
|
+ web_dir: std::path::PathBuf::from("web"),
|
|
|
+ contracts_path: std::path::PathBuf::from("contracts/firmware-vd012.json"),
|
|
|
+ web_password: None,
|
|
|
+ raw_ring_mb: 16,
|
|
|
+ clean_ring_mb: 8,
|
|
|
+ raw_ring_explicit: false,
|
|
|
+ clean_ring_explicit: false,
|
|
|
+ pxe_mode: "disabled".to_string(),
|
|
|
+ pxe_iface: String::new(),
|
|
|
+ pxe_dhcp_port: 0,
|
|
|
+ pxe_proxy_port: 0,
|
|
|
+ batch_window_ms: 100,
|
|
|
+ detail_log_cli: Some(false),
|
|
|
+ version: "0.9.5-preview.1".to_string(),
|
|
|
+ commit: "scale200".to_string(),
|
|
|
+ };
|
|
|
+ let hub_200 = AppHub::init_for_test(&args_200);
|
|
|
+ let list_200 = hub_200.dispatch_rpc("ListStations", &JsonVal::obj()).unwrap();
|
|
|
+ assert_eq!(list_200.get_arr("stations").unwrap().len(), 200);
|
|
|
+ assert!(hub_200.reactor_pool.shard_count() <= 8, "200 stations must share <= 8 reactor shards");
|
|
|
+ assert!(hub_200.reactor_pool.ipmi_worker_count() <= 8, "200 stations must share <= 8 IPMI workers");
|
|
|
+
|
|
|
+ // Batch SIMD 64B diff masks over 200 structs
|
|
|
+ let prev_buf = vec![0x11u8; 200 * 320];
|
|
|
+ let mut cur_buf = prev_buf.clone();
|
|
|
+ cur_buf[0] ^= 0xFF;
|
|
|
+ cur_buf[199 * 320 + 64 * 4 + 3] ^= 0x01;
|
|
|
+ let mut out_masks = vec![0u64; 200];
|
|
|
+ unsafe {
|
|
|
+ lib::stl_batch_mem_diff_64b_masks(prev_buf.as_ptr(), cur_buf.as_ptr(), 320, 320, 200, out_masks.as_mut_ptr());
|
|
|
+ }
|
|
|
+ assert_eq!(out_masks[0], 1);
|
|
|
+ assert_eq!(out_masks[1], 0);
|
|
|
+ assert_eq!(out_masks[199], 1u64 << 4);
|
|
|
+
|
|
|
+ let _ = std::fs::remove_dir_all(&tmp_dir);
|
|
|
+ let _ = std::fs::remove_dir_all(&tmp_200);
|
|
|
+ }
|
|
|
}
|