Skip to content

Commit

Permalink
Don't ignore Getrlimit error in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dan Brown committed Sep 23, 2013
1 parent c703dce commit 85f6018
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions ini_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,14 +90,14 @@ func TestDefinedSectionBehaviour(t *testing.T) {
}

func TestLoadFile(t *testing.T) {
originalOpenFiles := numFilesOpen()
originalOpenFiles := numFilesOpen(t)

file, err := LoadFile("test.ini")
if err != nil {
t.Fatal(err)
}

if originalOpenFiles != numFilesOpen() {
if originalOpenFiles != numFilesOpen(t) {
t.Error("test.ini not closed")
}

Expand All @@ -106,9 +106,12 @@ func TestLoadFile(t *testing.T) {
}
}

func numFilesOpen() (num uint64) {
func numFilesOpen(t *testing.T) (num uint64) {
var rlimit syscall.Rlimit
syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
if err != nil {
t.Fatal(err)
}
maxFds := int(rlimit.Cur)

var stat syscall.Stat_t
Expand Down

0 comments on commit 85f6018

Please sign in to comment.