Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(168)

Side by Side Diff: src/pkg/syscall/rlimit_linux_test.go

Issue 11803043: code review 11803043: syscall: prlimit argument error for Getrlimit and Setrl...
Patch Set: diff -r 40bbcafc819c https://go.googlecode.com/hg/ Created 12 years, 5 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/pkg/syscall/syscall_linux_386.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package syscall_test
6
7 import (
8 "syscall"
9 "testing"
10 )
11
12 func TestRlimit(t *testing.T) {
13 var rlimit, zero syscall.Rlimit
14 err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
15 if err != nil {
16 t.Fatalf("Getrlimit: save failed: %v", err)
17 }
18 if zero == rlimit {
19 t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
20 return
mikio 2013/07/25 09:59:18 you can drop return just after t.Fatalf
peterGo 2013/07/25 11:42:29 Done.
21 }
22 set := rlimit
23 set.Cur = set.Max - 1
24 err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &set)
25 if err != nil {
26 t.Fatalf("Setrlimit: set failed: %#v %v", set, err)
27 }
28 var get syscall.Rlimit
29 err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &get)
30 if err != nil {
31 t.Fatalf("Getrlimit: get failed: %v", err)
32 }
33 set = rlimit
34 set.Cur = set.Max - 1
35 if set != get {
36 t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
37 return
mikio 2013/07/25 09:59:18 ditto
peterGo 2013/07/25 11:42:29 Done.
38 }
39 err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit)
40 if err != nil {
41 t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
42 }
43 }
OLDNEW
« no previous file with comments | « no previous file | src/pkg/syscall/syscall_linux_386.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b