From 7a4615e4477518efdd6c0e67fa387121685018ce Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Tue, 24 Mar 2015 16:49:51 -0700 Subject: check: Warn users with nonzero RLIMIT_CORE --- src/etc/check-sanitycheck.py | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/etc/check-sanitycheck.py (limited to 'src') diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py new file mode 100644 index 00000000000..1ac1c3fefb5 --- /dev/null +++ b/src/etc/check-sanitycheck.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python +import os +import sys +import functools +import resource + +STATUS = 0 + + +def error_unless_permitted(env_var, message): + global STATUS + if not os.getenv(env_var): + sys.stderr.write(message) + STATUS = 1 + + +def only_on(platforms): + def decorator(func): + @functools.wraps(func) + def inner(): + if sys.platform in platforms: + func() + return inner + return decorator + + +@only_on(('linux', 'darwin')) +def check_rlimit_core(): + soft, hard = resource.getrlimit(resource.RLIMIT_CORE) + if soft > 0: + error_unless_permitted('ALLOW_NONZERO_ULIMIT', + ("The rust test suite will segfault many rustc's in the debuginfo phase.\n" + "set ALLOW_NONZERO_ULIMIT to ignore this warning\n")) + + +def main(): + check_rlimit_core() + +if __name__ == '__main__': + main() + sys.exit(STATUS) -- cgit 1.4.1-3-g733a5 From c40ec080ffdc2222c69c5e0feed543b38c5f99ba Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Tue, 24 Mar 2015 17:10:02 -0700 Subject: check: Add license --- src/etc/check-sanitycheck.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src') diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py index 1ac1c3fefb5..f7da4755690 100644 --- a/src/etc/check-sanitycheck.py +++ b/src/etc/check-sanitycheck.py @@ -1,4 +1,15 @@ #!/usr/bin/env python +# +# Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +# file at the top-level directory of this distribution and at +# http://rust-lang.org/COPYRIGHT. +# +# Licensed under the Apache License, Version 2.0 or the MIT license +# , at your +# option. This file may not be copied, modified, or distributed +# except according to those terms. + import os import sys import functools -- cgit 1.4.1-3-g733a5 From 93fc804b85b856aa84455cdcee5f4ae51b51a25a Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Tue, 24 Mar 2015 17:14:29 -0700 Subject: check: Run the rlimit_core check on *BSD --- src/etc/check-sanitycheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py index f7da4755690..c5df15aa177 100644 --- a/src/etc/check-sanitycheck.py +++ b/src/etc/check-sanitycheck.py @@ -35,7 +35,7 @@ def only_on(platforms): return decorator -@only_on(('linux', 'darwin')) +@only_on(('linux', 'darwin', 'freebsd', 'openbsd')) def check_rlimit_core(): soft, hard = resource.getrlimit(resource.RLIMIT_CORE) if soft > 0: -- cgit 1.4.1-3-g733a5 From e4f9ce8cbf9d5a110afb7274c393abb333e01a2b Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Tue, 24 Mar 2015 17:14:45 -0700 Subject: check: Fix the check for platform formatting --- src/etc/check-sanitycheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py index c5df15aa177..cb34fa20531 100644 --- a/src/etc/check-sanitycheck.py +++ b/src/etc/check-sanitycheck.py @@ -29,7 +29,7 @@ def only_on(platforms): def decorator(func): @functools.wraps(func) def inner(): - if sys.platform in platforms: + if any(map(lambda x: sys.platform.startswith(x), platforms)): func() return inner return decorator -- cgit 1.4.1-3-g733a5 From 146264c6ae057d6418b8c1063526183254b245ba Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Fri, 27 Mar 2015 16:54:46 -0700 Subject: check: Name the sentinal variable more sanely --- src/etc/check-sanitycheck.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py index cb34fa20531..5822cc0259f 100644 --- a/src/etc/check-sanitycheck.py +++ b/src/etc/check-sanitycheck.py @@ -39,7 +39,7 @@ def only_on(platforms): def check_rlimit_core(): soft, hard = resource.getrlimit(resource.RLIMIT_CORE) if soft > 0: - error_unless_permitted('ALLOW_NONZERO_ULIMIT', + error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', ("The rust test suite will segfault many rustc's in the debuginfo phase.\n" "set ALLOW_NONZERO_ULIMIT to ignore this warning\n")) -- cgit 1.4.1-3-g733a5 From 4af204ddee0fbb61eddf9579ede9f0214c942ba0 Mon Sep 17 00:00:00 2001 From: Richo Healey Date: Fri, 27 Mar 2015 16:54:56 -0700 Subject: check: Reword the warning to be more prescriptive --- src/etc/check-sanitycheck.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/etc/check-sanitycheck.py b/src/etc/check-sanitycheck.py index 5822cc0259f..0d9c430ec3a 100644 --- a/src/etc/check-sanitycheck.py +++ b/src/etc/check-sanitycheck.py @@ -39,9 +39,11 @@ def only_on(platforms): def check_rlimit_core(): soft, hard = resource.getrlimit(resource.RLIMIT_CORE) if soft > 0: - error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', - ("The rust test suite will segfault many rustc's in the debuginfo phase.\n" - "set ALLOW_NONZERO_ULIMIT to ignore this warning\n")) + error_unless_permitted('ALLOW_NONZERO_RLIMIT_CORE', """\ +RLIMIT_CORE is set to a nonzero value (%d). During debuginfo, the test suite +will segfault many rustc's, creating many potentially large core files. +set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning +""" % (soft)) def main(): -- cgit 1.4.1-3-g733a5