mirror of
https://github.com/facebook/zstd.git
synced 2025-08-01 09:47:01 +03:00
added tests
This commit is contained in:
@ -962,7 +962,7 @@ int main(int argCount, const char* argv[])
|
|||||||
if (!strcmp(argument, "--help")) { usageAdvanced(programName); CLEAN_RETURN(0); }
|
if (!strcmp(argument, "--help")) { usageAdvanced(programName); CLEAN_RETURN(0); }
|
||||||
if (!strcmp(argument, "--verbose")) { g_displayLevel++; continue; }
|
if (!strcmp(argument, "--verbose")) { g_displayLevel++; continue; }
|
||||||
if (!strcmp(argument, "--quiet")) { g_displayLevel--; continue; }
|
if (!strcmp(argument, "--quiet")) { g_displayLevel--; continue; }
|
||||||
if (!strcmp(argument, "--stdout")) { forceStdout=1; outFileName=stdoutmark; removeSrcFile=0; continue; }
|
if (!strcmp(argument, "--stdout")) { forceStdout=1; outFileName=stdoutmark; continue; }
|
||||||
if (!strcmp(argument, "--ultra")) { ultra=1; continue; }
|
if (!strcmp(argument, "--ultra")) { ultra=1; continue; }
|
||||||
if (!strcmp(argument, "--check")) { FIO_setChecksumFlag(prefs, 2); continue; }
|
if (!strcmp(argument, "--check")) { FIO_setChecksumFlag(prefs, 2); continue; }
|
||||||
if (!strcmp(argument, "--no-check")) { FIO_setChecksumFlag(prefs, 0); continue; }
|
if (!strcmp(argument, "--no-check")) { FIO_setChecksumFlag(prefs, 0); continue; }
|
||||||
@ -1367,14 +1367,6 @@ int main(int argCount, const char* argv[])
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* disable --rm when writing to stdout */
|
|
||||||
if (!strcmp(outFileName, stdoutmark)) {
|
|
||||||
if (removeSrcFile) {
|
|
||||||
DISPLAYLEVEL(2, "warning: source not removed when writing to stdout \n");
|
|
||||||
removeSrcFile = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if benchmark is selected */
|
/* Check if benchmark is selected */
|
||||||
if (operation==zom_bench) {
|
if (operation==zom_bench) {
|
||||||
#ifndef ZSTD_NOBENCH
|
#ifndef ZSTD_NOBENCH
|
||||||
|
@ -234,12 +234,23 @@ unset ZSTD_CLEVEL
|
|||||||
println "test : compress to stdout"
|
println "test : compress to stdout"
|
||||||
zstd tmp -c > tmpCompressed
|
zstd tmp -c > tmpCompressed
|
||||||
zstd tmp --stdout > tmpCompressed # long command format
|
zstd tmp --stdout > tmpCompressed # long command format
|
||||||
println "test : compress to named file"
|
|
||||||
|
println "test : compress to named file (-o)"
|
||||||
rm -f tmpCompressed
|
rm -f tmpCompressed
|
||||||
zstd tmp -o tmpCompressed
|
zstd tmp -o tmpCompressed
|
||||||
test -f tmpCompressed # file must be created
|
test -f tmpCompressed # file must be created
|
||||||
|
|
||||||
println "test : force write, correct order"
|
println "test : force write, correct order"
|
||||||
zstd tmp -fo tmpCompressed
|
zstd tmp -fo tmpCompressed
|
||||||
|
|
||||||
|
println "test : -c + -o : last one wins"
|
||||||
|
rm -f tmpOut
|
||||||
|
zstd tmp -c > tmpCompressed -o tmpOut
|
||||||
|
test -f tmpOut # file must be created
|
||||||
|
rm -f tmpCompressed
|
||||||
|
zstd tmp -o tmpOut -c > tmpCompressed
|
||||||
|
test -f tmpCompressed # file must be created
|
||||||
|
|
||||||
println "test : forgotten argument"
|
println "test : forgotten argument"
|
||||||
cp tmp tmp2
|
cp tmp tmp2
|
||||||
zstd tmp2 -fo && die "-o must be followed by filename "
|
zstd tmp2 -fo && die "-o must be followed by filename "
|
||||||
@ -394,6 +405,8 @@ println "test: --rm is disabled when output is stdout"
|
|||||||
test -f tmp
|
test -f tmp
|
||||||
zstd --rm tmp -c > $INTOVOID
|
zstd --rm tmp -c > $INTOVOID
|
||||||
test -f tmp # tmp shall still be there
|
test -f tmp # tmp shall still be there
|
||||||
|
zstd --rm tmp --stdout > $INTOVOID
|
||||||
|
test -f tmp # tmp shall still be there
|
||||||
zstd -f --rm tmp -c > $INTOVOID
|
zstd -f --rm tmp -c > $INTOVOID
|
||||||
test -f tmp # tmp shall still be there
|
test -f tmp # tmp shall still be there
|
||||||
zstd -f tmp -c > $INTOVOID --rm
|
zstd -f tmp -c > $INTOVOID --rm
|
||||||
@ -411,7 +424,22 @@ zstd -f tmp tmp2 -o tmp3.zst --rm # just warns, no prompt
|
|||||||
test -f tmp
|
test -f tmp
|
||||||
test -f tmp2
|
test -f tmp2
|
||||||
zstd -q tmp tmp2 -o tmp3.zst --rm && die "should refuse to concatenate"
|
zstd -q tmp tmp2 -o tmp3.zst --rm && die "should refuse to concatenate"
|
||||||
|
println "test: --rm is active with -o when single input"
|
||||||
|
rm -f tmp2.zst
|
||||||
|
zstd --rm tmp2 -o tmp2.zst
|
||||||
|
test -f tmp2.zst
|
||||||
|
test ! -f tmp2
|
||||||
|
println "test: -c followed by -o => -o wins, so --rm remains active" # (#3719)
|
||||||
|
rm tmp2.zst
|
||||||
|
cp tmp tmp2
|
||||||
|
zstd --rm tmp2 -c > $INTOVOID -o tmp2.zst
|
||||||
|
test ! -f tmp2
|
||||||
|
println "test: -o followed by -c => -c wins, so --rm is disabled" # (#3719)
|
||||||
|
rm tmp3.zst
|
||||||
|
cp tmp tmp2
|
||||||
|
zstd -v --rm tmp2 -o tmp2.zst -c > tmp3.zst
|
||||||
|
test -f tmp2
|
||||||
|
test -f tmp3.zst
|
||||||
println "test : should quietly not remove non-regular file"
|
println "test : should quietly not remove non-regular file"
|
||||||
println hello > tmp
|
println hello > tmp
|
||||||
zstd tmp -f -o "$DEVDEVICE" 2>tmplog > "$INTOVOID"
|
zstd tmp -f -o "$DEVDEVICE" 2>tmplog > "$INTOVOID"
|
||||||
|
Reference in New Issue
Block a user