Skip to content

Commit 8c86f8f

Browse files
committed
Warn if the test suite is run on Windows in console with non-UTF-8 code page
1 parent a97b3ff commit 8c86f8f

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
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

+7
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
# except according to those terms.
1212

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

@@ -45,8 +46,14 @@ def check_rlimit_core():
4546
set ALLOW_NONZERO_RLIMIT_CORE to ignore this warning
4647
""" % (soft))
4748

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

4955
def main():
56+
check_console_code_page()
5057
check_rlimit_core()
5158

5259
if __name__ == '__main__':

0 commit comments

Comments
 (0)