Skip to content

[SYCL] Move Device Config File test from Unit tests to lit tests. #10456

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,33 +1,24 @@
//==- DeviceConfigFileAspects.cpp --- Device config file aspects unit test -==//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
// RUN: %clangxx -fsycl %s -o %t.out -I %llvm_main_include_dir
// RUN: %t.out
//
#include <map>

#include <llvm/ADT/StringRef.h>
#include <llvm/SYCLLowerIR/DeviceConfigFile.hpp>
#include <sycl/sycl.hpp>

#include <helpers/PiMock.hpp>

#include <gtest/gtest.h>

#define __SYCL_ASPECT_DEPRECATED_ALIAS(ASPECT, ID, MESSAGE) \
__SYCL_ASPECT_DEPRECATED(ASPECT, ID, MESSAGE)

TEST(DeviceConfigFile, DeviceConfigFileAspects) {
int main() {
auto testAspects = DeviceConfigFile::TargetTable.find("__TestAspectList");
assert(testAspects != DeviceConfigFile::TargetTable.end());
auto aspectsList = testAspects->second.aspects;

#define __SYCL_ASPECT(ASPECT, ASPECT_VAL) \
llvm::StringRef s##ASPECT(#ASPECT); \
EXPECT_TRUE(std::find(aspectsList.begin(), aspectsList.end(), s##ASPECT) != \
aspectsList.end());
assert(std::find(aspectsList.begin(), aspectsList.end(), s##ASPECT) != \
aspectsList.end());

#include <sycl/info/aspects.def>

Expand All @@ -39,9 +30,8 @@ TEST(DeviceConfigFile, DeviceConfigFileAspects) {
auto deprecatedAspectsList = testDeprecatedAspects->second.aspects;
#define __SYCL_ASPECT_DEPRECATED(ASPECT, ASPECT_VAL, MSG) \
llvm::StringRef s##ASPECT(#ASPECT); \
EXPECT_TRUE(std::find(deprecatedAspectsList.begin(), \
deprecatedAspectsList.end(), \
s##ASPECT) != deprecatedAspectsList.end());
assert(std::find(deprecatedAspectsList.begin(), deprecatedAspectsList.end(), \
s##ASPECT) != deprecatedAspectsList.end());

#include <sycl/info/aspects_deprecated.def>

Expand Down
1 change: 1 addition & 0 deletions sycl/test/lit.cfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
config.substitutions.append( ('%sycl_libs_dir', config.sycl_libs_dir ) )
config.substitutions.append( ('%sycl_include', config.sycl_include ) )
config.substitutions.append( ('%sycl_source_dir', config.sycl_source_dir) )
config.substitutions.append( ('%llvm_main_include_dir', config.llvm_main_include_dir) )
config.substitutions.append( ('%opencl_libs_dir', config.opencl_libs_dir) )
config.substitutions.append( ('%level_zero_include_dir', config.level_zero_include_dir) )
config.substitutions.append( ('%opencl_include_dir', config.opencl_include_dir) )
Expand Down
1 change: 1 addition & 0 deletions sycl/test/lit.site.cfg.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import sys

config.llvm_main_include_dir = "@LLVM_MAIN_INCLUDE_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.sycl_tools_dir = lit_config.params.get('SYCL_TOOLS_DIR', "@LLVM_TOOLS_DIR@")
Expand Down
1 change: 0 additions & 1 deletion sycl/unittests/SYCL2020/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ add_sycl_unittest(SYCL2020Tests OBJECT
AtomicMemoryOrderCapabilities.cpp
AtomicMemoryScopeCapabilities.cpp
AtomicFenceCapabilities.cpp
DeviceConfigFileAspects.cpp
)