-
Notifications
You must be signed in to change notification settings - Fork 30
Fix/crashes reported in 345 344 #349
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
Merged
diptorupd
merged 3 commits into
IntelPython:master
from
diptorupd:fix/crashes_reported_in_345_344
Apr 1, 2021
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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,67 @@ | ||
//===--- test_sycl_device_invalid_filters.cpp - -ve tests for device iface ===// | ||
// | ||
// Data Parallel Control (dpctl) | ||
// | ||
// Copyright 2020-2021 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// \file | ||
/// Negative test cases for SYCL device creation with invalid filter selectors. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "dpctl_sycl_device_interface.h" | ||
#include "dpctl_sycl_device_selector_interface.h" | ||
#include <CL/sycl.hpp> | ||
#include <gtest/gtest.h> | ||
|
||
using namespace cl::sycl; | ||
struct TestUnsupportedFilters : public ::testing::TestWithParam<const char *> | ||
{ | ||
DPCTLSyclDeviceSelectorRef DSRef = nullptr; | ||
|
||
TestUnsupportedFilters() | ||
{ | ||
EXPECT_NO_FATAL_FAILURE(DSRef = DPCTLFilterSelector_Create(GetParam())); | ||
} | ||
|
||
void SetUp() | ||
{ | ||
if (!DSRef) { | ||
auto message = "Skipping as no device of type " + | ||
std::string(GetParam()) + "."; | ||
GTEST_SKIP_(message.c_str()); | ||
} | ||
} | ||
|
||
~TestUnsupportedFilters() | ||
{ | ||
EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef)); | ||
} | ||
}; | ||
|
||
TEST_P(TestUnsupportedFilters, Chk_DPCTLDevice_CreateFromSelector) | ||
{ | ||
DPCTLSyclDeviceRef DRef = nullptr; | ||
EXPECT_NO_FATAL_FAILURE(DRef = DPCTLDevice_CreateFromSelector(DSRef)); | ||
ASSERT_TRUE(DRef == nullptr); | ||
EXPECT_NO_FATAL_FAILURE(DPCTLDevice_Delete(DRef)); | ||
} | ||
|
||
INSTANTIATE_TEST_SUITE_P( | ||
NegativeDeviceCreationTests, | ||
TestUnsupportedFilters, | ||
::testing::Values("abc", "-1", "invalid_filter", "cuda:cpu:0")); |
This file contains hidden or 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 hidden or 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,68 @@ | ||
//=== test_sycl_platform_invalid_filters.cpp - -ve tests for platform iface ==// | ||
// | ||
// Data Parallel Control (dpctl) | ||
// | ||
// Copyright 2020-2021 Intel Corporation | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
/// | ||
/// \file | ||
/// Negative test cases for SYCL platform creation with invalid filter | ||
/// selectors. | ||
/// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#include "dpctl_sycl_device_selector_interface.h" | ||
#include "dpctl_sycl_platform_interface.h" | ||
#include <CL/sycl.hpp> | ||
#include <gtest/gtest.h> | ||
|
||
using namespace cl::sycl; | ||
struct TestUnsupportedFilters : public ::testing::TestWithParam<const char *> | ||
{ | ||
DPCTLSyclDeviceSelectorRef DSRef = nullptr; | ||
|
||
TestUnsupportedFilters() | ||
{ | ||
EXPECT_NO_FATAL_FAILURE(DSRef = DPCTLFilterSelector_Create(GetParam())); | ||
} | ||
|
||
void SetUp() | ||
{ | ||
if (!DSRef) { | ||
auto message = "Skipping as no device of type " + | ||
std::string(GetParam()) + "."; | ||
GTEST_SKIP_(message.c_str()); | ||
} | ||
} | ||
|
||
~TestUnsupportedFilters() | ||
{ | ||
EXPECT_NO_FATAL_FAILURE(DPCTLDeviceSelector_Delete(DSRef)); | ||
} | ||
}; | ||
|
||
TEST_P(TestUnsupportedFilters, Chk_DPCTLPlatform_CreateFromSelector) | ||
{ | ||
DPCTLSyclPlatformRef PRef = nullptr; | ||
EXPECT_NO_FATAL_FAILURE(PRef = DPCTLPlatform_CreateFromSelector(DSRef)); | ||
ASSERT_TRUE(PRef == nullptr); | ||
EXPECT_NO_FATAL_FAILURE(DPCTLPlatform_Delete(PRef)); | ||
} | ||
|
||
INSTANTIATE_TEST_SUITE_P( | ||
NegativeDeviceCreationTests, | ||
TestUnsupportedFilters, | ||
::testing::Values("abc", "-1", "invalid_filter", "cuda:cpu:0")); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, do
catch(...)
finally. Any uncatched exception will break C API interface.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let us do that as a follow up along with the overall work needed to improve error handling (#35).