(t *testing.T)
| 61 | } |
| 62 | |
| 63 | func TestReadCPUFile(t *testing.T) { |
| 64 | s := newTestSystem(t, "" /*pciTestDir*/) |
| 65 | defer s.Destroy() |
| 66 | k := kernel.KernelFromContext(s.Ctx) |
| 67 | maxCPUCores := k.ApplicationCores() |
| 68 | |
| 69 | expected := fmt.Sprintf("0-%d\n", maxCPUCores-1) |
| 70 | |
| 71 | for _, fname := range []string{"online", "possible", "present"} { |
| 72 | pop := s.PathOpAtRoot(fmt.Sprintf("devices/system/cpu/%s", fname)) |
| 73 | fd, err := s.VFS.OpenAt(s.Ctx, s.Creds, pop, &vfs.OpenOptions{}) |
| 74 | if err != nil { |
| 75 | t.Fatalf("OpenAt(pop:%+v) = %+v failed: %v", pop, fd, err) |
| 76 | } |
| 77 | defer fd.DecRef(s.Ctx) |
| 78 | content, err := s.ReadToEnd(fd) |
| 79 | if err != nil { |
| 80 | t.Fatalf("Read failed: %v", err) |
| 81 | } |
| 82 | if diff := cmp.Diff(expected, content); diff != "" { |
| 83 | t.Fatalf("Read returned unexpected data:\n--- want\n+++ got\n%v", diff) |
| 84 | } |
| 85 | } |
| 86 | } |
| 87 | |
| 88 | func TestSysRootContainsExpectedEntries(t *testing.T) { |
| 89 | s := newTestSystem(t, "" /*pciTestDir*/) |
nothing calls this directly
no test coverage detected
searching dependent graphs…