SWDEV-301952 - [catch2][dtest] Migration of Negative folder test files to Catch2 (#2463)

Migrated hipMemcpyFromSymbol/hipMemcpyToSymbol, hipMemcpyFromSymbolAsync/hipMemcpyToSymbolAsync files under Negative/memory folder into catch2 framework.

Change-Id: Id9e451fa7262193df3812bc0247e3957ae083c35
Bu işleme şunda yer alıyor:
meher-bhiutras
2022-02-25 19:39:13 +05:30
işlemeyi yapan: GitHub
ebeveyn 9db0a095f9
işleme 9ee204588b
5 değiştirilmiş dosya ile 208 ekleme ve 0 silme
+28
Dosyayı Görüntüle
@@ -1,3 +1,23 @@
# Copyright (c) 2021 Advanced Micro Devices, Inc. All Rights Reserved.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# 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.
# Common Tests - Test independent of all platforms
if(HIP_PLATFORM MATCHES "amd")
set(TEST_SRC
@@ -38,6 +58,10 @@ set(TEST_SRC
hipMallocManaged.cc
hipMemRangeGetAttribute.cc
hipHmmOvrSubscriptionTst.cc
hipMemcpyFromSymbol.cc
hipMemcpyFromSymbolAsync.cc
hipMemcpyToSymbol.cc
hipMemcpyToSymbolAsync.cc
)
else()
set(TEST_SRC
@@ -75,6 +99,10 @@ set(TEST_SRC
hipMallocManaged.cc
hipMemRangeGetAttribute.cc
hipHmmOvrSubscriptionTst.cc
hipMemcpyFromSymbol.cc
hipMemcpyFromSymbolAsync.cc
hipMemcpyToSymbol.cc
hipMemcpyToSymbolAsync.cc
)
endif()
+43
Dosyayı Görüntüle
@@ -0,0 +1,43 @@
/*
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
*/
#include <hip_test_common.hh>
#define SIZE 1024
/* Test verifies hipMemcpyFromSymbol API Negative scenarios.
*/
TEST_CASE("Unit_hipMemcpyFromSymbol_Negative") {
void *Sd;
char S[SIZE]="This is not a device symbol";
HIP_CHECK(hipMalloc(&Sd, SIZE));
SECTION("Passing void pointer") {
REQUIRE(hipSuccess != hipMemcpyFromSymbol(S, HIP_SYMBOL(Sd),
SIZE, 0, hipMemcpyDeviceToHost));
}
SECTION("Passing NULL Pointer") {
REQUIRE(hipSuccess != hipMemcpyFromSymbol(S, nullptr,
SIZE, 0, hipMemcpyDeviceToHost));
}
HIP_CHECK(hipFree(Sd));
}
+47
Dosyayı Görüntüle
@@ -0,0 +1,47 @@
/*
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
*/
#include <hip_test_common.hh>
#define SIZE 1024
/* Test verifies hipMemcpyFromSymbolAsync API Negative scenarios.
*/
TEST_CASE("Unit_hipMemcpyFromSymbolAsync_Negative") {
void *Sd;
char S[SIZE]="This is not a device symbol";
HIP_CHECK(hipMalloc(&Sd, SIZE));
hipStream_t stream;
HIP_CHECK(hipStreamCreate(&stream));
SECTION("Passing void pointer") {
REQUIRE(hipSuccess != hipMemcpyFromSymbolAsync(S, HIP_SYMBOL(Sd),
SIZE, 0, hipMemcpyDeviceToHost, stream));
}
SECTION("Passing NULL pointer") {
REQUIRE(hipSuccess != hipMemcpyFromSymbolAsync(S, nullptr,
SIZE, 0, hipMemcpyDeviceToHost, stream));
}
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK(hipFree(Sd));
}
+43
Dosyayı Görüntüle
@@ -0,0 +1,43 @@
/*
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
*/
#include <hip_test_common.hh>
#define SIZE 1024
/* Test verifies hipMemcpyToSymbol API Negative scenarios.
*/
TEST_CASE("Unit_hipMemcpyToSymbol_Negative") {
void *Sd;
char S[SIZE]="This is not a device symbol";
HIP_CHECK(hipMalloc(&Sd, SIZE));
SECTION("Passing void pointer") {
REQUIRE(hipSuccess != hipMemcpyToSymbol(HIP_SYMBOL(Sd), S,
SIZE, 0, hipMemcpyDeviceToHost));
}
SECTION("Passing NULL Pointer") {
REQUIRE(hipSuccess != hipMemcpyToSymbol(nullptr, S,
SIZE, 0, hipMemcpyDeviceToHost));
}
HIP_CHECK(hipFree(Sd));
}
+47
Dosyayı Görüntüle
@@ -0,0 +1,47 @@
/*
Copyright (c) 2021 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
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.
*/
#include <hip_test_common.hh>
#define SIZE 1024
/* Test verifies hipMemcpyToSymbolAsync API Negative scenarios.
*/
TEST_CASE("Unit_hipMemcpyToSymbolAsync_Negative") {
void *Sd;
char S[SIZE]="This is not a device symbol";
HIP_CHECK(hipMalloc(&Sd, SIZE));
hipStream_t stream;
HIP_CHECK(hipStreamCreate(&stream));
SECTION("Passing void pointer") {
REQUIRE(hipSuccess != hipMemcpyToSymbolAsync(HIP_SYMBOL(Sd), S,
SIZE, 0, hipMemcpyHostToDevice, stream));
}
SECTION("Passing NULL pointer") {
REQUIRE(hipSuccess != hipMemcpyToSymbolAsync(nullptr, S,
SIZE, 0, hipMemcpyHostToDevice, stream));
}
HIP_CHECK(hipStreamDestroy(stream));
HIP_CHECK(hipFree(Sd));
}