Skip to content

Commit 8e848cb

Browse files
authored
[SYCL] Move Device Config File test from Unit tests to lit tests. (intel#10456)
This test requires an autogenerated file (DeviceConfigFile.inc) to be present at the time of its compilation, and it was possible in some scenarios that the autogenerated file wasn't generated before the compilation of the test, resulting in an error. Moving the test to `sycl/test` should prevent that from happening. --------- Signed-off-by: Maronas, Marcos <[email protected]>
1 parent aedbb04 commit 8e848cb

File tree

4 files changed

+9
-18
lines changed

4 files changed

+9
-18
lines changed

sycl/unittests/SYCL2020/DeviceConfigFileAspects.cpp renamed to sycl/test/basic_tests/device_config_file_aspects.cpp

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
1-
//==- DeviceConfigFileAspects.cpp --- Device config file aspects unit test -==//
2-
//
3-
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4-
// See https://llvm.org/LICENSE.txt for license information.
5-
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6-
//
7-
//===----------------------------------------------------------------------===//
1+
// RUN: %clangxx -fsycl %s -o %t.out -I %llvm_main_include_dir
2+
// RUN: %t.out
83
//
94
#include <map>
105

116
#include <llvm/ADT/StringRef.h>
127
#include <llvm/SYCLLowerIR/DeviceConfigFile.hpp>
138
#include <sycl/sycl.hpp>
149

15-
#include <helpers/PiMock.hpp>
16-
17-
#include <gtest/gtest.h>
18-
1910
#define __SYCL_ASPECT_DEPRECATED_ALIAS(ASPECT, ID, MESSAGE) \
2011
__SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE)
2112

22-
TEST(DeviceConfigFile, DeviceConfigFileAspects) {
13+
int main() {
2314
auto testAspects = DeviceConfigFile::TargetTable.find("__TestAspectList");
2415
assert(testAspects != DeviceConfigFile::TargetTable.end());
2516
auto aspectsList = testAspects->second.aspects;
2617

2718
#define __SYCL_ASPECT(ASPECT, ASPECT_VAL) \
2819
llvm::StringRef s##ASPECT(#ASPECT); \
29-
EXPECT_TRUE(std::find(aspectsList.begin(), aspectsList.end(), s##ASPECT) != \
30-
aspectsList.end());
20+
assert(std::find(aspectsList.begin(), aspectsList.end(), s##ASPECT) != \
21+
aspectsList.end());
3122

3223
#include <sycl/info/aspects.def>
3324

@@ -39,9 +30,8 @@ TEST(DeviceConfigFile, DeviceConfigFileAspects) {
3930
auto deprecatedAspectsList = testDeprecatedAspects->second.aspects;
4031
#define __SYCL_ASPECT_DEPRECATED(ASPECT, ASPECT_VAL, MSG) \
4132
llvm::StringRef s##ASPECT(#ASPECT); \
42-
EXPECT_TRUE(std::find(deprecatedAspectsList.begin(), \
43-
deprecatedAspectsList.end(), \
44-
s##ASPECT) != deprecatedAspectsList.end());
33+
assert(std::find(deprecatedAspectsList.begin(), deprecatedAspectsList.end(), \
34+
s##ASPECT) != deprecatedAspectsList.end());
4535

4636
#include <sycl/info/aspects_deprecated.def>
4737

sycl/test/lit.cfg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
config.substitutions.append( ('%sycl_libs_dir', config.sycl_libs_dir ) )
8686
config.substitutions.append( ('%sycl_include', config.sycl_include ) )
8787
config.substitutions.append( ('%sycl_source_dir', config.sycl_source_dir) )
88+
config.substitutions.append( ('%llvm_main_include_dir', config.llvm_main_include_dir) )
8889
config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) )
8990
config.substitutions.append( ('%level_zero_include_dir', config.level_zero_include_dir) )
9091
config.substitutions.append( ('%opencl_include_dir', config.opencl_include_dir) )

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import sys
44

5+
config.llvm_main_include_dir = "@LLVM_MAIN_INCLUDE_DIR@"
56
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
67
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
78
config.sycl_tools_dir = lit_config.params.get('SYCL_TOOLS_DIR', "@LLVM_TOOLS_DIR@")

sycl/unittests/SYCL2020/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,5 @@ add_sycl_unittest(SYCL2020Tests OBJECT
1313
AtomicMemoryOrderCapabilities.cpp
1414
AtomicMemoryScopeCapabilities.cpp
1515
AtomicFenceCapabilities.cpp
16-
DeviceConfigFileAspects.cpp
1716
)
1817

0 commit comments

Comments
 (0)