Fix platform detection
This commit is contained in:
parent
8c86f8ff8c
commit
a40bca29a8
1 changed files with 3 additions and 6 deletions
|
@ -17,14 +17,12 @@ import functools
|
||||||
|
|
||||||
STATUS = 0
|
STATUS = 0
|
||||||
|
|
||||||
|
|
||||||
def error_unless_permitted(env_var, message):
|
def error_unless_permitted(env_var, message):
|
||||||
global STATUS
|
global STATUS
|
||||||
if not os.getenv(env_var):
|
if not os.getenv(env_var):
|
||||||
sys.stderr.write(message)
|
sys.stderr.write(message)
|
||||||
STATUS = 1
|
STATUS = 1
|
||||||
|
|
||||||
|
|
||||||
def only_on(platforms):
|
def only_on(platforms):
|
||||||
def decorator(func):
|
def decorator(func):
|
||||||
@functools.wraps(func)
|
@functools.wraps(func)
|
||||||
|
@ -34,8 +32,7 @@ def only_on(platforms):
|
||||||
return inner
|
return inner
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
|
||||||
@only_on(('linux', 'darwin', 'freebsd', 'openbsd'))
|
|
||||||
def check_rlimit_core():
|
def check_rlimit_core():
|
||||||
import resource
|
import resource
|
||||||
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
|
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
|
||||||
|
@ -46,9 +43,9 @@ will segfault many rustc's, creating many potentially large core files.
|
||||||
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
|
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
|
||||||
""" % (soft))
|
""" % (soft))
|
||||||
|
|
||||||
@only_on(('windows'))
|
@only_on(['win32'])
|
||||||
def check_console_code_page():
|
def check_console_code_page():
|
||||||
if "65001" not in subprocess.check_output(['cmd', '/c', 'chcp']):
|
if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
|
||||||
sys.stderr.write('Warning: the console output code page is not UTF-8, \
|
sys.stderr.write('Warning: the console output code page is not UTF-8, \
|
||||||
some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')
|
some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue