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

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

Issue 11803043: code review 11803043: syscall: prlimit argument error for Getrlimit and Setrl...
Patch Set: diff -r 3ffbc06b4874 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 // +build linux
6 // +build 386 arm
iant 2013/07/25 04:21:42 Why not run the test on every linux platform? If
peterGo 2013/07/25 06:50:28 Done.
7
8 package syscall_test
9
10 import (
11 "syscall"
12 "testing"
13 )
14
15 func TestRlimit(t *testing.T) {
16 var rlimit, zeroRlimit syscall.Rlimit
iant 2013/07/25 04:21:42 s/zeroRlimit/zero/
peterGo 2013/07/25 06:50:28 Done.
17 err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit)
18 if err != nil {
19 t.Fatalf("Getrlimit: save failed: %v", err)
20 }
21 if zeroRlimit == rlimit {
22 t.Fatalf("Getrlimit: save failed: got zero value %#v", rlimit)
23 return
24 }
25 setRlimit := rlimit
iant 2013/07/25 04:21:42 s/setRlimit/set/
peterGo 2013/07/25 06:50:28 Done.
26 setRlimit.Cur = setRlimit.Max - 1
27 err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &setRlimit)
28 if err != nil {
29 t.Fatalf("Setrlimit: set failed: %#v %v", setRlimit, err)
30 }
31 var getRlimit syscall.Rlimit
iant 2013/07/25 04:21:42 s/getRlimit/get/
peterGo 2013/07/25 06:50:28 Done.
32 err = syscall.Getrlimit(syscall.RLIMIT_NOFILE, &getRlimit)
33 if err != nil {
34 t.Fatalf("Getrlimit: get failed: %v", err)
35 }
36 setRlimit = rlimit
37 setRlimit.Cur = setRlimit.Max - 1
38 if setRlimit != getRlimit {
39 t.Fatalf("Rlimit: change failed: wanted %#v got %#v", setRlimit, getRlimit)
40 return
41 }
42 err = syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit)
43 if err != nil {
44 t.Fatalf("Setrlimit: restore failed: %#v %v", rlimit, err)
45 }
46 }
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