~ubuntu-branches/ubuntu/trusty/ruby1.9/trusty

« back to all changes in this revision

Viewing changes to test/ruby/test_process.rb

  • Committer: Bazaar Package Importer
  • Author(s): Stephan Hermann
  • Date: 2008-05-16 12:37:06 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20080516123706-r4llcdfd35aobrjv
Tags: 1.9.0.1-1ubuntu1
* Merge from debian unstable, remaining changes:
  - Robustify check for target_os, fixing build failure on lpia.
* debian/control:
  - ruby1.9 pkg: moved rdoc1.9 suggestion to depends. (LP: #228345)

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
    Process.wait pid
39
39
    assert_equal(0, $?.to_i, "#{$?}")
40
40
  end
 
41
 
 
42
  def test_rlimit_name
 
43
    return unless rlimit_exist?
 
44
    [
 
45
      :AS, "AS",
 
46
      :CORE, "CORE",
 
47
      :CPU, "CPU",
 
48
      :DATA, "DATA",
 
49
      :FSIZE, "FSIZE",
 
50
      :MEMLOCK, "MEMLOCK",
 
51
      :NOFILE, "NOFILE",
 
52
      :NPROC, "NPROC",
 
53
      :RSS, "RSS",
 
54
      :STACK, "STACK",
 
55
      :SBSIZE, "SBSIZE",
 
56
    ].each {|name|
 
57
      if Process.const_defined? "RLIMIT_#{name}"
 
58
        assert_nothing_raised { Process.getrlimit(name) }
 
59
      else
 
60
        assert_raise(ArgumentError) { Process.getrlimit(name) }
 
61
      end
 
62
    }
 
63
    assert_raise(ArgumentError) { Process.getrlimit(:FOO) }
 
64
    assert_raise(ArgumentError) { Process.getrlimit("FOO") }
 
65
  end
 
66
 
 
67
  def test_rlimit_value
 
68
    return unless rlimit_exist?
 
69
    assert_raise(ArgumentError) { Process.setrlimit(:CORE, :FOO) }
 
70
    assert_raise(Errno::EPERM) { Process.setrlimit(:NOFILE, :INFINITY) }
 
71
    assert_raise(Errno::EPERM) { Process.setrlimit(:NOFILE, "INFINITY") }
 
72
  end
41
73
end