Skip to content
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

[SYCLomatic #1311]Add behavior test for incorrect compilation database generation of intercept-build tool #474

Merged
merged 3 commits into from
Oct 11, 2023
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
1 change: 1 addition & 0 deletions behavior_tests/behavior_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
<test testName="ngt-invalid-cuda-include-path" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="bt-empty-cdb-default-out-folder" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="cannot-acc-dir-in-db" configFile="config/TEMPLATE_behavior_tests_lin.xml" />
<test testName="process_optf_option" configFile="config/TEMPLATE_behavior_tests_lin.xml" />
<test testName="ngt-invalid-yaml-for-format1" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="ngt-invalid-yaml-for-format2" configFile="config/TEMPLATE_behavior_tests.xml" />
<test testName="ngt-invalid-yaml-for-format3" configFile="config/TEMPLATE_behavior_tests.xml" />
Expand Down
40 changes: 40 additions & 0 deletions behavior_tests/src/process_optf_option/do_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# ====------ do_test.py---------- *- Python -* ----===##
#
# 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
#
#
# ===----------------------------------------------------------------------===#
import subprocess
import platform
import os
import sys

from test_utils import *

def setup_test():
return True

def migrate_test():
change_dir('process_optf_option/use_optf_option_case')
call_subprocess('intercept-build /usr/bin/make')
call_subprocess(test_config.CT_TOOL + ' -in-root ./ -out-root out -gen-build-script -p ./compile_commands.json --cuda-include-path=' + \
os.environ['CUDA_INCLUDE_PATH'])
change_dir("./out")
call_subprocess("make -f Makefile.dpct -B")


if os.path.isfile("./test1.dp.o") and os.path.isfile("./test1.dp.o"):
print("process_optf_option migrate pass")
return True
else:
print("process_optf_option migrate failed")
return False


def build_test():
return True

def run_test():
return True
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
all:test

test:test1.o test2.o

test1.o:test1.cu
nvcc -c test1.cu --options-file=./includes1.rsp -optf=./includes2.rsp --options-file ./includes3.rsp -optf ./includes4.rsp

test2.o:test2.cu
cd inner && nvcc -c ../test2.cu



clean:
-rm inner/test2.o test1.o
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-D__FOO1__ -I"./inc/inc1"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-D__FOO2__ -I"./inc/inc2"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-D__FOO3__ -I"./inc/inc3"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-D__FOO4__ -I"./inc/inc4"
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// ====------ test1.cu---------------------------------- *- CUDA -* ----===////
//
// 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
//
//
// ===----------------------------------------------------------------------===//

#include <cuda.h>

#ifdef __FOO1__
__global__ void foo1() {}
#endif

#ifdef __FOO2__
__global__ void foo2() {}
#endif

#ifdef __FOO3__
__global__ void foo3() {}
#endif

#ifdef __FOO4__
__global__ void foo4() {}
#endif

#include "foo1.h"
#include "foo2.h"
#include "foo3.h"
#include "foo4.h"

int main() { return 0; }
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// ====------ test2.cu---------------------------------- *- CUDA -* ----===////
//
// 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
//
//
// ===----------------------------------------------------------------------===//

#ifdef __FOO__
__global__ void foo() {}
#endif
Loading