Skip to content

test suite: Output UTF-8 from cmd.exe on Windows #25654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 2, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions mk/tests.mk
Original file line number Diff line number Diff line change
Expand Up @@ -172,23 +172,24 @@ check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log

# As above but don't bother running tidy.
check-notidy: cleantmptestlogs cleantestlibs all check-stage2
check-notidy: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log

# A slightly smaller set of tests for smoke testing.
check-lite: cleantestlibs cleantmptestlogs \
check-lite: check-sanitycheck cleantestlibs cleantmptestlogs \
$(foreach crate,$(TEST_TARGET_CRATES),check-stage2-$(crate)) \
check-stage2-rpass check-stage2-rpass-valgrind \
check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log

# Only check the 'reference' tests: rpass/cfail/rfail/rmake.
check-ref: cleantestlibs cleantmptestlogs check-stage2-rpass check-stage2-rpass-valgrind \
check-stage2-rfail check-stage2-cfail check-stage2-pfail check-stage2-rmake
check-ref: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-rpass \
check-stage2-rpass-valgrind check-stage2-rfail check-stage2-cfail check-stage2-pfail \
check-stage2-rmake
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log

# Only check the docs.
check-docs: cleantestlibs cleantmptestlogs check-stage2-docs
check-docs: check-sanitycheck cleantestlibs cleantmptestlogs check-stage2-docs
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log

# Some less critical tests that are not prone to breakage.
Expand Down
12 changes: 8 additions & 4 deletions src/etc/check-sanitycheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,18 @@
# except according to those terms.

import os
import subprocess
import sys
import functools

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)
Expand All @@ -33,8 +32,7 @@ def inner():
return inner
return decorator


@only_on(('linux', 'darwin', 'freebsd', 'openbsd'))
@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
def check_rlimit_core():
import resource
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
Expand All @@ -45,8 +43,14 @@ def check_rlimit_core():
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
""" % (soft))

@only_on(['win32'])
def check_console_code_page():
if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
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')

def main():
check_console_code_page()
check_rlimit_core()

if __name__ == '__main__':
Expand Down