added more device negative testing

1. Added fallback for nullptr to hipGetDeviceProperties and hipGetDeviceCount
2. Added negative tests for hipGetDeviceProperties and hipGetDeviceCount

Change-Id: Iac93fd53d7d4794fb10546ddadf6ca802b047c87


[ROCm/hip commit: 1b14393a85]
This commit is contained in:
Aditya Atluri
2016-09-27 13:04:35 -05:00
parent 55dc5b12e8
commit 9dd52d97eb
3 changed files with 44 additions and 9 deletions
@@ -0,0 +1,10 @@
#include<hip/hip_runtime.h>
#include<hip/hip_runtime_api.h>
#include"hipDeviceUtil.h"
int main()
{
int deviceCnt;
HIP_CHECK(hipGetDeviceCount(&deviceCnt), hipGetDeviceCount);
HIP_CHECK(hipGetDeviceCount(0), hipGetDeviceCount);
}
@@ -0,0 +1,14 @@
#include<hip/hip_runtime.h>
#include<hip/hip_runtime_api.h>
#include"hipDeviceUtil.h"
int main()
{
hipDeviceProp_t props;
HIP_CHECK(hipGetDeviceProperties(&props, 0), hipGetDeviceProperties);
HIP_CHECK(hipGetDeviceProperties(NULL, 0), hipGetDeviceProperties);
HIP_CHECK(hipGetDeviceProperties(NULL, -1), hipGetDeviceProperties);
HIP_CHECK(hipGetDeviceProperties(&props, -1), hipGetDeviceProperties);
HIP_CHECK(hipGetDeviceProperties(NULL, 1024), hipGetDeviceProperties);
HIP_CHECK(hipGetDeviceProperties(&props, 1024), hipGetDeviceProperties);
}