mirror of
https://github.com/facebook/zstd.git
synced 2025-09-16 09:36:32 +02:00
[cli-tests] Add tests that use --trace-file-stat
Basic tests for (de)compressing in the following modes: * file to file * file to stdout * stdin to file * stdin to stdout These are basic tests, and aren't testing more advanced scenarios, but it adds the groundwork for more complex tests as needed. Fixes #3010.
This commit is contained in:
8
tests/cli-tests/file-stat/compress-file-to-file.sh
Executable file
8
tests/cli-tests/file-stat/compress-file-to-file.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd file -q --trace-file-stat -o file.zst
|
||||
zstd -tq file.zst
|
@@ -0,0 +1,36 @@
|
||||
Trace:FileStat: > UTIL_isLink(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
||||
Trace:FileStat: > UTIL_isDirectory(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isSameFile(file, file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
||||
Trace:FileStat: > UTIL_utime(file.zst)
|
||||
Trace:FileStat: < 0
|
8
tests/cli-tests/file-stat/compress-file-to-stdout.sh
Executable file
8
tests/cli-tests/file-stat/compress-file-to-stdout.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd file -cq --trace-file-stat > file.zst
|
||||
zstd -tq file.zst
|
@@ -0,0 +1,22 @@
|
||||
Trace:FileStat: > UTIL_isLink(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
||||
Trace:FileStat: > UTIL_isDirectory(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 65537
|
8
tests/cli-tests/file-stat/compress-stdin-to-file.sh
Executable file
8
tests/cli-tests/file-stat/compress-stdin-to-file.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd < file -q --trace-file-stat -o file.zst
|
||||
zstd -tq file.zst
|
@@ -0,0 +1,28 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isSameFile(/*stdin*\, file.zst)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
8
tests/cli-tests/file-stat/compress-stdin-to-stdout.sh
Executable file
8
tests/cli-tests/file-stat/compress-stdin-to-stdout.sh
Executable file
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen > file
|
||||
|
||||
zstd < file -cq --trace-file-stat > file.zst
|
||||
zstd -tq file.zst
|
@@ -0,0 +1,20 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_getFileSize(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < -1
|
7
tests/cli-tests/file-stat/decompress-file-to-file.sh
Executable file
7
tests/cli-tests/file-stat/decompress-file-to-file.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dq --trace-file-stat file.zst
|
@@ -0,0 +1,30 @@
|
||||
Trace:FileStat: > UTIL_isLink(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isSameFile(file.zst, file)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_utime(file)
|
||||
Trace:FileStat: < 0
|
7
tests/cli-tests/file-stat/decompress-file-to-stdout.sh
Executable file
7
tests/cli-tests/file-stat/decompress-file-to-stdout.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dcq --trace-file-stat file.zst > file
|
@@ -0,0 +1,14 @@
|
||||
Trace:FileStat: > UTIL_isLink(file.zst)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(file.zst)
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_stat(file.zst)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
7
tests/cli-tests/file-stat/decompress-stdin-to-file.sh
Executable file
7
tests/cli-tests/file-stat/decompress-stdin-to-file.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dcq --trace-file-stat < file.zst -o file
|
@@ -0,0 +1,20 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(2)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isSameFile(/*stdin*\, file)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(file)
|
||||
Trace:FileStat: > UTIL_stat(file)
|
||||
Trace:FileStat: < 1
|
||||
Trace:FileStat: < 1
|
7
tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh
Executable file
7
tests/cli-tests/file-stat/decompress-stdin-to-stdout.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
datagen | zstd -q > file.zst
|
||||
|
||||
zstd -dcq --trace-file-stat < file.zst > file
|
@@ -0,0 +1,12 @@
|
||||
Trace:FileStat: > UTIL_isConsole(0)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isConsole(1)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isDirectory(/*stdin*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdin*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: > UTIL_isRegularFile(/*stdout*\)
|
||||
Trace:FileStat: > UTIL_stat(/*stdout*\)
|
||||
Trace:FileStat: < 0
|
||||
Trace:FileStat: < 0
|
Reference in New Issue
Block a user