If WriteFile() fails with ERROR_DISK_FULL or fflush() with ENOSPC then skip
the whole test. It can happen on older WinNT system without sparse file
support and with small disk.
---
 mingw-w64-crt/testcases/t_fseeki64.c | 6 ++++++
 mingw-w64-crt/testcases/t_fseeko64.c | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/mingw-w64-crt/testcases/t_fseeki64.c 
b/mingw-w64-crt/testcases/t_fseeki64.c
index 63d30ca14c4d..1daa2d13bcb7 100644
--- a/mingw-w64-crt/testcases/t_fseeki64.c
+++ b/mingw-w64-crt/testcases/t_fseeki64.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <assert.h>
+#include <errno.h>
 #include <io.h>
 #include <fcntl.h>
 #include <windows.h>
@@ -71,6 +72,11 @@ int main() {
     assert(fputs("_", file) >= 0);
 
     /* flush all data, so they can be accessed via WinAPI */
+    if (fflush(file) == EOF && errno == ENOSPC) {
+        /* skip the test for DISK FULL error */
+        printf("DISK FULL\n");
+        return 77;
+    }
     assert(fflush(file) == 0);
 
     /* now read all data via WinAPI and check that they were written at 
correct offsets */
diff --git a/mingw-w64-crt/testcases/t_fseeko64.c 
b/mingw-w64-crt/testcases/t_fseeko64.c
index 2ae186af5625..c55e8293b643 100644
--- a/mingw-w64-crt/testcases/t_fseeko64.c
+++ b/mingw-w64-crt/testcases/t_fseeko64.c
@@ -18,6 +18,12 @@ static int writefile(const char *path){
     return 1;
   }
   if (!WriteFile(fd, writebuf, strlen(writebuf), &dwResult, NULL)) {
+    if (GetLastError() == ERROR_DISK_FULL) {
+        /* skip the test for DISK FULL error */
+        printf("DISK FULL\n");
+        CloseHandle(fd);
+        return 77;
+    }
     printf("writefile: write failed: winerror=%lu\n", GetLastError());
     CloseHandle(fd);
     return 1;
-- 
2.20.1



_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to