Improve portable launch, forge persistence, and operator auth UX.
Persist build extra_files for Build Manager history, print dashboard login on every start, add libp2p for Mesh P2P forge, defer WebSocket until login, and split devrun.bat from LAUNCH.bat with USB deck auto-detection.
This commit is contained in:
@@ -2,7 +2,10 @@
|
||||
|
||||
package stats
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestParseKB(t *testing.T) {
|
||||
if got := parseKB("MemTotal: 16384000 kB"); got != 16384000 {
|
||||
@@ -11,4 +14,30 @@ func TestParseKB(t *testing.T) {
|
||||
if parseKB("short") != 0 {
|
||||
t.Fatal("invalid line should return 0")
|
||||
}
|
||||
if parseKB("MemAvailable: 0 kB") != 0 {
|
||||
t.Fatal("zero kB should parse as 0")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseMeminfo(t *testing.T) {
|
||||
content := strings.Join([]string{
|
||||
"MemTotal: 16384000 kB",
|
||||
"MemFree: 8192000 kB",
|
||||
"MemAvailable: 4096000 kB",
|
||||
}, "\n")
|
||||
total, avail := parseMeminfo(strings.NewReader(content))
|
||||
if total != 16384000*1024 {
|
||||
t.Fatalf("total %d", total)
|
||||
}
|
||||
if avail != 4096000*1024 {
|
||||
t.Fatalf("avail %d", avail)
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseMeminfoMissingTotal(t *testing.T) {
|
||||
content := "MemAvailable: 4096000 kB\n"
|
||||
total, avail := parseMeminfo(strings.NewReader(content))
|
||||
if total != 0 || avail != 0 {
|
||||
t.Fatalf("missing MemTotal: total=%d avail=%d", total, avail)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user