Skip to content

Commit

Permalink
[SYCLomatic #1247] Split the check of query-api-mapping to code pieces.
Browse files Browse the repository at this point in the history
Signed-off-by: Tang, Jiajun [email protected]
  • Loading branch information
tangjj11 committed Aug 31, 2023
1 parent 445df57 commit a7a4a87
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions behavior_tests/src/query-api-mapping/do_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def setup_test():
return True


def check(expect):
if expect not in test_config.command_output:
print("'", expect, "' is not int the output")
return False
return True


def test_api(api_name, source_code, options, migrated_code):
call_subprocess(
test_config.CT_TOOL
Expand All @@ -23,22 +30,22 @@ def test_api(api_name, source_code, options, migrated_code):
+ " --query-api-mapping="
+ api_name
)
expect = "CUDA API:\n"
ret = check("CUDA API:")
for code in source_code:
expect += code + "\n"
expect += "Is migrated to"
ret &= check(code)
expect = "Is migrated to"
if options.__len__() > 0:
expect += " (with the option"
for option in options:
expect += " " + option
expect += ")"
expect += ":\n"
expect += ":"
ret &= check(expect)
for code in migrated_code:
expect += code + "\n"
if expect != test_config.command_output:
ret &= check(code)
if not ret:
print("API query message check failed: ", api_name)
print("output:\n", test_config.command_output, "===end===\n")
print("expect:\n", expect, "===end===\n")
return False
print("API query message check passed: ", api_name)
return True
Expand Down Expand Up @@ -72,7 +79,9 @@ def migrate_test():
" c /*float **/, ldc /*int*/);",
],
[],
[" oneapi::mkl::blas::column_major::gemm(*handle, transa, transb, m, n, k, dpct::get_value(alpha, *handle), a, lda, b, ldb, dpct::get_value(beta, *handle), c, ldc);"],
[
" oneapi::mkl::blas::column_major::gemm(*handle, transa, transb, m, n, k, dpct::get_value(alpha, *handle), a, lda, b, ldb, dpct::get_value(beta, *handle), c, ldc);"
],
],
]

Expand Down

0 comments on commit a7a4a87

Please sign in to comment.