Upgrade dashboard, builder, and agent resource controls.

Dark UI with hashrate graphs, inline setting help, percent-based threads/RAM, configurable process name and display modes, and LAN-aware run.bat startup banner.
This commit is contained in:
drjones
2026-05-26 23:26:39 -07:00
parent 6241dfd556
commit f7d6dcf542
24 changed files with 960 additions and 191 deletions

View File

@@ -0,0 +1,45 @@
package config
import "testing"
func TestEffectiveThreadsFixed(t *testing.T) {
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ThreadMode: "fixed", Threads: 3}}
if got := cfg.EffectiveThreads(); got != 3 {
t.Fatalf("expected 3, got %d", got)
}
}
func TestEffectiveThreadsPercentCaps(t *testing.T) {
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ThreadMode: "percent", ThreadPercent: 150}}
got := cfg.EffectiveThreads()
if got < 1 {
t.Fatalf("expected at least 1 thread, got %d", got)
}
}
func TestEffectiveThreadsPercentZeroUsesMinimum(t *testing.T) {
cfg := RuntimeConfig{BuiltinConfig: BuiltinConfig{ThreadMode: "percent", ThreadPercent: 0}}
if got := cfg.EffectiveThreads(); got < 1 {
t.Fatalf("expected minimum 1 thread, got %d", got)
}
}
func TestHideWindowModes(t *testing.T) {
silent := RuntimeConfig{BuiltinConfig: BuiltinConfig{DisplayMode: "silent"}}
if !silent.HideWindow() {
t.Fatal("silent should hide window")
}
visible := RuntimeConfig{BuiltinConfig: BuiltinConfig{DisplayMode: "visible"}}
if visible.HideWindow() {
t.Fatal("visible should not hide window")
}
}
func TestSanitizeProcessName(t *testing.T) {
if got := sanitizeProcessName("office pc 1"); got != "officepc1" {
t.Fatalf("unexpected process name: %s", got)
}
if got := sanitizeProcessName(""); got != "CryptoMinerWorker" {
t.Fatalf("expected default process name, got %s", got)
}
}