EXSWHTEC-224 - Test cases ID clean up and documentation for Initialization&Version (#83)

- Test cases ID clean up and documentation for Initialization and Version

[ROCm/hip-tests commit: 1af95c5a2a]
This commit is contained in:
milos-mozetic
2023-06-28 12:16:40 +02:00
committed by GitHub
parent 562a022bba
commit 84f4cb0bc1
13 changed files with 466 additions and 103 deletions
@@ -65,6 +65,13 @@ THE SOFTWARE.
* @}
*/
/**
* @defgroup DriverTest Initialization and Version
* @{
* This section describes tests for the initialization and version functions of HIP runtime API.
* @}
*/
/**
* @defgroup ShflTest warp shuffle function Management
* @{
@@ -17,16 +17,17 @@ OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/**
* hipDeviceTotalMem tests
* Scenario: Validate behavior of hipDeviceTotalMem for masked devices.
*/
#include <hip_test_common.hh>
#ifdef __linux__
#include <unistd.h>
#include <sys/wait.h>
/**
* @addtogroup hipDeviceTotalMem hipDeviceTotalMem
* @{
* @ingroup DriverTest
*/
#define MAX_SIZE 30
#define VISIBLE_DEVICE 0
@@ -141,7 +142,17 @@ static bool getTotalMemoryOfMaskedDevices(int actualNumGPUs) {
/**
* Scenario: Validate behavior of hipDeviceTotalMem for masked devices.
* Test Description
* ------------------------
* - Check that total memory is returned correctly when
* the devices are masked.
* Test source
* ------------------------
* - unit/multiproc/hipDeviceTotalMemMproc.cc
* Test requirements
* ------------------------
* - Multi-device test
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceTotalMem_MaskedDevices") {
int count = -1;
@@ -16,25 +16,35 @@ LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Testcase Scenarios :
Unit_hipDeviceComputeCapability_ValidateVersion - Check if hipDeviceComputeCapability api returns valid Major and Minor versions
Unit_hipDeviceComputeCapability_Negative - Test unsuccessful execution of hipDeviceComputeCapability when nullptr
or invalid device is set as input parameter
*/
/*
* Conformance test for checking functionality of
* hipError_t hipDeviceComputeCapability(int* major, int* minor, hipDevice_t device);
*/
#include <hip_test_common.hh>
/**
* hipDeviceComputeCapability negative tests
* Scenario1: Validates if &major = nullptr returns error code
* Scenario2: Validates if &minor = nullptr returns error code
* Scenario3: Validates if device is -1
* Scenario4: Validates if device is out of bounds
* @addtogroup hipDeviceComputeCapability hipDeviceComputeCapability
* @{
* @ingroup DriverTest
* `hipDeviceComputeCapability(int* major, int* minor, hipDevice_t device)` -
* Returns the compute capability of the device.
*/
/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the major number is `nullptr`
* - Expected output: do not return `hipSuccess`
* -# When output pointer to the minor number is `nullptr`
* - Expected output: do not return `hipSuccess`
* -# When device ordinal is negative
* - Expected output: do not return `hipSuccess`
* -# When device ordinal is out of bounds
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceComputeCapability.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceComputeCapability_Negative") {
int major, minor, numDevices;
@@ -71,7 +81,17 @@ TEST_CASE("Unit_hipDeviceComputeCapability_Negative") {
}
}
// Scenario 5 : Check whether major and minor version value is valid.
/**
* Test Description
* ------------------------
* - Checks that valid major and minor numbers are returned.
* Test source
* ------------------------
* - unit/device/hipDeviceComputeCapability.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceComputeCapability_ValidateVersion") {
int major, minor;
hipDevice_t device;
@@ -20,11 +20,27 @@
#include <hip_test_common.hh>
/**
* @addtogroup hipDeviceGetByPCIBusId hipDeviceGetByPCIBusId
* @{
* @ingroup DriverTest
* `hipDeviceGetByPCIBusId(int* device, const char* pciBusId)` -
* Returns a handle to a compute device.
*/
#define SIZE 13
/**
* scenario: Validates device number from pciBusIdstr string
* Test Description
* ------------------------
* - Check that PCI bus ID is the same as the one returned from attributes.
* - Perform for each device.
* Test source
* ------------------------
* - unit/device/hipDeviceGetByPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetByPCIBusId_Functional") {
char pciBusId[SIZE]{};
@@ -49,10 +65,20 @@ TEST_CASE("Unit_hipDeviceGetByPCIBusId_Functional") {
}
}
/**
* Validates negative scenarios for hipDeviceGetByPCIBusId
* scenario: device = nullptr and pciBusIdstr = nullptr
* Test Description
* ------------------------
* - Validates handling of `nullptr` arguments:
* -# When the output pointer to the device is `nullptr`
* - Expected output: do not return `hipSuccess`
* -# When the PCI bus ID pointer is `nullptr`
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceGetByPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetByPCIBusId_NegativeNullChk") {
int device = -1;
@@ -66,9 +92,19 @@ TEST_CASE("Unit_hipDeviceGetByPCIBusId_NegativeNullChk") {
}
/**
* Validates negative scenarios for hipDeviceGetByPCIBusId
* scenario1: Pass an empty like ""
* scenario2: Pass an shorter string "0000:"
* Test Description
* ------------------------
* - Validates handling of invalid PCI bus ID strings:
* -# When PCI bus ID is an empty string
* - Expected output: do not return `hipSuccess`
* -# When PCI bus ID is a short string
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceGetByPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetByPCIBusId_NegativeInputString") {
int device = -1;
@@ -81,8 +117,17 @@ TEST_CASE("Unit_hipDeviceGetByPCIBusId_NegativeInputString") {
}
/**
* Validates negative scenarios for hipDeviceGetByPCIBusId
* scenario: Pass wrong bus id in pciBusIdstr
* Test Description
* ------------------------
* - Validates handling of invalid PCI bus ID values:
* -# Passes non-existing PCI bus ID
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceGetByPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetByPCIBusId_WrongBusID") {
int deviceCount = 0;
@@ -17,10 +17,6 @@ OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
* Conformance test for checking functionality of
* hipError_t hipDeviceGetName(char* name, int len, hipDevice_t device);
*/
#include <cstddef>
#include <hip_test_common.hh>
#include <cstring>
@@ -29,16 +25,34 @@ THE SOFTWARE.
#include <algorithm>
#include <iterator>
/**
* @addtogroup hipDeviceGetName hipDeviceGetName
* @{
* @ingroup DriverTest
* `hipDeviceGetName(char* name, int len, hipDevice_t device)` -
* Returns an identifer string for the device.
*/
constexpr size_t LEN = 256;
/**
* hipDeviceGetName tests
* Scenario1: Validates the name string with hipDeviceProp_t.name[256]
* Scenario2: Validates returned error code for name = nullptr
* Scenario3: Validates returned error code for len = 0
* Scenario4: Validates returned error code for len < 0
* Scenario5: Validates returned error code for an invalid device
* Scenario6: Validates partially filling the name into a char array
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# Valid devices and output pointer to the name is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# Valid devices and output name buffer length is 0
* - Expected output: return `hipErrorInvalidValue`
* -# Valid devices and output name buffer has length -1
* - Expected output: return `hipErrorInvalidValue`
* -# Invalid devices, device ordinal is out of bounds
* - Expected output: return `hipErrorInvalidDevice`
* Test source
* ------------------------
* - unit/device/hipDeviceGetName.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetName_NegTst") {
std::array<char, LEN> name;
@@ -87,6 +101,18 @@ TEST_CASE("Unit_hipDeviceGetName_NegTst") {
}
}
/**
* Test Description
* ------------------------
* - Get the device name for each device.
* - Compare the name with the name returned from device properties.
* Test source
* ------------------------
* - unit/device/hipDeviceGetName.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetName_CheckPropName") {
int numDevices = 0;
std::array<char, LEN> name;
@@ -103,6 +129,18 @@ TEST_CASE("Unit_hipDeviceGetName_CheckPropName") {
}
}
/**
* Test Description
* ------------------------
* - Set name buffer length to the half of the name length.
* - Check that device name is successfuly returned.
* Test source
* ------------------------
* - unit/device/hipDeviceGetName.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetName_PartialFill") {
#if HT_AMD
HipTest::HIP_SKIP_TEST("EXSWCPHIPT-108");
@@ -25,9 +25,24 @@ THE SOFTWARE.
#include <string>
/**
* @brief Test all possible combination of attributes and devices for hipDeviceGetP2PAttribute.
* Verify that the output is within the range of acceptable values.
*
* @addtogroup hipDeviceGetP2PAttribute hipDeviceGetP2PAttribute
* @{
* @ingroup DriverTest
* `hipDeviceGetP2PAttribute(int* value, hipDeviceP2PAttr attr,
* int srcDevice, int dstDevice)` -
* Returns a value for attr of link between two devices.
*/
/**
* Test Description
* ------------------------
* - Get all possible combinations of attributes between all pairs of devices.
* Test source
* ------------------------
* - unit/device/hipDeviceGetP2PAttribute.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetP2PAttribute_Basic") {
#if HT_AMD
@@ -65,8 +80,28 @@ TEST_CASE("Unit_hipDeviceGetP2PAttribute_Basic") {
}
/**
* @brief Negative test scenarios for hipDeviceGetP2PAttribute
*
* Test Description
* ------------------------
* - Verifies handling of invalid arguments:
* -# When output pointer to the value is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# When attribute is invalid, out of bounds
* - Expected output: return `hipErrorInvalidValue`
* -# When device ordinal is negative (-1)
* - Expected output: return `hipErrorInvalidDevice`
* -# When device ordinal is out of bounds
* - Expected output: return `hipErrorInvalidDevice`
* -# When the src and dst devices are the same one
* - Expected output: return `hipErrorInvalidDevice`
* -# When some devices are hidden using environment variables
* - Expected output: different scenarios produce different return value
* Test source
* ------------------------
* - unit/device/hipDeviceGetP2PAttribute.cc
* Test requirements
* ------------------------
* - Platform specific (NVIDIA)
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetP2PAttribute_Negative") {
#if HT_AMD
@@ -25,6 +25,14 @@
#include <hip_test_common.hh>
/**
* @addtogroup hipDeviceGetPCIBusId hipDeviceGetPCIBusId
* @{
* @ingroup DriverTest
* `hipDeviceGetPCIBusId(char* pciBusId, int len, int device)` -
* Returns a PCI Bus Id string for the device, overloaded to take int device ID.
*/
#define MAX_DEVICE_LENGTH 20
namespace hipDeviceGetPCIBusIdTests {
@@ -37,6 +45,18 @@ void getPciBusId(int deviceCount,
}
} // namespace hipDeviceGetPCIBusIdTests
/**
* Test Description
* ------------------------
* - Check that PCI bus ID is the same as the one returned from attributes.
* - Perform for each device.
* Test source
* ------------------------
* - unit/device/hipDeviceGetByPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetPCIBusId_Check_PciBusID_WithAttr") {
int deviceCount = 0;
HIP_CHECK(hipGetDeviceCount(&deviceCount));
@@ -71,6 +91,19 @@ TEST_CASE("Unit_hipDeviceGetPCIBusId_Check_PciBusID_WithAttr") {
" hipDeviceGetAttribute matched for all gpus\n");
}
/**
* Test Description
* ------------------------
* - Checks that an error is returned when the output buffer has length
* that is smaller than the full PCI bus ID.
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceGetPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetPCIBusId_Negative_PartialFill") {
std::array<char, MAX_DEVICE_LENGTH> busID;
@@ -95,14 +128,26 @@ TEST_CASE("Unit_hipDeviceGetPCIBusId_Negative_PartialFill") {
REQUIRE(std::all_of(strEnd+1, end, [](char& c) { return c == fillValue; }));
}
/**
* Validates negative scenarios for hipDeviceGetPCIBusId
* scenario1: pciBusId = nullptr
* scenario2: device = -1 (Invalid Device)
* scenario3: device = Non Existing Device
* scenario4: len = 0
* scenario5: len < 0
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the PCI bus ID is `nullptr`
* - Expected output: do not return `hipSuccess`
* -# When the length of the output buffer is 0
* - Expected output: do not return `hipSuccess`
* -# When the length of the output buffer is less than 0
* - Expected output: do not return `hipSuccess`
* -# When the device ordinal is negative (-1)
* - Expected output: do not return `hipSuccess`
* -# When the device ordinal is out of bounds
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceGetPCIBusId.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetPCIBusId_NegTst") {
char pciBusId[MAX_DEVICE_LENGTH];
@@ -16,23 +16,29 @@ LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Testcase Scenarios :
Unit_hipDeviceGetUuid_Positive - Check if hipDeviceGetUuid api returns valid UUID
Unit_hipDeviceGetUuid_Negative - Test unsuccessful execution of hipDeviceGetUuid when nullptr
or invalid device is set as input parameter
*/
/*
* Conformance test for checking functionality of
* hipError_t hipDeviceGetUuid(hipUUID* uuid, hipDevice_t device);
*/
#include <hip_test_common.hh>
#include <cstring>
#include <cstdio>
/**
* hipDeviceGetUuid positive test
* Scenario1: Validates the returned UUID
* @addtogroup hipDeviceGetUuid hipDeviceGetUuid
* @{
* @ingroup DriverTest
* `hipDeviceGetUuid(hipUUID* uuid, hipDevice_t device)` -
* Returns an UUID for the device.[BETA]
*/
/**
* Test Description
* ------------------------
* - Check that non-empty UUID is returned for each available device.
* Test source
* ------------------------
* - unit/device/hipDeviceGetUuid.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetUuid_Positive") {
hipDevice_t device;
@@ -57,10 +63,21 @@ TEST_CASE("Unit_hipDeviceGetUuid_Positive") {
}
/**
* hipDeviceGetUuid negative tests
* Scenario2: Validates returned error code for UUID = nullptr
* Scenario3: Validates returned error code if device is -1
* Scenario4: Validates returned error code if device is out of bounds
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the UUID is `nullptr`
* - Expected output: do not return `hipSuccess`
* -# When device ordinal is negative
* - Expected output: do not return `hipSuccess`
* -# When device ordinal is out of bounds
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipDeviceGetUuid.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGetUuid_Negative") {
int numDevices = 0;
@@ -70,11 +87,8 @@ TEST_CASE("Unit_hipDeviceGetUuid_Negative") {
if (numDevices > 0) {
HIP_CHECK(hipDeviceGet(&device, 0));
// Scenario 2
REQUIRE_FALSE(hipSuccess == hipDeviceGetUuid(nullptr, device));
// Scenario 3
REQUIRE_FALSE(hipSuccess == hipDeviceGetUuid(&uuid, -1));
// Scenario 4
REQUIRE_FALSE(hipSuccess == hipDeviceGetUuid(&uuid, numDevices));
}
}
@@ -17,19 +17,32 @@ OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
* Conformance test for checking functionality of
* hipError_t hipDeviceTotalMem(size_t* bytes, hipDevice_t device);
*/
#include <hip_test_common.hh>
/**
* @addtogroup hipDeviceTotalMem hipDeviceTotalMem
* @{
* @ingroup DriverTest
* `hipDeviceTotalMem(size_t* bytes, hipDevice_t device)` -
* Returns the total amount of memory on the device.
*/
/**
* hipDeviceTotalMem tests
* Scenario1: Validates if bytes = nullptr returns hip error code.
* Scenario2: Validates if error code is returned for device = -1.
* Scenario3: Validates if error code is returned for device = deviceCount.
* Scenario4: Compare total memory size with hipDeviceProp_t.totalGlobalMem for each device.
* Test Description
* ------------------------
* - Validate handling of invalid arguments:
* -# When output pointer to the total memory is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# When device ordinal is negative (-1)
* - Expected output: return `hipErrorInvalidDevice`
* -# When device ordinal is out of bounds
* - Expected output: return `hipErrorInvalidDevice`
* Test source
* ------------------------
* - unit/device/hipDeviceTotalMem.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceTotalMem_NegTst") {
#if HT_NVIDIA
@@ -54,7 +67,18 @@ TEST_CASE("Unit_hipDeviceTotalMem_NegTst") {
}
}
// Scenario 4
/**
* Test Description
* ------------------------
* - Check that the returned number of bytes is the same as the
* one from device attributes.
* Test source
* ------------------------
* - unit/device/hipDeviceTotalMem.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceTotalMem_ValidateTotalMem") {
size_t totMem;
int numDevices = 0;
@@ -77,6 +101,19 @@ TEST_CASE("Unit_hipDeviceTotalMem_ValidateTotalMem") {
REQUIRE(total == totMem);
}
/**
* Test Description
* ------------------------
* - Check that total memory is returned when other device is
* set than the one in the API call.
* Test source
* ------------------------
* - unit/device/hipDeviceTotalMem.cc
* Test requirements
* ------------------------
* - Multi-device test
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceTotalMem_NonSelectedDevice") {
auto deviceCount = HipTest::getDeviceCount();
if (deviceCount < 2) {
@@ -18,13 +18,29 @@ LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Testcase Scenarios :
Unit_hipDriverGetVersion_Positive - Test simple reading of HIP driver version with hipDriverGetVersion api
Unit_hipDriverGetVersion_Negative - Test unsuccessful execution of hipDriverGetVersion when nullptr is set as input parameter
*/
#include <hip_test_common.hh>
/**
* @addtogroup hipDriverGetVersion hipDriverGetVersion
* @{
* @ingroup DriverTest
* `hipDriverGetVersion(int* driverVersion)` -
* Returns the approximate HIP driver version.
*/
/**
* Test Description
* ------------------------
* - Check that the returned driver version has valid value.
* - Both CUDA and HIP driver version can be returned, depending on the device.
* Test source
* ------------------------
* - unit/device/hipDriverGetVersion.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDriverGetVersion_Positive") {
int driverVersion = -1;
@@ -33,6 +49,19 @@ TEST_CASE("Unit_hipDriverGetVersion_Positive") {
INFO("Driver version " << driverVersion);
}
/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the driver version is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* Test source
* ------------------------
* - unit/device/hipDriverGetVersion.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDriverGetVersion_Negative") {
// If initialization is attempted with nullptr, error shall be reported
HIP_CHECK_ERROR(hipDriverGetVersion(nullptr), hipErrorInvalidValue);
@@ -18,13 +18,29 @@ LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Testcase Scenarios :
Unit_hipInit_Positive - Test explicit HIP initalization with hipInit api
Unit_hipInit_Negative_InvalidFlag - Test unsuccessful HIP initalization with hipInit api when flag is invalid
*/
#include <hip_test_common.hh>
/**
* @addtogroup hipInit hipInit
* @{
* @ingroup DriverTest
* `hipInit(unsigned int flags)` -
* Explicitly initializes the HIP runtime.
*/
/**
* Test Description
* ------------------------
* - Initialize HIP runtime.
* - Call a HIP API and check that the runtime is initialized successfully.
* Test source
* ------------------------
* - unit/device/hipInit.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipInit_Positive") {
HIP_CHECK(hipInit(0));
@@ -34,6 +50,19 @@ TEST_CASE("Unit_hipInit_Positive") {
REQUIRE(count >= 0);
}
/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When flag has invalid value equal to -1
* - Expected output: return `hipErrorInvalidValue`
* Test source
* ------------------------
* - unit/device/hipInit.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipInit_Negative") {
// If initialization is attempted with invalid flag, error shall be reported
unsigned int invalid_flag = 1;
@@ -16,21 +16,32 @@ LIABILITY, WHETHER INN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR INN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
/*
Testcase Scenarios :
Unit_hipRuntimeGetVersion_Positive - Test simple reading of HIP runtime version with hipRuntimeGetVersion api
Unit_hipRuntimeGetVersion_Negative - Test unsuccessful execution of hipRuntimeGetVersion when nullptr is set as input parameter
*/
/*
* Conformance test for checking functionality of
* hipError_t hipRuntimeGetVersion(int* runtimeVersion);
#include <hip_test_common.hh>
/**
* @addtogroup hipRuntimeGetVersion hipRuntimeGetVersion
* @{
* @ingroup DriverTest
* `hipRuntimeGetVersion(int* runtimeVersion)` -
* Returns the approximate HIP runtime version.
* On HIP/HCC path this function returns HIP runtime patch version
* (a 5 digit code) however on
* HIP/NVCC path this function return CUDA runtime version.
*/
#include <hip_test_common.hh>
/**
* Test Description
* ------------------------
* - Checks that valid runtime version is returned.
* - Print out the runtime version.
* Test source
* ------------------------
* - unit/device/hipRuntimeGetVersion.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipRuntimeGetVersion_Positive") {
int runtimeVersion = -1;
HIP_CHECK(hipRuntimeGetVersion(&runtimeVersion));
@@ -38,6 +49,19 @@ TEST_CASE("Unit_hipRuntimeGetVersion_Positive") {
INFO("Runtime version " << runtimeVersion);
}
/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the runtime version is nullptr
* - Expected output: do not return `hipSuccess`
* Test source
* ------------------------
* - unit/device/hipRuntimeGetVersion.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipRuntimeGetVersion_Negative") {
// If initialization is attempted with nullptr, error shall be reported
CHECK_FALSE(hipRuntimeGetVersion(nullptr) == hipSuccess);
@@ -214,6 +214,35 @@ TEST_CASE("Unit_hipSetGetDevice_Negative") {
* @}
*/
/**
* @addtogroup hipDeviceGet hipDeviceGet
* @{
* @ingroup DriverTest
* `hipDeviceGet(hipDevice_t* device, int ordinal)` -
* Returns a handle to a compute device.
* ________________________
* Test cases from other modules:
* - @ref Unit_hipSetDevice_BasicSetGet
* - @ref Unit_hipGetSetDevice_MultiThreaded
*/
/**
* Test Description
* ------------------------
* - Validates handling of invalid arguments:
* -# When output pointer to the device is `nullptr`
* - Expected output: return `hipErrorInvalidValue`
* -# When device ordinal is out of bounds
* - Expected output: return `hipErrorInvalidDevice`
* -# When device ordinal is negative
* - Expected output: return `hipErrorInvalidDevice`
* Test source
* ------------------------
* - unit/device/hipSetGetDevice.cc
* Test requirements
* ------------------------
* - HIP_VERSION >= 5.2
*/
TEST_CASE("Unit_hipDeviceGet_Negative") {
// TODO enable after EXSWCPHIPT-104 is fixed
#if HT_NVIDIA