From e8a1fca8cc497c7cc08fa7afb79a36ca54ede1bf Mon Sep 17 00:00:00 2001 From: Teja Alaghari Date: Tue, 7 Jan 2025 13:37:34 +0800 Subject: [PATCH] Corrected format and refiend test logic --- .../DPCT/MigrateScript/MigrateBuildScript.h | 2 +- .../case_001/src/compile_commands.json | 2 +- .../case_001/case_001_framework.cpp | 48 +++++++++---------- .../case_002/case_002_import_torch_ext.cpp | 12 ++--- .../case_003/case_003_torch_classes.cpp | 12 ++--- .../case_004/case_004_cuda_src_ext.cpp | 12 ++--- .../case_005/case_005_setup.cpp | 10 ++-- .../case_006/case_006_torch_cuda.cpp | 10 ++-- .../case_007/case_007_test_extension_name.cpp | 10 ++-- .../case_008/case_008_comments.cpp | 10 ++-- .../case_009/case_009_cpp_extension.cpp | 10 ++-- 11 files changed, 69 insertions(+), 69 deletions(-) diff --git a/clang/lib/DPCT/MigrateScript/MigrateBuildScript.h b/clang/lib/DPCT/MigrateScript/MigrateBuildScript.h index 0909fa5bb0de..3c775c6bd2aa 100644 --- a/clang/lib/DPCT/MigrateScript/MigrateBuildScript.h +++ b/clang/lib/DPCT/MigrateScript/MigrateBuildScript.h @@ -52,4 +52,4 @@ void unifyInputFileFormat( } // namespace dpct } // namespace clang -#endif //!DPCT_MIGRATE_BUILD_SCRIPT_H +#endif //! DPCT_MIGRATE_BUILD_SCRIPT_H diff --git a/clang/test/dpct/cmake_migration/case_001/src/compile_commands.json b/clang/test/dpct/cmake_migration/case_001/src/compile_commands.json index b82c807c31f5..73d990fad6d9 100644 --- a/clang/test/dpct/cmake_migration/case_001/src/compile_commands.json +++ b/clang/test/dpct/cmake_migration/case_001/src/compile_commands.json @@ -4,4 +4,4 @@ "directory": "./", "file": "./input.cu" } -] \ No newline at end of file +] diff --git a/clang/test/dpct/python_migration/case_001/case_001_framework.cpp b/clang/test/dpct/python_migration/case_001/case_001_framework.cpp index f6be5253bd48..4878f507e283 100644 --- a/clang/test/dpct/python_migration/case_001/case_001_framework.cpp +++ b/clang/test/dpct/python_migration/case_001/case_001_framework.cpp @@ -6,49 +6,49 @@ // RUN: cp %S/src/compile_commands.json ./compile_commands.json // RUN: dpct -in-root ./ -out-root out_pytorch_1 --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_python_pytorch_1.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch_1/input.py >> %T/diff_python_pytorch_1.txt -// RUN: echo "end" >> %T/diff_python_pytorch_1.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch_1/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_pytorch_2 --migrate-build-script-only --migrate-build-script=CMake,Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_python_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch_2/input.py >> %T/diff_python_pytorch.txt -// RUN: echo "end" >> %T/diff_python_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch_2/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end -// RUN: echo "begin" > %T/diff_cmake_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected.cmake %T/out_pytorch_2/input.cmake >> %T/diff_cmake_pytorch.txt -// RUN: echo "end" >> %T/diff_cmake_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected.cmake %T/out_pytorch_2/input.cmake >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex_1 --cuda-include-path="%cuda-path/include" --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml -p ./ -// RUN: echo "begin" > %T/diff_python_ipex.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex_1/input.py >> %T/diff_python_ipex.txt -// RUN: echo "end" >> %T/diff_python_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex_1/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end -// RUN: echo "begin" > %T/diff_src_ipex.txt -// RUN: diff --strip-trailing-cr %S/src/expected.cpp.txt %T/out_ipex_1/input.dp.cpp >> %T/diff_src_ipex.txt -// RUN: echo "end" >> %T/diff_src_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/src/expected.cpp.txt %T/out_ipex_1/input.dp.cpp >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex_2 --cuda-include-path="%cuda-path/include" --migrate-build-script=CMake,Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml -p ./ -// RUN: echo "begin" > %T/diff_python_ipex.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex_2/input.py >> %T/diff_python_ipex.txt -// RUN: echo "end" >> %T/diff_python_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex_2/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end -// RUN: echo "begin" > %T/diff_cmake_ipex.txt -// RUN: diff --strip-trailing-cr %S/expected.cmake %T/out_ipex_2/input.cmake >> %T/diff_cmake_ipex.txt -// RUN: echo "end" >> %T/diff_cmake_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected.cmake %T/out_ipex_2/input.cmake >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end -// RUN: echo "begin" > %T/diff_src_ipex.txt -// RUN: diff --strip-trailing-cr %S/src/expected.cpp.txt %T/out_ipex_2/input.dp.cpp >> %T/diff_src_ipex.txt -// RUN: echo "end" >> %T/diff_src_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/src/expected.cpp.txt %T/out_ipex_2/input.dp.cpp >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_002/case_002_import_torch_ext.cpp b/clang/test/dpct/python_migration/case_002/case_002_import_torch_ext.cpp index e832dcef3c6c..d866309333c8 100644 --- a/clang/test/dpct/python_migration/case_002/case_002_import_torch_ext.cpp +++ b/clang/test/dpct/python_migration/case_002/case_002_import_torch_ext.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml -// RUN: echo "begin" > %T/diff_ipex.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_003/case_003_torch_classes.cpp b/clang/test/dpct/python_migration/case_003/case_003_torch_classes.cpp index e832dcef3c6c..d866309333c8 100644 --- a/clang/test/dpct/python_migration/case_003/case_003_torch_classes.cpp +++ b/clang/test/dpct/python_migration/case_003/case_003_torch_classes.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml -// RUN: echo "begin" > %T/diff_ipex.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_004/case_004_cuda_src_ext.cpp b/clang/test/dpct/python_migration/case_004/case_004_cuda_src_ext.cpp index 49353daed9cd..39c94009eeca 100644 --- a/clang/test/dpct/python_migration/case_004/case_004_cuda_src_ext.cpp +++ b/clang/test/dpct/python_migration/case_004/case_004_cuda_src_ext.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml -// RUN: echo "begin" > %T/diff_ipex.txt -// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_005/case_005_setup.cpp b/clang/test/dpct/python_migration/case_005/case_005_setup.cpp index c66c4975132d..d866309333c8 100644 --- a/clang/test/dpct/python_migration/case_005/case_005_setup.cpp +++ b/clang/test/dpct/python_migration/case_005/case_005_setup.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml // RUN: echo "begin" > %T/diff.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_006/case_006_torch_cuda.cpp b/clang/test/dpct/python_migration/case_006/case_006_torch_cuda.cpp index 38e8305da6be..39c94009eeca 100644 --- a/clang/test/dpct/python_migration/case_006/case_006_torch_cuda.cpp +++ b/clang/test/dpct/python_migration/case_006/case_006_torch_cuda.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml // RUN: echo "begin" > %T/diff.txt -// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_007/case_007_test_extension_name.cpp b/clang/test/dpct/python_migration/case_007/case_007_test_extension_name.cpp index 8d096ad998eb..1b0ce6c936ec 100644 --- a/clang/test/dpct/python_migration/case_007/case_007_test_extension_name.cpp +++ b/clang/test/dpct/python_migration/case_007/case_007_test_extension_name.cpp @@ -7,15 +7,15 @@ // RUN: cp %S/MainSourceFiles.yaml ./out_ipex/MainSourceFiles.yaml // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml // RUN: echo "begin" > %T/diff.txt -// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: diff --strip-trailing-cr %S/expected.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_008/case_008_comments.cpp b/clang/test/dpct/python_migration/case_008/case_008_comments.cpp index c66c4975132d..d866309333c8 100644 --- a/clang/test/dpct/python_migration/case_008/case_008_comments.cpp +++ b/clang/test/dpct/python_migration/case_008/case_008_comments.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml // RUN: echo "begin" > %T/diff.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end diff --git a/clang/test/dpct/python_migration/case_009/case_009_cpp_extension.cpp b/clang/test/dpct/python_migration/case_009/case_009_cpp_extension.cpp index c66c4975132d..d866309333c8 100644 --- a/clang/test/dpct/python_migration/case_009/case_009_cpp_extension.cpp +++ b/clang/test/dpct/python_migration/case_009/case_009_cpp_extension.cpp @@ -3,15 +3,15 @@ // RUN: cp %S/input.py ./input.py // RUN: dpct -in-root ./ -out-root out_pytorch ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_pytorch.yaml -// RUN: echo "begin" > %T/diff_pytorch.txt -// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff_pytorch.txt -// RUN: echo "end" >> %T/diff_pytorch.txt +// RUN: echo "begin" > %T/diff.txt +// RUN: diff --strip-trailing-cr %S/expected_pytorch.py %T/out_pytorch/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end // RUN: dpct -in-root ./ -out-root out_ipex ./input.py --migrate-build-script-only --migrate-build-script=Python --rule-file=%T/../../../../../../../extensions/python_rules/python_build_script_migration_rule_ipex.yaml // RUN: echo "begin" > %T/diff.txt -// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff_ipex.txt -// RUN: echo "end" >> %T/diff_ipex.txt +// RUN: diff --strip-trailing-cr %S/expected_ipex.py %T/out_ipex/input.py >> %T/diff.txt +// RUN: echo "end" >> %T/diff.txt // CHECK: begin // CHECK-NEXT: end