mirror of
https://github.com/facebook/zstd.git
synced 2025-07-30 22:23:13 +03:00
Update cli-tests/file-stat tests
This commit is contained in:
@ -630,6 +630,7 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
int isDstRegFile;
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
/* Windows requires opening the file as a "binary" file to avoid
|
/* Windows requires opening the file as a "binary" file to avoid
|
||||||
* mangling. This macro doesn't exist on unix. */
|
* mangling. This macro doesn't exist on unix. */
|
||||||
@ -648,10 +649,11 @@ FIO_openDstFile(FIO_ctx_t* fCtx, FIO_prefs_t* const prefs,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Check regular file after opening with O_CREAT */
|
||||||
|
isDstRegFile = UTIL_isFdRegularFile(fd);
|
||||||
if (prefs->sparseFileSupport == 1) {
|
if (prefs->sparseFileSupport == 1) {
|
||||||
prefs->sparseFileSupport = ZSTD_SPARSE_DEFAULT;
|
prefs->sparseFileSupport = ZSTD_SPARSE_DEFAULT;
|
||||||
/* Check regular file after opening with O_CREAT */
|
if (!isDstRegFile) {
|
||||||
if (!UTIL_isFdRegularFile(fd)) {
|
|
||||||
prefs->sparseFileSupport = 0;
|
prefs->sparseFileSupport = 0;
|
||||||
DISPLAYLEVEL(4, "Sparse File Support is disabled when output is not a file \n");
|
DISPLAYLEVEL(4, "Sparse File Support is disabled when output is not a file \n");
|
||||||
}
|
}
|
||||||
|
@ -202,7 +202,7 @@ int UTIL_isFdRegularFile(int fd)
|
|||||||
stat_t statbuf;
|
stat_t statbuf;
|
||||||
int ret;
|
int ret;
|
||||||
UTIL_TRACE_CALL("UTIL_isFdRegularFile(%d)", fd);
|
UTIL_TRACE_CALL("UTIL_isFdRegularFile(%d)", fd);
|
||||||
ret = UTIL_fstat(fd, "", &statbuf) && UTIL_isRegularFileStat(&statbuf);
|
ret = fd >= 0 && UTIL_fstat(fd, "", &statbuf) && UTIL_isRegularFileStat(&statbuf);
|
||||||
UTIL_TRACE_RET(ret);
|
UTIL_TRACE_RET(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,8 @@ Trace:FileStat: > UTIL_isRegularFile(out/file.zst)
|
|||||||
Trace:FileStat: > UTIL_stat(-1, out/file.zst)
|
Trace:FileStat: > UTIL_stat(-1, out/file.zst)
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
|
Trace:FileStat: > UTIL_isFdRegularFile(-1)
|
||||||
|
Trace:FileStat: < 0
|
||||||
Trace:FileStat: > UTIL_isFileDescriptorPipe(out/file.zst)
|
Trace:FileStat: > UTIL_isFileDescriptorPipe(out/file.zst)
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
zstd: out/file.zst: Permission denied
|
zstd: out/file.zst: Permission denied
|
||||||
|
@ -22,6 +22,10 @@ Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
|||||||
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
|
Trace:FileStat: > UTIL_isFdRegularFile(*)
|
||||||
|
Trace:FileStat: > UTIL_stat(*, )
|
||||||
|
Trace:FileStat: < 1
|
||||||
|
Trace:FileStat: < 1
|
||||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||||
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
||||||
Trace:FileStat: < 1
|
Trace:FileStat: < 1
|
@ -14,6 +14,10 @@ Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
|||||||
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
|
Trace:FileStat: > UTIL_isFdRegularFile(*)
|
||||||
|
Trace:FileStat: > UTIL_stat(*, )
|
||||||
|
Trace:FileStat: < 1
|
||||||
|
Trace:FileStat: < 1
|
||||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||||
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
Trace:FileStat: > UTIL_stat(-1, file.zst)
|
||||||
Trace:FileStat: < 1
|
Trace:FileStat: < 1
|
@ -22,6 +22,10 @@ Trace:FileStat: > UTIL_isRegularFile(file)
|
|||||||
Trace:FileStat: > UTIL_stat(-1, file)
|
Trace:FileStat: > UTIL_stat(-1, file)
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
|
Trace:FileStat: > UTIL_isFdRegularFile(*)
|
||||||
|
Trace:FileStat: > UTIL_stat(*, )
|
||||||
|
Trace:FileStat: < 1
|
||||||
|
Trace:FileStat: < 1
|
||||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||||
Trace:FileStat: > UTIL_stat(-1, file)
|
Trace:FileStat: > UTIL_stat(-1, file)
|
||||||
Trace:FileStat: < 1
|
Trace:FileStat: < 1
|
@ -14,6 +14,10 @@ Trace:FileStat: > UTIL_isRegularFile(file)
|
|||||||
Trace:FileStat: > UTIL_stat(-1, file)
|
Trace:FileStat: > UTIL_stat(-1, file)
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
Trace:FileStat: < 0
|
Trace:FileStat: < 0
|
||||||
|
Trace:FileStat: > UTIL_isFdRegularFile(*)
|
||||||
|
Trace:FileStat: > UTIL_stat(*, )
|
||||||
|
Trace:FileStat: < 1
|
||||||
|
Trace:FileStat: < 1
|
||||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||||
Trace:FileStat: > UTIL_stat(-1, file)
|
Trace:FileStat: > UTIL_stat(-1, file)
|
||||||
Trace:FileStat: < 1
|
Trace:FileStat: < 1
|
Reference in New Issue
Block a user