Skip to content

Commit

Permalink
make make test work again
Browse files Browse the repository at this point in the history
Two changes:

1.) lit r187261 turned on pipefail, so add `not` commands in front of
    gong invcations that are expected to fail.

2.) lit r188039 moved some lit things around, so merge clang r188072 to
    make the lit config work with that.
  • Loading branch information
nico committed Aug 22, 2013
1 parent 9a45874 commit 6a7c25e
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 33 deletions.
2 changes: 1 addition & 1 deletion test/Frontend/verify-malformed.go
@@ -1,4 +1,4 @@
// RUN: %gong_cc1 -verify %s 2>&1 | FileCheck %s
// RUN: not %gong_cc1 -verify %s 2>&1 | FileCheck %s

// expected-diag malformed
// expected-diag {{malformed
Expand Down
2 changes: 1 addition & 1 deletion test/Frontend/verify.go
@@ -1,4 +1,4 @@
// RUN: %gong_cc1 -verify %s 2>&1 | FileCheck %s
// RUN: not %gong_cc1 -verify %s 2>&1 | FileCheck %s

package p;
func g() {
Expand Down
2 changes: 1 addition & 1 deletion test/Parser/fixit-while.go
@@ -1,5 +1,5 @@
// RUN: %gong_cc1 -verify %s
// RUN: %gong_cc1 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// RUN: not %gong_cc1 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s

package p

Expand Down
2 changes: 1 addition & 1 deletion test/Parser/func.go
@@ -1,5 +1,5 @@
// RUN: %gong_cc1 -verify %s
// RUN: %gong_cc1 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// RUN: not %gong_cc1 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s

package p

Expand Down
2 changes: 1 addition & 1 deletion test/Parser/import.go
@@ -1,5 +1,5 @@
// RUN: %gong_cc1 -verify %s
// RUN: %gong_cc1 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// RUN: not %gong_cc1 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s

package mypackage;

Expand Down
2 changes: 1 addition & 1 deletion test/Sema/crash-init-idents.go
@@ -1,4 +1,4 @@
// RUN: %gong_cc1 %s -sema 2>&1 | FileCheck %s
// RUN: not %gong_cc1 %s -sema 2>&1 | FileCheck %s
// CHECK-NOT: Assertion failed
package p

Expand Down
2 changes: 1 addition & 1 deletion test/Sema/crash.go
@@ -1,4 +1,4 @@
// RUN: %gong_cc1 %s -sema 2>&1 | FileCheck %s
// RUN: not %gong_cc1 %s -sema 2>&1 | FileCheck %s
// Note: This doesn't run with -verify. This is a regression test for a crash
// that only happened without -verify.

Expand Down
54 changes: 33 additions & 21 deletions test/lit.cfg
Expand Up @@ -6,6 +6,8 @@ import re
import subprocess
import tempfile

import lit.formats
import lit.util

# Configuration file for the 'lit' test runner.

Expand All @@ -16,20 +18,29 @@ config.name = 'Gong'
if platform.system() == 'Windows':
# Seek sane tools in directories and set to $PATH.
path = getattr(config, 'lit_tools_dir', None)
path = lit.getToolsPath(path,
config.environment['PATH'],
['cmp.exe', 'grep.exe', 'sed.exe'])
path = lit_config.getToolsPath(path,
config.environment['PATH'],
['cmp.exe', 'grep.exe', 'sed.exe'])
if path is not None:
path = os.path.pathsep.join((path,
config.environment['PATH']))
config.environment['PATH'] = path

# Choose between lit's internal shell pipeline runner and a real shell. If
# LIT_USE_INTERNAL_SHELL is in the environment, we use that as an override.
use_lit_shell = os.environ.get("LIT_USE_INTERNAL_SHELL")
if use_lit_shell:
# 0 is external, "" is default, and everything else is internal.
execute_external = (use_lit_shell == "0")
else:
# Otherwise we default to internal on Windows and external elsewhere, as
# bash on Windows is usually very slow.
execute_external = (not sys.platform in ['win32'])

# testFormat: The test format to use to interpret tests.
#
# For now we require '&&' between commands, until they get globally killed and
# the test runner updated.
execute_external = (platform.system() != 'Windows'
or lit.getBashPath() not in [None, ""])
config.test_format = lit.formats.ShTest(execute_external)

# suffixes: A list of file extensions to treat as test files.
Expand All @@ -51,13 +62,12 @@ config.llvm_obj_root = getattr(config, 'llvm_obj_root', None)
if gong_obj_root is not None:
llvm_tools_dir = getattr(config, 'llvm_tools_dir', None)
if not llvm_tools_dir:
lit.fatal('No LLVM tools dir set!')
lit_config.fatal('No LLVM tools dir set!')
path = os.path.pathsep.join((llvm_tools_dir, config.environment['PATH']))
config.environment['PATH'] = path

llvm_libs_dir = getattr(config, 'llvm_libs_dir', None)
if not llvm_libs_dir:
lit.fatal('No LLVM libs dir set!')
lit_config.fatal('No LLVM libs dir set!')
path = os.path.pathsep.join((llvm_libs_dir,
config.environment.get('LD_LIBRARY_PATH','')))
config.environment['LD_LIBRARY_PATH'] = path
Expand All @@ -72,9 +82,9 @@ if config.test_exec_root is None:
# out-of-tree build situation).

# Check for 'gong_site_config' user parameter, and use that if available.
site_cfg = lit.params.get('gong_site_config', None)
site_cfg = lit_config.params.get('gong_site_config', None)
if site_cfg and os.path.exists(site_cfg):
lit.load_config(config, site_cfg)
lit_config.load_config(config, site_cfg)
raise SystemExit

# Try to detect the situation where we are using an out-of-tree build by
Expand All @@ -88,7 +98,7 @@ if config.test_exec_root is None:

llvm_config = lit.util.which('llvm-config', config.environment['PATH'])
if not llvm_config:
lit.fatal('No site specific configuration available!')
lit_config.fatal('No site specific configuration available!')

# Get the source and object roots.
llvm_src_root = lit.util.capture(['llvm-config', '--src-root']).strip()
Expand All @@ -100,17 +110,18 @@ if config.test_exec_root is None:
# tools/gong layout.
this_src_root = os.path.dirname(config.test_source_root)
if os.path.realpath(gong_src_root) != os.path.realpath(this_src_root):
lit.fatal('No site specific configuration available!')
lit_config.fatal('No site specific configuration available!')

# Check that the site specific configuration exists.
site_cfg = os.path.join(gong_obj_root, 'test', 'lit.site.cfg')
if not os.path.exists(site_cfg):
lit.fatal('No site specific configuration available! You may need to '
'run "make test" in your Gong build directory.')
lit_config.fatal('No site specific configuration available! You may '
'need to run "make test" in your '
'Gong build directory.')

# Okay, that worked. Notify the user of the automagic, and reconfigure.
lit.note('using out-of-tree build at %r' % gong_obj_root)
lit.load_config(config, site_cfg)
lit_config.note('using out-of-tree build at %r' % gong_obj_root)
lit_config.load_config(config, site_cfg)
raise SystemExit

###
Expand All @@ -132,14 +143,14 @@ def inferGong(PATH):
gong = lit.util.which('gong', PATH)

if not gong:
lit.fatal("couldn't find 'gong' program, try setting "
lit_config.fatal("couldn't find 'gong' program, try setting "
"GONG in your environment")

return gong

config.gong = inferGong(config.environment['PATH']).replace('\\', '/')
if not lit.quiet:
lit.note('using gong: %r' % config.gong)
if not lit_config.quiet:
lit_config.note('using gong: %r' % config.gong)

# Note that when substituting %gong_cc1 also fill in the include directory of
# the builtin headers. Those are part of even a freestanding environment, but
Expand All @@ -150,7 +161,7 @@ def getGongBuiltinIncludeDir(gong):
cmd = subprocess.Popen([gong, '-print-file-name=include'],
stdout=subprocess.PIPE)
if not cmd.stdout:
lit.fatal("Couldn't find the include dir for Gong ('%s')" % gong)
lit_config.fatal("Couldn't find the include dir for Gong ('%s')" % gong)
return cmd.stdout.read().strip()

config.substitutions.append( ('%gong_cc1', '%s -cc1 -internal-isystem %s'
Expand Down Expand Up @@ -222,6 +233,7 @@ def get_llc_props(tool):
# Parse the stdout to get the list of registered targets.
parse_targets = False
for line in cmd.stdout:
line = line.decode('ascii')
if parse_targets:
m = re.match( r'(.*) - ', line)
if m is not None:
Expand All @@ -241,7 +253,7 @@ llc_props = get_llc_props(os.path.join(llvm_tools_dir, 'llc'))
if len(llc_props['set_of_targets']) > 0:
config.available_features.update(llc_props['set_of_targets'])
else:
lit.fatal('No Targets Registered with the LLVM Tools!')
lit_config.fatal('No Targets Registered with the LLVM Tools!')

if llc_props['enable_assertions']:
config.available_features.add('asserts')
Expand Down
10 changes: 5 additions & 5 deletions test/lit.site.cfg.in
Expand Up @@ -11,12 +11,12 @@ config.target_triple = "@TARGET_TRIPLE@"
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
try:
config.llvm_tools_dir = config.llvm_tools_dir % lit.params
config.llvm_libs_dir = config.llvm_libs_dir % lit.params
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
except KeyError,e:
key, = e.args
lit.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" %
(key,key))

# Let the main config do the real work.
lit.load_config(config, "@GONG_SOURCE_DIR@/test/lit.cfg")

lit_config.load_config(config, "@GONG_SOURCE_DIR@/test/lit.cfg")

0 comments on commit 6a7c25e

Please sign in to comment.