-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SYCLomatic #1311]Add behavior test for incorrect compilation databas…
…e generation when source file builds with "-optf" of intercept-build tool (#474) Signed-off-by: chenwei.sun <[email protected]>
- Loading branch information
Showing
13 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
14 changes: 14 additions & 0 deletions
14
behavior_tests/src/process_optf_option/use_optf_option_case/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions
1
behavior_tests/src/process_optf_option/use_optf_option_case/includes1.rsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-D__FOO1__ -I"./inc/inc1" |
1 change: 1 addition & 0 deletions
1
behavior_tests/src/process_optf_option/use_optf_option_case/includes2.rsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-D__FOO2__ -I"./inc/inc2" |
1 change: 1 addition & 0 deletions
1
behavior_tests/src/process_optf_option/use_optf_option_case/includes3.rsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-D__FOO3__ -I"./inc/inc3" |
1 change: 1 addition & 0 deletions
1
behavior_tests/src/process_optf_option/use_optf_option_case/includes4.rsp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
-D__FOO4__ -I"./inc/inc4" |
33 changes: 33 additions & 0 deletions
33
behavior_tests/src/process_optf_option/use_optf_option_case/test1.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; } |
12 changes: 12 additions & 0 deletions
12
behavior_tests/src/process_optf_option/use_optf_option_case/test2.cu
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |