Skip to content

Commit 85cef2e

Browse files
committed
[SYCL] Fix check-sycl-deploy target problems
- deploy-lit.site.cfg configuration file used to owerwrite llvm-lit to use binaries from deploy, which sometimes do not exist. Removed deploy-lit.site.cfg and made all configuration files flexible using llvm-lit command line options. - check-all target used to run check-sycl-deploy target. This caused problems if CMAKE_INSTALL_PREFIX wasn't specified, because in this case check-sycl-deploy target leads to trying to install sycl binaries to system directories. Excluded check-sycl-deploy target from check-all. - Reduced copy-paste in check-sycl-deploy target dependencies. - Reduced number of variables passed from cmake to lit. Signed-off-by: Mariya Podchishchaeva <[email protected]>
1 parent 52e1c06 commit 85cef2e

16 files changed

+37
-86
lines changed

sycl/test/CMakeLists.txt

Lines changed: 6 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,11 @@
1-
set(LLVM_BUILD_LIBRARY_DIRS "${LLVM_BINARY_DIR}/lib/")
2-
set(LLVM_BUILD_BINARY_DIRS "${LLVM_BINARY_DIR}/bin/")
31
set(LLVM_TOOLS_DIR "${LLVM_BINARY_DIR}/bin/")
4-
set(CLANG_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang")
5-
set(CLANGXX_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang++")
6-
set(CLANGCL_IN_BUILD "${LLVM_BINARY_DIR}/bin/clang-cl")
7-
8-
set(LLVM_DEPLOY_LIBRARY_DIRS "${CMAKE_INSTALL_PREFIX}/lib/")
9-
set(LLVM_DEPLOY_BINARY_DIRS "${CMAKE_INSTALL_PREFIX}/bin/")
10-
set(CLANG_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang")
11-
set(CLANGXX_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang++")
12-
set(CLANGCL_IN_DEPLOY "${CMAKE_INSTALL_PREFIX}/bin/clang-cl")
132

143
get_target_property(SYCL_BINARY_DIR sycl-toolchain BINARY_DIR)
154

165
set(SYCL_INCLUDE "${dst_dir}")
17-
set(SYCL_DEPLOY_INCLUDE "${dst_deploy_dir}")
186

197
set(RT_TEST_ARGS ${RT_TEST_ARGS} "-v")
20-
set(DEPLOY_RT_TEST_ARGS ${DEPLOY_RT_TEST_ARGS} "-v --config-prefix=deploy-lit")
8+
set(DEPLOY_RT_TEST_ARGS ${DEPLOY_RT_TEST_ARGS} "-v -D SYCL_TOOLS_DIR=${CMAKE_INSTALL_PREFIX}/bin -D SYCL_LIBS_DIR=${CMAKE_INSTALL_PREFIX}/lib -D SYCL_INCLUDE=${dst_deploy_dir}")
219

2210
configure_lit_site_cfg(
2311
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -33,13 +21,6 @@ configure_lit_site_cfg(
3321
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
3422
)
3523

36-
configure_lit_site_cfg(
37-
${CMAKE_CURRENT_SOURCE_DIR}/deploy-lit.site.cfg.py.in
38-
${CMAKE_CURRENT_BINARY_DIR}/deploy-lit.site.cfg.py
39-
MAIN_CONFIG
40-
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
41-
)
42-
4324
list(APPEND SYCL_TEST_DEPS
4425
sycl-toolchain
4526
FileCheck
@@ -49,11 +30,8 @@ list(APPEND SYCL_TEST_DEPS
4930
)
5031

5132
list(APPEND SYCL_DEPLOY_TEST_DEPS
33+
${SYCL_TEST_DEPS}
5234
deploy-sycl-toolchain
53-
FileCheck
54-
not
55-
get_device_count_by_type
56-
llvm-config
5735
)
5836

5937
add_lit_testsuite(check-sycl "Running the SYCL regression tests"
@@ -62,10 +40,13 @@ add_lit_testsuite(check-sycl "Running the SYCL regression tests"
6240
PARAMS "SYCL_BE=PI_OPENCL"
6341
DEPENDS ${SYCL_TEST_DEPS}
6442
)
43+
6544
add_lit_testsuite(check-sycl-deploy "Running the SYCL regression tests"
6645
${CMAKE_CURRENT_BINARY_DIR}
6746
ARGS ${DEPLOY_RT_TEST_ARGS}
47+
PARAMS "SYCL_BE=PI_OPENCL"
6848
DEPENDS ${SYCL_DEPLOY_TEST_DEPS}
49+
EXCLUDE_FROM_CHECK_ALL
6950
)
7051
set_target_properties(check-sycl PROPERTIES FOLDER "SYCL tests")
7152

@@ -76,7 +57,7 @@ add_lit_testsuites(SYCL ${CMAKE_CURRENT_SOURCE_DIR}
7657
if(SYCL_BUILD_PI_CUDA)
7758
add_lit_testsuite(check-sycl-cuda "Running the SYCL regression tests for CUDA"
7859
${CMAKE_CURRENT_BINARY_DIR}
79-
ARGS ${RT_TEST_ARGS}
60+
ARGS ${RT_TEST_ARGS}
8061
PARAMS "SYCL_BE=PI_CUDA"
8162
DEPENDS ${SYCL_TEST_DEPS}
8263
)

sycl/test/basic_tests/handler/interop_task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx -fsycl %s -o %t.out -lOpenCL
1+
// RUN: %clangxx -fsycl %s -o %t.out -L %opencl_libs_dir -lOpenCL
22
// RUN: %CPU_RUN_PLACEHOLDER %t.out
33
// RUN: %GPU_RUN_PLACEHOLDER %t.out
44
// REQUIRES: opencl

sycl/test/deploy-lit.site.cfg.py.in

Lines changed: 0 additions & 25 deletions
This file was deleted.

sycl/test/devicelib/assert-windows.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// XFAIL: *
66
//
77
// RUN: %clangxx -fsycl -c %s -o %t.o
8-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/../bin/libsycl-msvc.o -o %t.out
8+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/../bin/libsycl-msvc.o -o %t.out
99
//
1010
// MSVC implementation of assert does not call an unreachable built-in, so the
1111
// program doesn't terminate when fallback is used.

sycl/test/devicelib/assert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// REQUIRES: cpu,linux
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-glibc.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-glibc.o -o %t.out
44
// (see the other RUN lines below; it is a bit complicated)
55
//
66
// assert() call in device code guarantees nothing: on some devices it behaves

sycl/test/devicelib/c99_complex_math_fp64_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex-fp64.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex-fp64.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <cassert>
66
#include <complex.h>

sycl/test/devicelib/c99_complex_math_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <cassert>
66
#include <complex.h>

sycl/test/devicelib/cmath_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <iostream>
66
#include <cmath>

sycl/test/devicelib/cmath_test_fp64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath-fp64.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath-fp64.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <iostream>
66
#include <cmath>

sycl/test/devicelib/math_fp64_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath-fp64.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath-fp64.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <iostream>
66
#include <math.h>

sycl/test/devicelib/math_override_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <iostream>
66
#include <math.h>

sycl/test/devicelib/math_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-cmath.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <iostream>
66
#include <math.h>

sycl/test/devicelib/std_complex_math_fp64_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex-fp64.o %llvm_build_libs_dir/libsycl-cmath-fp64.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex-fp64.o %sycl_libs_dir/libsycl-cmath-fp64.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <cassert>
66
#include "math_utils.hpp"

sycl/test/devicelib/std_complex_math_test.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// UNSUPPORTED: windows
22
// RUN: %clangxx -fsycl -c %s -o %t.o
3-
// RUN: %clangxx -fsycl %t.o %llvm_build_libs_dir/libsycl-complex.o %llvm_build_libs_dir/libsycl-cmath.o -o %t.out
3+
// RUN: %clangxx -fsycl %t.o %sycl_libs_dir/libsycl-complex.o %sycl_libs_dir/libsycl-cmath.o -o %t.out
44
#include <CL/sycl.hpp>
55
#include <cassert>
66
#include "math_utils.hpp"

sycl/test/lit.cfg.py

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@
3838
config.available_features.add('linux')
3939
# Propagate 'LD_LIBRARY_PATH' through the environment.
4040
if 'LD_LIBRARY_PATH' in os.environ:
41-
config.environment['LD_LIBRARY_PATH'] = os.path.pathsep.join((config.environment['LD_LIBRARY_PATH'], config.llvm_build_libs_dir))
41+
config.environment['LD_LIBRARY_PATH'] = os.path.pathsep.join((config.environment['LD_LIBRARY_PATH'], config.sycl_libs_dir))
4242
else:
43-
config.environment['LD_LIBRARY_PATH'] = config.llvm_build_libs_dir
43+
config.environment['LD_LIBRARY_PATH'] = config.sycl_libs_dir
4444

4545
elif platform.system() == "Windows":
4646
config.available_features.add('windows')
4747
if 'LIB' in os.environ:
48-
config.environment['LIB'] = os.path.pathsep.join((config.environment['LIB'], config.llvm_build_libs_dir))
48+
config.environment['LIB'] = os.path.pathsep.join((config.environment['LIB'], config.sycl_libs_dir))
4949
else:
50-
config.environment['LIB'] = config.llvm_build_libs_dir
50+
config.environment['LIB'] = config.sycl_libs_dir
5151

5252
if 'PATH' in os.environ:
53-
config.environment['PATH'] = os.path.pathsep.join((config.environment['PATH'], config.llvm_build_bins_dir))
53+
config.environment['PATH'] = os.path.pathsep.join((config.environment['PATH'], config.sycl_tools_dir))
5454
else:
55-
config.environment['PATH'] = config.llvm_build_bins_dir
55+
config.environment['PATH'] = config.sycl_tools_dir
5656

5757
elif platform.system() == "Darwin":
5858
# FIXME: surely there is a more elegant way to instantiate the Xcode directories.
@@ -61,34 +61,31 @@
6161
else:
6262
config.environment['CPATH'] = "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1"
6363
config.environment['CPATH'] = os.path.pathsep.join((config.environment['CPATH'], "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/"))
64-
config.environment['DYLD_LIBRARY_PATH'] = config.llvm_build_libs_dir
64+
config.environment['DYLD_LIBRARY_PATH'] = config.sycl_libs_dir
6565

6666
# propagate the environment variable OCL_ICD_FILANEMES to use proper runtime.
6767
if 'OCL_ICD_FILENAMES' in os.environ:
6868
config.environment['OCL_ICD_FILENAMES'] = os.environ['OCL_ICD_FILENAMES']
6969

70-
config.substitutions.append( ('%clang_cc1', ' ' + config.clang + ' -cc1 ') )
71-
config.substitutions.append( ('%clangxx', ' ' + config.clangxx ) )
72-
config.substitutions.append( ('%clang_cl', ' ' + config.clang_cl ) )
73-
config.substitutions.append( ('%clang', ' ' + config.clang ) )
74-
config.substitutions.append( ('%llvm_build_libs_dir', config.llvm_build_libs_dir ) )
70+
config.substitutions.append( ('%sycl_libs_dir', config.sycl_libs_dir ) )
7571
config.substitutions.append( ('%sycl_include', config.sycl_include ) )
7672
config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) )
7773
config.substitutions.append( ('%sycl_source_dir', config.sycl_source_dir) )
7874

75+
llvm_config.use_clang()
76+
7977
tools = ['llvm-spirv']
80-
tool_dirs = [config.llvm_tools_dir]
78+
tool_dirs = [config.sycl_tools_dir]
8179
llvm_config.add_tool_substitutions(tools, tool_dirs)
8280

8381
if "opencl-aot" in config.llvm_enable_projects:
8482
if 'PATH' in os.environ:
8583
print("Adding path to opencl-aot tool to PATH")
86-
os.environ['PATH'] = os.path.pathsep.join((os.getenv('PATH'), config.llvm_build_bins_dir))
84+
os.environ['PATH'] = os.path.pathsep.join((os.getenv('PATH'), config.sycl_tools_dir))
8785

8886
backend=lit_config.params.get('SYCL_BE', "PI_OPENCL")
8987

90-
get_device_count_by_type_path = os.path.join(config.llvm_binary_dir,
91-
"bin", "get_device_count_by_type")
88+
get_device_count_by_type_path = os.path.join(config.llvm_tools_dir, "get_device_count_by_type")
9289

9390
def getDeviceCount(device_type):
9491
is_cuda = False;
@@ -186,7 +183,7 @@ def getDeviceCount(device_type):
186183

187184

188185
path = config.environment['PATH']
189-
path = os.path.pathsep.join((config.llvm_tools_dir, path))
186+
path = os.path.pathsep.join((config.sycl_tools_dir, path))
190187
config.environment['PATH'] = path
191188

192189
# Device AOT compilation tools aren't part of the SYCL project,

sycl/test/lit.site.cfg.py.in

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
import sys
44

5-
config.clang = "@CLANG_IN_BUILD@"
6-
config.clangxx = "@CLANGXX_IN_BUILD@"
7-
config.clang_cl = "@CLANGCL_IN_BUILD@"
85
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
6+
config.sycl_tools_dir = lit_config.params.get('SYCL_TOOLS_DIR', "@LLVM_TOOLS_DIR@")
97
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
10-
config.llvm_build_libs_dir = "@LLVM_BUILD_LIBRARY_DIRS@"
11-
config.llvm_build_bins_dir = "@LLVM_BUILD_BINARY_DIRS@"
12-
config.llvm_binary_dir = "@LLVM_BINARY_DIR@"
13-
config.sycl_include = "@SYCL_INCLUDE@"
8+
config.sycl_include = lit_config.params.get('SYCL_INCLUDE', "@SYCL_INCLUDE@")
149
config.sycl_obj_root = "@SYCL_BINARY_DIR@"
1510
config.sycl_source_dir = "@SYCL_SOURCE_DIR@/source"
1611
config.opencl_libs_dir = os.path.dirname("@OpenCL_LIBRARIES@")
12+
config.sycl_libs_dir = lit_config.params.get('SYCL_LIBS_DIR', "@LLVM_LIBS_DIR@")
13+
config.target_triple = "@TARGET_TRIPLE@"
14+
config.host_triple = "@LLVM_HOST_TRIPLE@"
1715

1816
config.llvm_enable_projects = "@LLVM_ENABLE_PROJECTS@"
1917

0 commit comments

Comments
 (0)