Move zstdgrep and zstdless tests to cli-tests (#3057)

* Move zstdgrep and zstdless tests to cli-tests

Co-authored-by: Binh Vo <binhvo@fb.com>
This commit is contained in:
binhdvo
2022-02-09 11:21:33 -05:00
committed by GitHub
co-authored by Binh Vo
parent 7e364e8828
commit 936ae8a3a0
11 changed files with 46 additions and 27 deletions
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
"$ZSTDLESS_BIN" $@
+6
View File
@@ -0,0 +1,6 @@
#!/bin/sh
set -e
echo "1234" > file
zstd file
+8
View File
@@ -0,0 +1,8 @@
#!/bin/sh
set -e
println "+ good path"
zstdgrep "1234" file file.zst
println "+ bad path"
zstdgrep "1234" bad.zst
+1
View File
@@ -0,0 +1 @@
1
@@ -0,0 +1 @@
zstd: can't stat bad.zst : No such file or directory -- ignored
@@ -0,0 +1,4 @@
+ good path
file:1234
file.zst:1234
+ bad path
+10
View File
@@ -0,0 +1,10 @@
#!/bin/sh
set -e
println "+ good path"
zstdless file.zst
println "+ pass parameters"
zstdless -N file.zst # This parameter does not produce line #s when piped, but still serves to test that the flag went to less and not zstd
println "+ bad path"
zstdless bad.zst
@@ -0,0 +1,2 @@
zstd: can't stat bad.zst : No such file or directory -- ignored
bad.zst: No such file or directory
@@ -0,0 +1,5 @@
+ good path
1234
+ pass parameters
1234
+ bad path
+7
View File
@@ -627,6 +627,7 @@ if __name__ == "__main__":
TESTS_DIR = os.path.join(REPO_DIR, "tests")
ZSTD_PATH = os.path.join(PROGRAMS_DIR, "zstd")
ZSTDGREP_PATH = os.path.join(PROGRAMS_DIR, "zstdgrep")
ZSTDLESS_PATH = os.path.join(PROGRAMS_DIR, "zstdless")
DATAGEN_PATH = os.path.join(TESTS_DIR, "datagen")
parser = argparse.ArgumentParser(
@@ -658,6 +659,11 @@ if __name__ == "__main__":
default=ZSTDGREP_PATH,
help="Sets the ZSTDGREP_BIN environment variable. Path of the zstdgrep CLI."
)
parser.add_argument(
"--zstdless",
default=ZSTDLESS_PATH,
help="Sets the ZSTDLESS_BIN environment variable. Path of the zstdless CLI."
)
parser.add_argument(
"--datagen",
default=DATAGEN_PATH,
@@ -695,6 +701,7 @@ if __name__ == "__main__":
env["ZSTD_SYMLINK_DIR"] = zstd_symlink_dir
env["DATAGEN_BIN"] = os.path.abspath(args.datagen)
env["ZSTDGREP_BIN"] = os.path.abspath(args.zstdgrep)
env["ZSTDLESS_BIN"] = os.path.abspath(args.zstdless)
env["COMMON"] = os.path.abspath(os.path.join(args.test_dir, "common"))
env["PATH"] = bin_dir + ":" + os.getenv("PATH", "")