Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 1 | package main |
| 2 | |
| 3 | import ( |
Adrian Villin | 7d1e4a4 | 2024-06-13 08:59:58 +0200 | [diff] [blame] | 4 | "fmt" |
| 5 | "os" |
Adrian Villin | 681ff3a | 2024-06-07 06:45:48 -0400 | [diff] [blame] | 6 | "path/filepath" |
| 7 | "runtime" |
Adrian Villin | 5d171eb | 2024-06-17 08:51:27 +0200 | [diff] [blame] | 8 | "strings" |
Filip Tehlar | bb98aac | 2022-12-21 14:40:35 +0100 | [diff] [blame] | 9 | "testing" |
Adrian Villin | 93974e2 | 2024-05-30 06:10:59 -0400 | [diff] [blame] | 10 | "time" |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 11 | |
Adrian Villin | 4677d92 | 2024-06-14 09:32:39 +0200 | [diff] [blame] | 12 | . "fd.io/hs-test/infra" |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 13 | . "github.com/onsi/ginkgo/v2" |
| 14 | . "github.com/onsi/gomega" |
Filip Tehlar | 229f5fc | 2022-08-09 14:44:47 +0000 | [diff] [blame] | 15 | ) |
| 16 | |
Adrian Villin | 681ff3a | 2024-06-07 06:45:48 -0400 | [diff] [blame] | 17 | func getTestFilename() string { |
| 18 | _, filename, _, _ := runtime.Caller(2) |
| 19 | return filepath.Base(filename) |
| 20 | } |
| 21 | |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 22 | func TestHst(t *testing.T) { |
Adrian Villin | 4677d92 | 2024-06-14 09:32:39 +0200 | [diff] [blame] | 23 | if *IsVppDebug { |
Adrian Villin | 93974e2 | 2024-05-30 06:10:59 -0400 | [diff] [blame] | 24 | // 30 minute timeout so that the framework won't timeout while debugging |
Adrian Villin | 4677d92 | 2024-06-14 09:32:39 +0200 | [diff] [blame] | 25 | SuiteTimeout = time.Minute * 30 |
Adrian Villin | 93974e2 | 2024-05-30 06:10:59 -0400 | [diff] [blame] | 26 | } else { |
Adrian Villin | 4677d92 | 2024-06-14 09:32:39 +0200 | [diff] [blame] | 27 | SuiteTimeout = time.Minute * 5 |
Adrian Villin | 93974e2 | 2024-05-30 06:10:59 -0400 | [diff] [blame] | 28 | } |
Adrian Villin | 7d1e4a4 | 2024-06-13 08:59:58 +0200 | [diff] [blame] | 29 | |
Adrian Villin | 5d171eb | 2024-06-17 08:51:27 +0200 | [diff] [blame] | 30 | output, err := os.ReadFile("/sys/devices/system/node/online") |
| 31 | fmt.Println(string(output)) |
| 32 | if err == nil && strings.Contains(string(output), "-") { |
| 33 | NumaAwareCpuAlloc = true |
| 34 | } |
Adrian Villin | 7d1e4a4 | 2024-06-13 08:59:58 +0200 | [diff] [blame] | 35 | // creates a file with PPID, used for 'make cleanup-hst' |
| 36 | ppid := fmt.Sprint(os.Getppid()) |
| 37 | ppid = ppid[:len(ppid)-1] |
| 38 | f, _ := os.Create(".last_hst_ppid") |
| 39 | f.Write([]byte(ppid)) |
| 40 | f.Close() |
| 41 | |
Adrian Villin | cee15aa | 2024-03-14 11:42:55 -0400 | [diff] [blame] | 42 | RegisterFailHandler(Fail) |
| 43 | RunSpecs(t, "HST") |
Maros Ondrejicka | c2f76f4 | 2023-02-27 13:22:45 +0100 | [diff] [blame] | 44 | } |