Skip to content

Commit

Permalink
unix: simplify solaris TestEventPortMemoryStress
Browse files Browse the repository at this point in the history
  • Loading branch information
nshalman committed Aug 7, 2022
1 parent be53fad commit ba20b56
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions unix/syscall_solaris_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,19 +350,18 @@ func TestEventPortMemoryStress(t *testing.T) {
t.Fatalf("NewEventPort failed: %v", err)
}
defer port.Close()
cookie := stat.Mode()


err = port.AssociatePath(path, stat, unix.FILE_MODIFIED, cookie)
if err != nil {
t.Errorf("AssociatePath failed: %v", err)
}
if !port.PathIsWatched(path) {
t.Errorf("PathIsWatched unexpectedly returned false")
}

iterations := 100000
for i := 0; i < iterations; i++ {
cookie := fmt.Sprintf("cookie %d", i)
err = port.AssociatePath(path, stat, unix.FILE_MODIFIED, cookie)
if err != nil {
t.Errorf("AssociatePath failed: %v", err)
}
if !port.PathIsWatched(path) {
t.Errorf("PathIsWatched unexpectedly returned false")
}
file, err := os.Create(filepath.Join(path, fmt.Sprintf("%d", i)))
if err != nil {
t.Fatalf("unable to create files in %s: %v", path, err)
Expand All @@ -377,10 +376,5 @@ func TestEventPortMemoryStress(t *testing.T) {
if err != nil {
t.Errorf("GetOne failed: %v", err)
}

err = port.AssociatePath(path, stat, unix.FILE_MODIFIED, cookie)
if err != nil {
t.Errorf("AssociatePath failed: %v", err)
}
}
}

0 comments on commit ba20b56

Please sign in to comment.