EXSWHTEC-15 - Implement additional HipEventElapsedTime tests (#2903)
- Fix minor bug in helper test function in Unit_hipEvent.cc - Move negative test from Unit_hipEventElapsedTime_DifferentDevices to Unit_hipEventRecord_Negative - Add Unit_hipEventElapsedTime_NotReady_Negative test when function is called on event that has not been completed
This commit is contained in:
@@ -19,8 +19,12 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
// Test hipEventRecord serialization behavior.
|
||||
/*
|
||||
Testcase Scenarios :
|
||||
Unit_hipEventRecord- Test hipEventRecord serialization behavior
|
||||
Unit_hipEventRecord_Negative - Test unsuccessful hipEventRecord when event is passed as nullptr
|
||||
- Test unsuccessful hipEventRecord when event is created/recorded on different devices
|
||||
*/
|
||||
|
||||
#include <hip_test_common.hh>
|
||||
|
||||
@@ -117,4 +121,21 @@ TEST_CASE("Unit_hipEventRecord_Negative") {
|
||||
SECTION("Nullptr event") {
|
||||
HIP_CHECK_ERROR(hipEventRecord(nullptr, nullptr), hipErrorInvalidResourceHandle);
|
||||
}
|
||||
|
||||
SECTION("Different devices") {
|
||||
int devCount = 0;
|
||||
HIP_CHECK(hipGetDeviceCount(&devCount));
|
||||
if (devCount > 1) {
|
||||
// create event on dev=0
|
||||
HIP_CHECK(hipSetDevice(0));
|
||||
hipEvent_t start;
|
||||
HIP_CHECK(hipEventCreate(&start));
|
||||
|
||||
// start on device 0 but null stream on device 1
|
||||
HIP_CHECK(hipSetDevice(1));
|
||||
HIP_CHECK_ERROR(hipEventRecord(start, nullptr), hipErrorInvalidHandle)
|
||||
|
||||
HIP_CHECK(hipEventDestroy(start));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user