Commit e4a597f2 authored by Krzysztof Gogolewski's avatar Krzysztof Gogolewski

Revert "Basic Python 3 support for testsuite driver (Trac #9184)"

This reverts commit 084d241b.

This is a possible culprit of Windows breakage reported at ghc-devs.
parent 582217fc
......@@ -148,17 +148,21 @@ config.way_rts_flags = {
# Useful classes of ways that can be used with only_ways() and
# expect_broken_for().
prof_ways = [x[0] for x in config.way_flags('dummy_name').items()
if '-prof' in x[1]]
prof_ways = map (lambda x: x[0], \
filter(lambda x: '-prof' in x[1], \
config.way_flags('dummy_name').items()))
threaded_ways = [x[0] for x in config.way_flags('dummy_name').items()
if '-threaded' in x[1] or 'ghci' == x[0]]
threaded_ways = map (lambda x: x[0], \
filter(lambda x: '-threaded' in x[1] or 'ghci' == x[0], \
config.way_flags('dummy_name').items()))
opt_ways = [x[0] for x in config.way_flags('dummy_name').items()
if '-O' in x[1]]
opt_ways = map (lambda x: x[0], \
filter(lambda x: '-O' in x[1], \
config.way_flags('dummy_name').items()))
llvm_ways = [x[0] for x in config.way_flags('dummy_name').items()
if '-fflvm' in x[1]]
llvm_ways = map (lambda x: x[0], \
filter(lambda x: '-fllvm' in x[1], \
config.way_flags('dummy_name').items()))
def get_compiler_info():
# This should really not go through the shell
......@@ -188,7 +192,7 @@ def get_compiler_info():
if re.match(".*_p(_.*|$)", rtsInfoDict["RTS way"]):
config.compiler_profiled = True
config.run_ways = [x for x in config.run_ways if x != 'ghci']
config.run_ways = filter(lambda x: x != 'ghci', config.run_ways)
else:
config.compiler_profiled = False
......
......@@ -2,8 +2,6 @@
# (c) Simon Marlow 2002
#
from __future__ import print_function
import sys
import os
import string
......@@ -23,11 +21,6 @@ try:
except:
pass
PYTHON3 = sys.version_info >= (3, 0)
if PYTHON3:
print("*** WARNING: running testsuite using Python 3.\n"
"*** Python 3 support is experimental. See Trac #9184.")
from testutil import *
from testglobals import *
......@@ -59,12 +52,12 @@ opts, args = getopt.getopt(sys.argv[1:], "e:", long_options)
for opt,arg in opts:
if opt == '--config':
exec(open(arg).read())
execfile(arg)
# -e is a string to execute from the command line. For example:
# testframe -e 'config.compiler=ghc-5.04'
if opt == '-e':
exec(arg)
exec arg
if opt == '--rootdir':
config.rootdirs.append(arg)
......@@ -90,9 +83,9 @@ for opt,arg in opts:
sys.stderr.write("ERROR: requested way \'" +
arg + "\' does not exist\n")
sys.exit(1)
config.other_ways = [w for w in config.other_ways if w != arg]
config.run_ways = [w for w in config.run_ways if w != arg]
config.compile_ways = [w for w in config.compile_ways if w != arg]
config.other_ways = filter(neq(arg), config.other_ways)
config.run_ways = filter(neq(arg), config.run_ways)
config.compile_ways = filter(neq(arg), config.compile_ways)
if opt == '--threads':
config.threads = int(arg)
......@@ -124,17 +117,17 @@ if config.use_threads == 1:
maj = int(re.sub('[^0-9].*', '', str(maj)))
min = int(re.sub('[^0-9].*', '', str(min)))
pat = int(re.sub('[^0-9].*', '', str(pat)))
if (maj, min) < (2, 6):
print("Python < 2.6 is not supported")
sys.exit(1)
if (maj, min, pat) < (2, 5, 2):
print "Warning: Ignoring request to use threads as python version < 2.5.2"
config.use_threads = 0
# We also need to disable threads for python 2.7.2, because of
# this bug: http://bugs.python.org/issue13817
elif (maj, min, pat) == (2, 7, 2):
print("Warning: Ignoring request to use threads as python version is 2.7.2")
print("See http://bugs.python.org/issue13817 for details.")
print "Warning: Ignoring request to use threads as python version is 2.7.2"
print "See http://bugs.python.org/issue13817 for details."
config.use_threads = 0
if windows:
print("Warning: Ignoring request to use threads as running on Windows")
print "Warning: Ignoring request to use threads as running on Windows"
config.use_threads = 0
config.cygwin = False
......@@ -189,10 +182,10 @@ else:
h.close()
if v != '':
os.environ['LC_ALL'] = v
print("setting LC_ALL to", v)
print "setting LC_ALL to", v
else:
print('WARNING: No UTF8 locale found.')
print('You may get some spurious test failures.')
print 'WARNING: No UTF8 locale found.'
print 'You may get some spurious test failures.'
# This has to come after arg parsing as the args can change the compiler
get_compiler_info()
......@@ -239,7 +232,7 @@ if config.use_threads:
if config.timeout == -1:
config.timeout = int(read_no_crs(config.top + '/timeout/calibrate.out'))
print('Timeout is ' + str(config.timeout))
print 'Timeout is ' + str(config.timeout)
# -----------------------------------------------------------------------------
# The main dude
......@@ -249,44 +242,40 @@ if config.rootdirs == []:
t_files = findTFiles(config.rootdirs)
print('Found', len(t_files), '.T files...')
print 'Found', len(t_files), '.T files...'
t = getTestRun()
# Avoid cmd.exe built-in 'date' command on Windows
t.start_time = time.localtime()
print('Beginning test run at', time.strftime("%c %Z",t.start_time))
print 'Beginning test run at', time.strftime("%c %Z",t.start_time)
# set stdout to unbuffered (is this the best way to do it?)
sys.stdout.flush()
if PYTHON3:
# in Python 3, we output text, which cannot be unbuffered
sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w")
else:
# set stdout to unbuffered (is this the best way to do it?)
sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)
sys.stdout = os.fdopen(sys.__stdout__.fileno(), "w", 0)
# First collect all the tests to be run
for file in t_files:
if_verbose(2, '====> Scanning %s' % file)
newTestDir(os.path.dirname(file))
try:
exec(open(file).read())
except Exception:
print('*** framework failure: found an error while executing ', file, ':')
execfile(file)
except:
print '*** framework failure: found an error while executing ', file, ':'
t.n_framework_failures = t.n_framework_failures + 1
traceback.print_exc()
if config.list_broken:
global brokens
print('')
print('Broken tests:')
print(' '.join(map (lambda bdn: '#' + str(bdn[0]) + '(' + bdn[1] + '/' + bdn[2] + ')', brokens)))
print('')
print ''
print 'Broken tests:'
print (' '.join(map (lambda (b, d, n) : '#' + str(b) + '(' + d + '/' + n + ')', brokens)))
print ''
if t.n_framework_failures != 0:
print('WARNING:', str(t.n_framework_failures), 'framework failures!')
print('')
print 'WARNING:', str(t.n_framework_failures), 'framework failures!'
print ''
else:
# Now run all the tests
if config.use_threads:
......
This diff is collapsed.
# -----------------------------------------------------------------------------
# Utils
def id(a):
return a
def eq(x):
return lambda y,z=x: y == z
def neq(x):
return lambda y,z=x: y != z
def append(x,y):
return x + y
def concat(xs):
return reduce(append,xs,[])
def chop(s):
if s[len(s)-1:] == '\n':
return s[:len(s)-1]
else:
return s
def all(p,xs):
for x in xs:
if not p(x):
return False
return True
def elem(xs):
return lambda x: x in xs
def notElem(xs):
return lambda x: x not in xs
def version_to_ints(v):
return [ int(x) for x in v.split('.') ]
......
......@@ -50,10 +50,10 @@ test('ffi008', [exit_code(1), omit_ways(['ghci'])], compile_and_run, [''])
maybe_skip = normal
opts = ''
if config.platform.startswith('i386-'):
if config.compiler_type == 'ghc' and \
if config.compiler_type == 'ghc' and \
version_ge(config.compiler_version, '6.13'):
opts = '-msse2'
else:
opts = '-msse2'
else:
maybe_skip = only_ways(['ghci'])
test('ffi009', [when(fast(), skip),
......@@ -69,9 +69,9 @@ test('ffi011', normal, compile_and_run, [''])
# it.
if config.os == 'mingw32':
skip_if_not_windows = normal
skip_if_not_windows = normal
else:
skip_if_not_windows = skip
skip_if_not_windows = skip
test('ffi012', skip_if_not_windows, compile_and_run, [''])
test('ffi013', normal, compile_and_run, [''])
......
setTestOpts(only_compiler_types(['ghc']))
def f(name, opts):
if not ('ghci' in config.run_ways):
opts.skip = 1
if not ('ghci' in config.run_ways):
opts.skip = 1
setTestOpts(f)
test('ghciprog004',
......
......@@ -15,11 +15,11 @@ test('arith007', normal, compile_and_run, [''])
ways = normal
opts = ''
if config.platform.startswith('i386-'):
if config.compiler_type == 'ghc' and \
if config.compiler_type == 'ghc' and \
version_ge(config.compiler_version, '6.13'):
opts = '-msse2'
else:
ways = expect_fail_for(['optasm','threaded2','hpc','dyn','profasm'])
opts = '-msse2'
else:
ways = expect_fail_for(['optasm','threaded2','hpc','dyn','profasm'])
test('arith008', ways, compile_and_run, [opts])
......
def no_lint(name, opts):
opts.compiler_always_flags = \
[opt for opt in opts.compiler_always_flags if opt != '-dcore-lint' and opt != '-dcmm-lint']
filter(lambda opt: opt != '-dcore-lint' and opt != '-dcmm-lint', opts.compiler_always_flags)
setTestOpts(no_lint)
......
def f(name, opts):
if (ghc_with_interpreter == 0):
opts.skip = 1
if (ghc_with_interpreter == 0):
opts.skip = 1
setTestOpts(f)
setTestOpts(when(compiler_lt('ghc', '7.1'), skip))
......
def f(name, opts):
opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell'
if (ghc_with_interpreter == 0):
opts.skip = 1
opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell'
if (ghc_with_interpreter == 0):
opts.skip = 1
setTestOpts(f)
setTestOpts(only_compiler_types(['ghc']))
......
......@@ -4,9 +4,9 @@
test('T4255', unless(compiler_profiled(), skip), compile_fail, ['-v0'])
def f(name, opts):
opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell'
if (ghc_with_interpreter == 0):
opts.skip = 1
opts.extra_hc_opts = '-XTemplateHaskell -package template-haskell'
if (ghc_with_interpreter == 0):
opts.skip = 1
setTestOpts(f)
setTestOpts(only_compiler_types(['ghc']))
......
......@@ -19,8 +19,8 @@ test('TcCoercible', when(compiler_lt('ghc', '7.7'), skip), compile_and_run, ['']
# Skip everything else if fast is on
def f(name, opts):
if config.fast:
opts.skip = 1
if config.fast:
opts.skip = 1
setTestOpts(f)
test('tcrun006', normal, compile_and_run, [''])
......
......@@ -10,7 +10,7 @@ except:
# We don't have resource, so this is a non-UNIX machine.
# It's probably a reasonable modern x86/x86_64 machines, so we'd
# probably calibrate to 300 anyway; thus just print 300.
print(300)
print 300
exit(0)
compiler = argv[1]
......
......@@ -21,7 +21,7 @@ try:
os.killpg(pid, signal.SIGKILL)
else:
return
except OSError as e:
except OSError, e:
if e.errno == errno.ECHILD:
return
else:
......
#! /usr/bin/env python
# Script to create and restore a git fingerprint of the ghc repositories.
from __future__ import print_function
from datetime import datetime
from optparse import OptionParser
import os
......@@ -25,7 +23,7 @@ def create_action(opts):
if len(fp) == 0:
error("Got empty fingerprint from source: "+str(opts.source))
if opts.output_file:
print("Writing fingerprint to: ", opts.output_file)
print "Writing fingerprint to: ", opts.output_file
fp.write(opts.output)
def restore_action(opts):
......@@ -91,7 +89,7 @@ def restore(fp, branch_name=None):
for (subdir, commit) in fp:
if subdir != ".":
cmd = checkout + [commit]
print("==", subdir, " ".join(cmd))
print "==", subdir, " ".join(cmd)
if os.path.exists(subdir):
rc = subprocess.call(cmd, cwd=subdir)
if rc != 0:
......@@ -186,7 +184,7 @@ def validate(opts, args, parser):
def error(msg="fatal error", parser=None, exit=1):
"""Function that prints error message and exits"""
print("ERROR:", msg)
print "ERROR:", msg
if parser:
parser.print_help()
sys.exit(exit)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment