Fix broken vanilla-cling tests.

Change condition of adding vanilla-cling, change directory locations for
downloaded binary release.
This commit is contained in:
Pratyush Das 2019-12-01 17:16:57 +05:30 committed by SFT
parent 8c433c0367
commit bc70947c9a
2 changed files with 40 additions and 9 deletions

View File

@ -3,12 +3,22 @@
# Configuration file for the 'lit' test runner.
import os
import sys
import platform
import re
import subprocess
import lit.util
import lit.formats
if sys.version_info < (3, 0):
# Python 2.x
from urllib2 import urlopen
input = raw_input
else:
# Python 3.x
from urllib.request import urlopen
IsWindows = platform.system() == 'Windows'
# Choose between lit's internal shell pipeline runner and a real shell. If
@ -174,9 +184,7 @@ site_exp = {}
## site_exp[sub].replace('-fno-exceptions', '')))
## else:
## config.substitutions.append(('%' + sub, site_exp[sub]))
config.substitutions.append(('%testexecdir', config.test_exec_root))
config.substitutions.append(('%shlibext', config.shlibext))
config.substitutions.append(('%llvmsrcdir', config.llvm_src_root))
# For each occurrence of an llvm tool name as its own word, replace it
# with the full path to the build directory holding that tool. This
@ -311,9 +319,20 @@ if platform.system() not in ['Windows']:
# Do we have cling and clang sources under llvm? Some tests
# require it.
if os.path.isdir(config.llvm_src_root + '/tools/clang') and \
os.path.isdir(config.llvm_src_root + '/tools/cling'):
config.available_features.add('vanilla-cling')
if not os.path.exists(os.path.join(config.test_exec_root, "..", "..", "clang", "test")):
config.test_exec_root = os.path.join(config.test_exec_root, "..", "..")
llvm_revision = urlopen(
"https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt"
).readline().strip().decode('utf-8')
subprocess.Popen(['sudo svn export http://llvm.org/svn/llvm-project/llvm/branches/{0}/utils/lit utils/lit'.format(llvm_revision)],
cwd=config.llvm_src_root,
shell=True,
stdin=subprocess.PIPE,
stdout=None,
stderr=subprocess.STDOUT).communicate('yes'.encode('utf-8'))
config.substitutions.append(('%testexecdir', config.test_exec_root))
config.substitutions.append(('%llvmsrcdir', config.llvm_src_root))
config.available_features.add('vanilla-cling')
if lit.util.which('libcudart.so', config.environment.get('LD_LIBRARY_PATH','')) is not None:
config.available_features.add('cuda-runtime')

View File

@ -252,8 +252,8 @@ def is_llvm_binary_compatible():
return False
def download_llvm_binary(tar_required):
global llvm_flags
def download_llvm_binary():
global llvm_flags, tar_required
box_draw("Fetching LLVM binary")
print('Current working directory is: ' + workdir + '\n')
if DIST=="Ubuntu":
@ -491,6 +491,7 @@ def set_vars_for_binary():
global EXEEXT
global SHLIBEXT
global CLANG_VERSION
global tar_required
box_draw("Set variables")
with open(os.path.join(CLING_SRC_DIR, "test", "lit.site.cfg.in"), "r") as file:
@ -502,6 +503,16 @@ def set_vars_for_binary():
with open(os.path.join(CLING_SRC_DIR, "test", "lit.site.cfg.in"), "w") as file:
file.writelines(lines)
if tar_required:
with open(os.path.join(CLING_SRC_DIR, "test", "lit.site.cfg.in"), "r") as file:
lines = file.readlines()
for i in range(len(lines)):
if lines[i].startswith("config.llvm_src_root ="):
lines[i] = 'config.llvm_src_root = "{0}"\n'.format(srcdir)
break
with open(os.path.join(CLING_SRC_DIR, "test", "lit.site.cfg.in"), "w") as file:
file.writelines(lines)
print('EXEEXT: ' + EXEEXT)
print('SHLIBEXT: ' + SHLIBEXT)
@ -1992,6 +2003,7 @@ CLING_SRC_DIR = os.path.join(srcdir, 'tools', 'cling')
CPT_SRC_DIR = os.path.join(CLING_SRC_DIR, 'tools', 'packaging')
LLVM_OBJ_ROOT = os.path.join(workdir, 'builddir')
prefix = ''
tar_required = False
llvm_revision = urlopen(
"https://raw.githubusercontent.com/root-project/cling/master/LastKnownGoodLLVMSVNRevision.txt").readline().strip().decode(
'utf-8')
@ -2067,8 +2079,8 @@ else:
LLVM_GIT_URL = "http://root.cern.ch/git/llvm.git"
if args['check_requirements']:
global tar_required
llvm_binary_name = ""
tar_required = False
box_draw('Check availability of required softwares')
if DIST == 'Ubuntu':
install_line = ""
@ -2206,7 +2218,7 @@ Refer to the documentation of CPT for information on setting up your Windows env
continue
if is_llvm_binary_compatible():
download_llvm_binary(tar_required)
download_llvm_binary()
if args['current_dev']:
travis_fold_start("git-clone")