mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
fixed compression with -c with multiple files on Windows
This commit is contained in:
@ -95,5 +95,5 @@ test_script:
|
|||||||
projects\fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
projects\fuzzer_VS2012_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
||||||
projects\fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
projects\fuzzer_VS2013_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
||||||
projects\fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
projects\fuzzer_VS2015_%PLATFORM%_Release.exe %FUZZERTEST% &&
|
||||||
zstd_VS2015_%PLATFORM%_Release.exe
|
REM zstd_VS2015_%PLATFORM%_Release.exe
|
||||||
)
|
)
|
||||||
|
@ -71,7 +71,7 @@
|
|||||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
||||||
# include <fcntl.h> /* _O_BINARY */
|
# include <fcntl.h> /* _O_BINARY */
|
||||||
# include <io.h> /* _setmode, _isatty */
|
# include <io.h> /* _setmode, _isatty */
|
||||||
# define SET_BINARY_MODE(file) { int unused = _setmode(_fileno(file), _O_BINARY); (void)unused; }
|
# define SET_BINARY_MODE(file) { if (_setmode(_fileno(file), _O_BINARY) == -1) perror("Cannot set _O_BINARY"); }
|
||||||
#else
|
#else
|
||||||
# include <unistd.h> /* isatty */
|
# include <unistd.h> /* isatty */
|
||||||
# define SET_BINARY_MODE(file)
|
# define SET_BINARY_MODE(file)
|
||||||
@ -439,6 +439,7 @@ int FIO_compressMultipleFilenames(const char** inFileNamesTable, unsigned nbFile
|
|||||||
if (!strcmp(suffix, stdoutmark)) {
|
if (!strcmp(suffix, stdoutmark)) {
|
||||||
unsigned u;
|
unsigned u;
|
||||||
ress.dstFile = stdout;
|
ress.dstFile = stdout;
|
||||||
|
SET_BINARY_MODE(stdout);
|
||||||
for (u=0; u<nbFiles; u++)
|
for (u=0; u<nbFiles; u++)
|
||||||
missed_files += FIO_compressFilename_srcFile(ress, stdoutmark,
|
missed_files += FIO_compressFilename_srcFile(ress, stdoutmark,
|
||||||
inFileNamesTable[u], compressionLevel);
|
inFileNamesTable[u], compressionLevel);
|
||||||
|
@ -23,7 +23,7 @@ roundTripTest() {
|
|||||||
[ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
|
[ -n "$ZSTD" ] || die "ZSTD variable must be defined!"
|
||||||
|
|
||||||
|
|
||||||
echo "\n**** simple tests **** "
|
echo -e "\n**** simple tests **** "
|
||||||
./datagen > tmp
|
./datagen > tmp
|
||||||
$ZSTD -f tmp # trivial compression case, creates tmp.zst
|
$ZSTD -f tmp # trivial compression case, creates tmp.zst
|
||||||
$ZSTD -df tmp.zst # trivial decompression case (overwrites tmp)
|
$ZSTD -df tmp.zst # trivial decompression case (overwrites tmp)
|
||||||
@ -51,7 +51,7 @@ cp tmp tmp2.zst
|
|||||||
$ZSTD -df tmp2.zst && die "should have failed : wrong format"
|
$ZSTD -df tmp2.zst && die "should have failed : wrong format"
|
||||||
rm tmp2.zst
|
rm tmp2.zst
|
||||||
|
|
||||||
echo "\n**** frame concatenation **** "
|
echo -e "\n**** frame concatenation **** "
|
||||||
|
|
||||||
echo "hello " > hello.tmp
|
echo "hello " > hello.tmp
|
||||||
echo "world!" > world.tmp
|
echo "world!" > world.tmp
|
||||||
@ -67,7 +67,7 @@ rm ./*.tmp ./*.zstd
|
|||||||
echo frame concatenation test completed
|
echo frame concatenation test completed
|
||||||
|
|
||||||
|
|
||||||
echo "\n**** dictionary tests **** "
|
echo -e "\n**** dictionary tests **** "
|
||||||
|
|
||||||
./datagen > tmpDict
|
./datagen > tmpDict
|
||||||
./datagen -g1M | md5sum > tmp1
|
./datagen -g1M | md5sum > tmp1
|
||||||
@ -79,7 +79,7 @@ $ZSTD -d tmp -D tmpDict -of result
|
|||||||
fc xxhash.c result
|
fc xxhash.c result
|
||||||
|
|
||||||
|
|
||||||
echo "\n**** multiple files tests **** "
|
echo -e "\n**** multiple files tests **** "
|
||||||
|
|
||||||
./datagen -s1 > tmp1 2> /dev/null
|
./datagen -s1 > tmp1 2> /dev/null
|
||||||
./datagen -s2 -g100K > tmp2 2> /dev/null
|
./datagen -s2 -g100K > tmp2 2> /dev/null
|
||||||
@ -96,12 +96,12 @@ $ZSTD -c tmp1 tmp2 tmp3 > tmpall
|
|||||||
ls -ls tmp*
|
ls -ls tmp*
|
||||||
echo "decompress tmpall* into stdout > tmpdec : "
|
echo "decompress tmpall* into stdout > tmpdec : "
|
||||||
cp tmpall tmpall2
|
cp tmpall tmpall2
|
||||||
# $ZSTD -dc tmpall* > tmpdec
|
$ZSTD -dc tmpall* > tmpdec
|
||||||
ls -ls tmp*
|
ls -ls tmp*
|
||||||
echo "compress multiple files including a missing one (notHere) : "
|
echo "compress multiple files including a missing one (notHere) : "
|
||||||
$ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!"
|
$ZSTD -f tmp1 notHere tmp2 && die "missing file not detected!"
|
||||||
|
|
||||||
echo "\n**** integrity tests **** "
|
echo -e "\n**** integrity tests **** "
|
||||||
echo "test one file (tmp1.zst) "
|
echo "test one file (tmp1.zst) "
|
||||||
$ZSTD -t tmp1.zst
|
$ZSTD -t tmp1.zst
|
||||||
$ZSTD --test tmp1.zst
|
$ZSTD --test tmp1.zst
|
||||||
@ -110,7 +110,7 @@ $ZSTD -t *.zst
|
|||||||
echo "test good and bad files (*) "
|
echo "test good and bad files (*) "
|
||||||
$ZSTD -t * && die "bad files not detected !"
|
$ZSTD -t * && die "bad files not detected !"
|
||||||
|
|
||||||
echo "\n**** zstd round-trip tests **** "
|
echo -e "\n**** zstd round-trip tests **** "
|
||||||
|
|
||||||
roundTripTest
|
roundTripTest
|
||||||
roundTripTest -g15K # TableID==3
|
roundTripTest -g15K # TableID==3
|
||||||
|
@ -49,14 +49,11 @@
|
|||||||
* OS-specific Includes
|
* OS-specific Includes
|
||||||
**************************************/
|
**************************************/
|
||||||
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
#if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__)
|
||||||
# include <fcntl.h> /* _O_BINARY */
|
# include <io.h> /* _isatty */
|
||||||
# include <io.h> /* _setmode, _isatty */
|
|
||||||
# define SET_BINARY_MODE(file) _setmode(_fileno(file), _O_BINARY)
|
|
||||||
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
|
# define IS_CONSOLE(stdStream) _isatty(_fileno(stdStream))
|
||||||
#else
|
#else
|
||||||
extern int fileno(FILE *stream); /* triggers fileno() within <stdio.h> on POSIX */
|
extern int fileno(FILE *stream); /* triggers fileno() within <stdio.h> on POSIX */
|
||||||
# include <unistd.h> /* isatty */
|
# include <unistd.h> /* isatty */
|
||||||
# define SET_BINARY_MODE(file)
|
|
||||||
# define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
|
# define IS_CONSOLE(stdStream) isatty(fileno(stdStream))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user