[Git][ghc/ghc][wip/python-files] Use -Wdefault when running Python testdriver (#22727)
Krzysztof Gogolewski (@monoidal)
gitlab at gitlab.haskell.org
Wed Jan 11 20:10:15 UTC 2023
Krzysztof Gogolewski pushed to branch wip/python-files at Glasgow Haskell Compiler / GHC
Commits:
b1c81f42 by Krzysztof Gogolewski at 2023-01-11T21:09:34+01:00
Use -Wdefault when running Python testdriver (#22727)
- - - - -
4 changed files:
- hadrian/src/Settings/Builders/RunTest.hs
- testsuite/driver/cpu_features.py
- testsuite/driver/runtests.py
- testsuite/tests/codeGen/should_compile/all.T
Changes:
=====================================
hadrian/src/Settings/Builders/RunTest.hs
=====================================
@@ -181,7 +181,7 @@ assertSameCompilerArgs stg = do
]
--- Command line arguments for invoking the @runtest.py@ script. A lot of this
+-- Command line arguments for invoking the @runtests.py@ script. A lot of this
-- mirrors @testsuite/mk/test.mk at .
runTestBuilderArgs :: Args
runTestBuilderArgs = builder Testsuite ? do
@@ -227,7 +227,8 @@ runTestBuilderArgs = builder Testsuite ? do
asBool s b = s ++ show b
-- TODO: set CABAL_MINIMAL_BUILD/CABAL_PLUGIN_BUILD
- mconcat [ arg $ "testsuite/driver/runtests.py"
+ mconcat [ arg "-Wdefault" -- see #22727
+ , arg $ "testsuite/driver/runtests.py"
, pure [ "--rootdir=" ++ testdir | testdir <- rootdirs ]
, arg "--top", arg (top -/- "testsuite")
, arg "-e", arg $ "windows=" ++ show windowsHost
=====================================
testsuite/driver/cpu_features.py
=====================================
@@ -17,7 +17,8 @@ cpu_feature_cache = None
def get_cpu_features():
if config.os in ['mingw32', 'linux'] and os.path.exists('/proc/cpuinfo'):
- f = open('/proc/cpuinfo').read()
+ with open('/proc/cpuinfo') as x:
+ f = x.read()
flags = re.search(r'flags\s*:\s*.*$', f, re.M)
if flags is None:
print('get_cpu_features: failed to find cpu features')
=====================================
testsuite/driver/runtests.py
=====================================
@@ -99,7 +99,8 @@ if args.e:
if args.config_file:
for arg in args.config_file:
- exec(open(arg).read())
+ with io.open(arg) as f:
+ exec(f.read())
if args.config:
for arg in args.config:
@@ -349,8 +350,6 @@ except Exception as e:
print('Failed to detect CPU features: ', e)
sys.stdout.flush()
-# we output text, which cannot be unbuffered
-sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w")
if config.local:
tempdir = ''
@@ -607,6 +606,7 @@ else:
print("WARNING - skipping all tests and only reporting required hadrian dependencies:", config.hadrian_deps)
for d in config.hadrian_deps:
print(d,file=config.only_report_hadrian_deps)
+ config.only_report_hadrian_deps.close()
if len(t.unexpected_failures) > 0 or \
len(t.unexpected_stat_failures) > 0 or \
=====================================
testsuite/tests/codeGen/should_compile/all.T
=====================================
@@ -96,7 +96,7 @@ test('T14373c',
switch_skeleton_only])
switch_skeleton_and_entries_only = (r'grep -e "switch \[" -e "case " -e "default: " -e "Default_entry(" -e "R1 = .*_closure+2;"'
- '| sed -e "s|\] .*|\]|g" -e "s|goto .*|goto |g" -e "s|R1 = .*_closure+2;.*|R1 = XYZ_closure+2;|g" -e "s|//.*|//|g"')
+ r'| sed -e "s|\] .*|\]|g" -e "s|goto .*|goto |g" -e "s|R1 = .*_closure+2;.*|R1 = XYZ_closure+2;|g" -e "s|//.*|//|g"')
test('T14373d',
[ js_skip # JS backend doesn't produce Cmm
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b1c81f429ae0720b245a71065b3752a7ec181cf8
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/b1c81f429ae0720b245a71065b3752a7ec181cf8
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20230111/ef30c2f7/attachment-0001.html>
More information about the ghc-commits
mailing list