summaryrefslogtreecommitdiff
path: root/integrationtests
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-05-20 07:41:04 +0300
committerPaul Buetow <paul@buetow.org>2026-05-20 07:41:04 +0300
commit5fd613562e2aa2ab3aac3349f44db88330046c1c (patch)
treedfb391de44b309d391031b7744bc48f3ea7c8d7d /integrationtests
parentdf1225efe494cc81513cf98e93891376e45f9615 (diff)
task 07: assert mmap address-space accounting end-to-end
Diffstat (limited to 'integrationtests')
-rw-r--r--integrationtests/mmap_test.go54
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)
+ }
+}