From 7c376c53f28cc4a3242ed237c66fb373c4624b11 Mon Sep 17 00:00:00 2001 From: "Ahmed, Daiyaan" Date: Fri, 5 Jan 2024 01:15:22 +0800 Subject: [PATCH] [SYCLomatic] Remove invalid json test for standard compilation db fields Signed-off-by: Ahmed, Daiyaan --- behavior_tests/behavior_tests.xml | 2 - .../ngt-invalid-json10/compile_commands.json | 7 --- .../src/ngt-invalid-json10/do_test.py | 41 ---------------- .../src/ngt-invalid-json10/hello1.c | 11 ----- .../ngt-invalid-json7/compile_commands.json | 5 +- .../src/ngt-invalid-json7/do_test.py | 11 +++-- .../hello2.c | 0 .../ngt-invalid-json8/compile_commands.json | 2 +- .../src/ngt-invalid-json8/do_test.py | 4 +- .../ngt-invalid-json9/compile_commands.json | 10 ---- .../src/ngt-invalid-json9/do_test.py | 47 ------------------- behavior_tests/src/ngt-invalid-json9/hello1.c | 11 ----- 12 files changed, 14 insertions(+), 137 deletions(-) delete mode 100644 behavior_tests/src/ngt-invalid-json10/compile_commands.json delete mode 100644 behavior_tests/src/ngt-invalid-json10/do_test.py delete mode 100644 behavior_tests/src/ngt-invalid-json10/hello1.c rename behavior_tests/src/{ngt-invalid-json9 => ngt-invalid-json7}/hello2.c (100%) delete mode 100644 behavior_tests/src/ngt-invalid-json9/compile_commands.json delete mode 100644 behavior_tests/src/ngt-invalid-json9/do_test.py delete mode 100644 behavior_tests/src/ngt-invalid-json9/hello1.c diff --git a/behavior_tests/behavior_tests.xml b/behavior_tests/behavior_tests.xml index 6847ad783..c30174987 100644 --- a/behavior_tests/behavior_tests.xml +++ b/behavior_tests/behavior_tests.xml @@ -80,8 +80,6 @@ - - diff --git a/behavior_tests/src/ngt-invalid-json10/compile_commands.json b/behavior_tests/src/ngt-invalid-json10/compile_commands.json deleted file mode 100644 index 1c1d9347d..000000000 --- a/behavior_tests/src/ngt-invalid-json10/compile_commands.json +++ /dev/null @@ -1,7 +0,0 @@ -[ - { - "command": "nvcc hello1.c", - "directory": "directory_placeholder", - "file": "" - } -] diff --git a/behavior_tests/src/ngt-invalid-json10/do_test.py b/behavior_tests/src/ngt-invalid-json10/do_test.py deleted file mode 100644 index fdd11e4ef..000000000 --- a/behavior_tests/src/ngt-invalid-json10/do_test.py +++ /dev/null @@ -1,41 +0,0 @@ -# ====------ 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_config import CT_TOOL - -from test_utils import * - -def setup_test(): - change_dir(test_config.current_test) - return True - -def migrate_test(): - data = [] - ret = [] - with open("compile_commands.json", 'r') as f: - data = f.readlines() - for line in data: - line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) - ret.append(line) - with open("compile_commands.json", 'w') as f: - f.writelines(ret) - - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", test_config.command_output) - - -def build_test(): - return True - -def run_test(): - return True - diff --git a/behavior_tests/src/ngt-invalid-json10/hello1.c b/behavior_tests/src/ngt-invalid-json10/hello1.c deleted file mode 100644 index fd7a1732e..000000000 --- a/behavior_tests/src/ngt-invalid-json10/hello1.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "cuda_runtime.h" - -__global__ void k(){} - -int main() { - float2 f2; - - k<<<1,1>>>(); - - return 0; -} diff --git a/behavior_tests/src/ngt-invalid-json7/compile_commands.json b/behavior_tests/src/ngt-invalid-json7/compile_commands.json index f860c2904..46bf0c975 100644 --- a/behavior_tests/src/ngt-invalid-json7/compile_commands.json +++ b/behavior_tests/src/ngt-invalid-json7/compile_commands.json @@ -2,6 +2,9 @@ { "command": "nvcc hello1.c", "directory": "directory_placeholder", - "file": "hello1.c" + "file": "hello1.c", + "command": "nvcc hello2.c", + "directory": "directory_placeholder", + "file": "hello2.c" } ] diff --git a/behavior_tests/src/ngt-invalid-json7/do_test.py b/behavior_tests/src/ngt-invalid-json7/do_test.py index 09b55d9e1..e051635d1 100644 --- a/behavior_tests/src/ngt-invalid-json7/do_test.py +++ b/behavior_tests/src/ngt-invalid-json7/do_test.py @@ -21,18 +21,22 @@ def setup_test(): def migrate_test(): data = [] ret = [] + iter = 0 with open("compile_commands.json", 'r') as f: data = f.readlines() for line in data: + if iter == 1: + line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) if "directory_placeholder" in line: - ret.append(" \"output\": \"aaaaa\",\n") - line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) + iter += 1 + ret.append(line) with open("compile_commands.json", 'w') as f: f.writelines(ret) call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Unknown key: \"\"output\"\"", test_config.command_output) + return is_sub_string("Processed 1 file(s)", test_config.command_output) + def build_test(): return True @@ -40,3 +44,4 @@ def build_test(): def run_test(): return True + diff --git a/behavior_tests/src/ngt-invalid-json9/hello2.c b/behavior_tests/src/ngt-invalid-json7/hello2.c similarity index 100% rename from behavior_tests/src/ngt-invalid-json9/hello2.c rename to behavior_tests/src/ngt-invalid-json7/hello2.c diff --git a/behavior_tests/src/ngt-invalid-json8/compile_commands.json b/behavior_tests/src/ngt-invalid-json8/compile_commands.json index f860c2904..1c1d9347d 100644 --- a/behavior_tests/src/ngt-invalid-json8/compile_commands.json +++ b/behavior_tests/src/ngt-invalid-json8/compile_commands.json @@ -2,6 +2,6 @@ { "command": "nvcc hello1.c", "directory": "directory_placeholder", - "file": "hello1.c" + "file": "" } ] diff --git a/behavior_tests/src/ngt-invalid-json8/do_test.py b/behavior_tests/src/ngt-invalid-json8/do_test.py index eed7182e4..fdd11e4ef 100644 --- a/behavior_tests/src/ngt-invalid-json8/do_test.py +++ b/behavior_tests/src/ngt-invalid-json8/do_test.py @@ -24,15 +24,13 @@ def migrate_test(): with open("compile_commands.json", 'r') as f: data = f.readlines() for line in data: - if "directory_placeholder" in line: - ret.append(" \"arguments\": [\"nvcc hello_aaa.c\"],\n") line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) ret.append(line) with open("compile_commands.json", 'w') as f: f.writelines(ret) call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Unknown key: \"\"arguments\"\"", test_config.command_output) + return is_sub_string("The file name(s) in the \"command\" and \"file\" fields of the compilation database are inconsistent", test_config.command_output) def build_test(): diff --git a/behavior_tests/src/ngt-invalid-json9/compile_commands.json b/behavior_tests/src/ngt-invalid-json9/compile_commands.json deleted file mode 100644 index 46bf0c975..000000000 --- a/behavior_tests/src/ngt-invalid-json9/compile_commands.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - { - "command": "nvcc hello1.c", - "directory": "directory_placeholder", - "file": "hello1.c", - "command": "nvcc hello2.c", - "directory": "directory_placeholder", - "file": "hello2.c" - } -] diff --git a/behavior_tests/src/ngt-invalid-json9/do_test.py b/behavior_tests/src/ngt-invalid-json9/do_test.py deleted file mode 100644 index e051635d1..000000000 --- a/behavior_tests/src/ngt-invalid-json9/do_test.py +++ /dev/null @@ -1,47 +0,0 @@ -# ====------ 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_config import CT_TOOL - -from test_utils import * - -def setup_test(): - change_dir(test_config.current_test) - return True - -def migrate_test(): - data = [] - ret = [] - iter = 0 - with open("compile_commands.json", 'r') as f: - data = f.readlines() - for line in data: - if iter == 1: - line = line.replace("directory_placeholder", os.getcwd().replace("\\", "\\\\")) - if "directory_placeholder" in line: - iter += 1 - - ret.append(line) - with open("compile_commands.json", 'w') as f: - f.writelines(ret) - - call_subprocess(test_config.CT_TOOL + ' -p=./ --cuda-include-path=' + test_config.include_path) - return is_sub_string("Processed 1 file(s)", test_config.command_output) - - -def build_test(): - return True - -def run_test(): - return True - - diff --git a/behavior_tests/src/ngt-invalid-json9/hello1.c b/behavior_tests/src/ngt-invalid-json9/hello1.c deleted file mode 100644 index fd7a1732e..000000000 --- a/behavior_tests/src/ngt-invalid-json9/hello1.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "cuda_runtime.h" - -__global__ void k(){} - -int main() { - float2 f2; - - k<<<1,1>>>(); - - return 0; -}