Skip to content

Commit f813f97

Browse files
committed
Auto merge of #25654 - petrochenkov:encenv, r=alexcrichton
Fixes #25268 and a couple of similar test errors r? @alexcrichton
2 parents 613e57b + a40bca2 commit f813f97

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

mk/tests.mk

+6-5
Original file line numberDiff line numberDiff line change
@@ -172,23 +172,24 @@ check: check-sanitycheck cleantmptestlogs cleantestlibs all check-stage2 tidy
172172
$(Q)$(CFG_PYTHON) $(S)src/etc/check-summary.py tmp/*.log
173173

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

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

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

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

194195
# Some less critical tests that are not prone to breakage.

src/etc/check-sanitycheck.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,18 @@
1111
# except according to those terms.
1212

1313
import os
14+
import subprocess
1415
import sys
1516
import functools
1617

1718
STATUS = 0
1819

19-
2020
def error_unless_permitted(env_var, message):
2121
global STATUS
2222
if not os.getenv(env_var):
2323
sys.stderr.write(message)
2424
STATUS = 1
2525

26-
2726
def only_on(platforms):
2827
def decorator(func):
2928
@functools.wraps(func)
@@ -33,8 +32,7 @@ def inner():
3332
return inner
3433
return decorator
3534

36-
37-
@only_on(('linux', 'darwin', 'freebsd', 'openbsd'))
35+
@only_on(['linux', 'darwin', 'freebsd', 'openbsd'])
3836
def check_rlimit_core():
3937
import resource
4038
soft, hard = resource.getrlimit(resource.RLIMIT_CORE)
@@ -45,8 +43,14 @@ def check_rlimit_core():
4543
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
4644
""" % (soft))
4745

46+
@only_on(['win32'])
47+
def check_console_code_page():
48+
if '65001' not in subprocess.check_output(['cmd', '/c', 'chcp']):
49+
sys.stderr.write('Warning: the console output code page is not UTF-8, \
50+
some tests may fail. Use `cmd /c "chcp 65001"` to setup UTF-8 code page.\n')
4851

4952
def main():
53+
check_console_code_page()
5054
check_rlimit_core()
5155

5256
if __name__ == '__main__':

0 commit comments

Comments
 (0)