|
| 1 | +Fix musl errors: |
| 2 | +* reinterpret_cast from 'std::nullptr_t' to 'void **' is not allowed |
| 3 | +* error.h is GNU extension |
| 4 | + |
| 5 | +Upstream PR: https://github.com/ROCm/hip-tests/pull/463 |
| 6 | +--- a/unit/rtc/headers/printf_common.h |
| 7 | ++++ b/unit/rtc/headers/printf_common.h |
| 8 | +@@ -30,7 +30,6 @@ THE SOFTWARE. |
| 9 | + #if defined(_WIN32) |
| 10 | + #include <io.h> |
| 11 | + #else |
| 12 | +-#include <error.h> |
| 13 | + #include <unistd.h> |
| 14 | + #endif |
| 15 | + |
| 16 | +@@ -110,7 +109,7 @@ struct CaptureStream { |
| 17 | + saved_fd = dup(orig_fd); |
| 18 | + |
| 19 | + if ((temp_fd = mkstemp(tempname)) == -1) { |
| 20 | +- error(0, errno, "Error"); |
| 21 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 22 | + assert(false); |
| 23 | + } |
| 24 | + } |
| 25 | +@@ -118,11 +117,11 @@ struct CaptureStream { |
| 26 | + void Begin() { |
| 27 | + fflush(nullptr); |
| 28 | + if (dup2(temp_fd, orig_fd) == -1) { |
| 29 | +- error(0, errno, "Error"); |
| 30 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 31 | + assert(false); |
| 32 | + } |
| 33 | + if (close(temp_fd) != 0) { |
| 34 | +- error(0, errno, "Error"); |
| 35 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 36 | + assert(false); |
| 37 | + } |
| 38 | + } |
| 39 | +@@ -130,11 +129,11 @@ struct CaptureStream { |
| 40 | + void End() { |
| 41 | + fflush(nullptr); |
| 42 | + if (dup2(saved_fd, orig_fd) == -1) { |
| 43 | +- error(0, errno, "Error"); |
| 44 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 45 | + assert(false); |
| 46 | + } |
| 47 | + if (close(saved_fd) != 0) { |
| 48 | +- error(0, errno, "Error"); |
| 49 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 50 | + assert(false); |
| 51 | + } |
| 52 | + } |
| 53 | +@@ -148,7 +147,7 @@ struct CaptureStream { |
| 54 | + |
| 55 | + ~CaptureStream() { |
| 56 | + if (remove(tempname) != 0) { |
| 57 | +- error(0, errno, "Error"); |
| 58 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 59 | + assert(false); |
| 60 | + } |
| 61 | + } |
| 62 | +--- a/unit/memory/hipMemRangeGetAttributes_old.cc |
| 63 | ++++ b/unit/memory/hipMemRangeGetAttributes_old.cc |
| 64 | +@@ -268,7 +268,7 @@ TEST_CASE("Unit_hipMemRangeGetAttributes_NegativeTst") { |
| 65 | + // Passing NULL as first parameter |
| 66 | + SECTION("Passing NULL as first parameter") { |
| 67 | + if (!CheckError(hipMemRangeGetAttributes( |
| 68 | +- reinterpret_cast<void**>(NULL), |
| 69 | ++ static_cast<void**>(NULL), |
| 70 | + reinterpret_cast<size_t*>(dataSizes), |
| 71 | + AttrArr, 4, Hmm, MEM_SIZE), |
| 72 | + __LINE__)) { |
| 73 | +--- a/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor_old.cc |
| 74 | ++++ b/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor_old.cc |
| 75 | +@@ -40,7 +40,7 @@ TEST_CASE("Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Negative") { |
| 76 | + ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(NULL, f1, blockSize, 0); |
| 77 | + REQUIRE(ret != hipSuccess); |
| 78 | + |
| 79 | +- ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, NULL, blockSize, 0); |
| 80 | ++ ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, static_cast<void*>(NULL), blockSize, 0); |
| 81 | + REQUIRE(ret != hipSuccess); |
| 82 | + |
| 83 | + ret = hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlock, f1, 0, 0); |
| 84 | +--- a/unit/occupancy/hipOccupancyMaxPotentialBlockSize_old.cc |
| 85 | ++++ b/unit/occupancy/hipOccupancyMaxPotentialBlockSize_old.cc |
| 86 | +@@ -37,7 +37,7 @@ TEST_CASE("Unit_hipOccupancyMaxPotentialBlockSize_Negative") { |
| 87 | + |
| 88 | + #ifndef __HIP_PLATFORM_NVIDIA__ |
| 89 | + // nvcc doesnt support kernelfunc(NULL) for api |
| 90 | +- ret = hipOccupancyMaxPotentialBlockSize(&gridSize, &blockSize, NULL, 0, 0); |
| 91 | ++ ret = hipOccupancyMaxPotentialBlockSize(&gridSize, &blockSize, static_cast<void*>(NULL), 0, 0); |
| 92 | + REQUIRE(ret != hipSuccess); |
| 93 | + #endif |
| 94 | + } |
| 95 | +--- a/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor.cc |
| 96 | ++++ b/unit/occupancy/hipOccupancyMaxActiveBlocksPerMultiprocessor.cc |
| 97 | +@@ -48,7 +48,7 @@ TEST_CASE("Unit_hipOccupancyMaxActiveBlocksPerMultiprocessor_Negative_Parameters |
| 98 | + blockSize); |
| 99 | + |
| 100 | + SECTION("Kernel function is NULL") { |
| 101 | +- HIP_CHECK_ERROR(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, NULL, blockSize, 0), |
| 102 | ++ HIP_CHECK_ERROR(hipOccupancyMaxActiveBlocksPerMultiprocessor(&numBlocks, static_cast<void*>(NULL), blockSize, 0), |
| 103 | + hipErrorInvalidDeviceFunction); |
| 104 | + } |
| 105 | + } |
| 106 | +--- a/unit/kernel/printf_common.h |
| 107 | ++++ b/unit/kernel/printf_common.h |
| 108 | +@@ -24,7 +24,6 @@ THE SOFTWARE. |
| 109 | + #define _STRESSTEST_PRINTF_COMMON_H_ |
| 110 | + |
| 111 | + #include <errno.h> |
| 112 | +-#include <error.h> |
| 113 | + #include <stdio.h> |
| 114 | + #include <stdlib.h> |
| 115 | + #include <unistd.h> |
| 116 | +@@ -47,17 +46,17 @@ struct CaptureStream { |
| 117 | + saved_fd = dup(orig_fd); |
| 118 | + |
| 119 | + if ((temp_fd = mkstemp(tempname)) == -1) { |
| 120 | +- error(0, errno, "Error"); |
| 121 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 122 | + assert(false); |
| 123 | + } |
| 124 | + |
| 125 | + fflush(nullptr); |
| 126 | + if (dup2(temp_fd, orig_fd) == -1) { |
| 127 | +- error(0, errno, "Error"); |
| 128 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 129 | + assert(false); |
| 130 | + } |
| 131 | + if (close(temp_fd) != 0) { |
| 132 | +- error(0, errno, "Error"); |
| 133 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 134 | + assert(false); |
| 135 | + } |
| 136 | + } |
| 137 | +@@ -67,11 +66,11 @@ struct CaptureStream { |
| 138 | + return; |
| 139 | + fflush(nullptr); |
| 140 | + if (dup2(saved_fd, orig_fd) == -1) { |
| 141 | +- error(0, errno, "Error"); |
| 142 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 143 | + assert(false); |
| 144 | + } |
| 145 | + if (close(saved_fd) != 0) { |
| 146 | +- error(0, errno, "Error"); |
| 147 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 148 | + assert(false); |
| 149 | + } |
| 150 | + saved_fd = -1; |
| 151 | +@@ -90,7 +89,7 @@ struct CaptureStream { |
| 152 | + ~CaptureStream() { |
| 153 | + restoreStream(); |
| 154 | + if (remove(tempname) != 0) { |
| 155 | +- error(0, errno, "Error"); |
| 156 | ++ fprintf(stderr, "Error: %s\n", strerror(errno)); |
| 157 | + assert(false); |
| 158 | + } |
| 159 | + } |
0 commit comments