diff options
Diffstat (limited to 'integrationtests')
| -rw-r--r-- | integrationtests/mmap_test.go | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/integrationtests/mmap_test.go b/integrationtests/mmap_test.go index 3ef84c5..9d1b3ad 100644 --- a/integrationtests/mmap_test.go +++ b/integrationtests/mmap_test.go @@ -2,6 +2,13 @@ package integrationtests import "testing" +const ( + mmapParquetDuration = 6 + mmapWorkloadStartupEnv = "IOR_WORKLOAD_STARTUP_DELAY_MS=1000" + mmapScenarioAddressSpaceBytes = 8192 + mmapMinAddressSpaceBytesTotal = mmapScenarioAddressSpaceBytes * 2 +) + func TestMmapBasic(t *testing.T) { runScenario(t, "mmap-basic", []ExpectedEvent{ { @@ -68,3 +75,50 @@ func TestMmapMremapMunmap(t *testing.T) { Comm: "ioworkload", }, 0) } + +func TestMmapMremapMunmapAddressSpaceBytesInParquet(t *testing.T) { + h := newTestHarness(t) + h.WorkloadEnv = []string{mmapWorkloadStartupEnv} + path, pid, err := h.RunParquet("mmap-mremap-munmap", mmapParquetDuration) + if err != nil { + t.Fatalf("run mmap-mremap-munmap parquet scenario: %v", err) + } + + rows := filterRecordsByPID(readParquetRecords(t, path), uint32(pid)) + if len(rows) == 0 { + t.Fatalf("expected parquet rows for workload PID %d", pid) + } + + var foundMremap, foundMunmap bool + var addressSpaceTotal uint64 + for _, row := range rows { + switch row.Syscall { + case "mremap": + if row.Bytes != 0 { + t.Fatalf("mremap bytes = %d, want 0 (I/O bytes must stay separate)", row.Bytes) + } + if row.AddressSpaceBytes == mmapScenarioAddressSpaceBytes { + foundMremap = true + } + addressSpaceTotal += row.AddressSpaceBytes + case "munmap": + if row.Bytes != 0 { + t.Fatalf("munmap bytes = %d, want 0 (I/O bytes must stay separate)", row.Bytes) + } + if row.AddressSpaceBytes == mmapScenarioAddressSpaceBytes { + foundMunmap = true + } + addressSpaceTotal += row.AddressSpaceBytes + } + } + + if !foundMremap { + t.Fatalf("expected mremap row with AddressSpaceBytes=%d", mmapScenarioAddressSpaceBytes) + } + if !foundMunmap { + t.Fatalf("expected munmap row with AddressSpaceBytes=%d", mmapScenarioAddressSpaceBytes) + } + if addressSpaceTotal < mmapMinAddressSpaceBytesTotal { + t.Fatalf("mremap+munmap AddressSpaceBytes total = %d, want >= %d", addressSpaceTotal, mmapMinAddressSpaceBytesTotal) + } +} |
