| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 | 6 |
| 7 __author__ = 'kdlucas@chromium.org (Kelly Lucas)' | 7 __author__ = 'kdlucas@chromium.org (Kelly Lucas)' |
| 8 | 8 |
| 9 import logging | 9 import logging |
| 10 import os | 10 import os |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 'max_threads': 10000, | 73 'max_threads': 10000, |
| 74 'msg_max': 10, | 74 'msg_max': 10, |
| 75 'msgsize': 8192, | 75 'msgsize': 8192, |
| 76 'msg_queue': 256, | 76 'msg_queue': 256, |
| 77 'ngroups_max': 65536, | 77 'ngroups_max': 65536, |
| 78 'nr_open': 1048576, | 78 'nr_open': 1048576, |
| 79 'pid_max': 32768, | 79 'pid_max': 32768, |
| 80 } | 80 } |
| 81 | 81 |
| 82 ref_equal = {'leases': 1, | 82 ref_equal = {'leases': 1, |
| 83 'panic': 0, | 83 'panic': -1, |
| 84 'sysrq': 1, | 84 'sysrq': 1, |
| 85 'suid-dump': 0, | 85 'suid-dump': 0, |
| 86 } | 86 } |
| 87 | 87 |
| 88 refpath = {'file_max': '/proc/sys/fs/file-max', | 88 refpath = {'file_max': '/proc/sys/fs/file-max', |
| 89 'leases': '/proc/sys/fs/leases-enable', | 89 'leases': '/proc/sys/fs/leases-enable', |
| 90 'max_open': '/proc/self/limits', | 90 'max_open': '/proc/self/limits', |
| 91 'max_procs': '/proc/self/limits', | 91 'max_procs': '/proc/self/limits', |
| 92 'max_threads': '/proc/sys/kernel/threads-max', | 92 'max_threads': '/proc/sys/kernel/threads-max', |
| 93 'msg_max': '/proc/sys/fs/mqueue/msg_max', | 93 'msg_max': '/proc/sys/fs/mqueue/msg_max', |
| (...skipping 23 matching lines...) Expand all Loading... |
| 117 for key in ref_equal: | 117 for key in ref_equal: |
| 118 osvalue[key] = self.get_limit(key, refpath[key]) | 118 osvalue[key] = self.get_limit(key, refpath[key]) |
| 119 if osvalue[key] != ref_equal[key]: | 119 if osvalue[key] != ref_equal[key]: |
| 120 logging.warn('%s is set to %d' % (refpath[key], osvalue[key])) | 120 logging.warn('%s is set to %d' % (refpath[key], osvalue[key])) |
| 121 logging.warn('Expected %d' % ref_equal[key]) | 121 logging.warn('Expected %d' % ref_equal[key]) |
| 122 errors += 1 | 122 errors += 1 |
| 123 | 123 |
| 124 # If self.error is not zero, there were errors. | 124 # If self.error is not zero, there were errors. |
| 125 if errors > 0: | 125 if errors > 0: |
| 126 raise error.TestFail('Found %d incorrect values' % errors) | 126 raise error.TestFail('Found %d incorrect values' % errors) |
| OLD | NEW |