Index: llvm/utils/lit/lit/TestingConfig.py =================================================================== --- llvm/utils/lit/lit/TestingConfig.py +++ llvm/utils/lit/lit/TestingConfig.py @@ -85,7 +85,13 @@ cfg_globals['config'] = self cfg_globals['lit_config'] = litConfig cfg_globals['__file__'] = path + original_sys_path = list(sys.path) try: + # Add the directory name to sys.path. This way individual + # test suites can write "import foo" or "from foo import bar" + # so that they can split complex logic up amongst multiple + # modules + sys.path.append(os.path.dirname(path)) exec(compile(data, path, 'exec'), cfg_globals, None) if litConfig.debug: litConfig.note('... loaded config %r' % path) @@ -100,7 +106,8 @@ litConfig.fatal( 'unable to parse config file %r, traceback: %s' % ( path, traceback.format_exc())) - + finally: + sys.path = original_sys_path self.finish(litConfig) def __init__(self, parent, name, suffixes, test_format,