summaryrefslogtreecommitdiffhomepage
path: root/util/sysresources/sysresources_test.go
blob: 331ad913bfba12181f6db8b9936adbc40e971598 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// Copyright (c) Tailscale Inc & AUTHORS
// SPDX-License-Identifier: BSD-3-Clause

package sysresources

import (
	"runtime"
	"testing"
)

func TestTotalMemory(t *testing.T) {
	switch runtime.GOOS {
	case "linux":
	case "freebsd", "openbsd", "dragonfly", "netbsd":
	case "darwin":
	default:
		t.Skipf("not supported on runtime.GOOS=%q yet", runtime.GOOS)
	}

	mem := TotalMemory()
	if mem == 0 {
		t.Fatal("wanted TotalMemory > 0")
	}
	t.Logf("total memory: %v bytes", mem)
}