Fix hipPrintf* tests
The test needs to check dup2 syscall status and not the
errno val
Change-Id: Ic88eb2047b839adbc9e12965b098d8960cd7e2b8
[ROCm/hip commit: 7720651f2d]
This commit is contained in:
@@ -21,20 +21,17 @@ struct CaptureStream {
|
|||||||
orig_fd = fileno(original);
|
orig_fd = fileno(original);
|
||||||
saved_fd = dup(orig_fd);
|
saved_fd = dup(orig_fd);
|
||||||
|
|
||||||
temp_fd = mkstemp(tempname);
|
if ((temp_fd = mkstemp(tempname)) == -1) {
|
||||||
if (errno) {
|
|
||||||
error(0, errno, "Error");
|
error(0, errno, "Error");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fflush(nullptr);
|
fflush(nullptr);
|
||||||
dup2(temp_fd, orig_fd);
|
if (dup2(temp_fd, orig_fd) == -1) {
|
||||||
if (errno) {
|
|
||||||
error(0, errno, "Error");
|
error(0, errno, "Error");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
close(temp_fd);
|
if (close(temp_fd) != 0) {
|
||||||
if (errno) {
|
|
||||||
error(0, errno, "Error");
|
error(0, errno, "Error");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
@@ -44,13 +41,11 @@ struct CaptureStream {
|
|||||||
if (saved_fd == -1)
|
if (saved_fd == -1)
|
||||||
return;
|
return;
|
||||||
fflush(nullptr);
|
fflush(nullptr);
|
||||||
dup2(saved_fd, orig_fd);
|
if (dup2(saved_fd, orig_fd) == -1) {
|
||||||
if (errno) {
|
|
||||||
error(0, errno, "Error");
|
error(0, errno, "Error");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
close(saved_fd);
|
if (close(saved_fd) != 0) {
|
||||||
if (errno) {
|
|
||||||
error(0, errno, "Error");
|
error(0, errno, "Error");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
@@ -65,8 +60,7 @@ struct CaptureStream {
|
|||||||
|
|
||||||
~CaptureStream() {
|
~CaptureStream() {
|
||||||
restoreStream();
|
restoreStream();
|
||||||
remove(tempname);
|
if (remove(tempname) != 0) {
|
||||||
if (errno) {
|
|
||||||
error(0, errno, "Error");
|
error(0, errno, "Error");
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|||||||
مرجع در شماره جدید
Block a user