Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
run Namespace Reference

Data Structures

class  Options
 
class  TestCase
 
class  TestSuite
 

Functions

bool exclude_dir (str dirname)
 
bool exclude_file (str filename)
 
bytes read_file (str filename)
 
str diff (bytes a, bytes b)
 
typing.Tuple[typing.Optional[bytes], bytespop_line (bytes data)
 
bool glob_line_matches (bytes actual, bytes expect)
 
bytes glob_diff (bytes actual, bytes expect)
 
TestSuites get_all_tests (Options options)
 
TestSuites resolve_listed_tests (typing.List[str] tests, Options options)
 
bool run_tests (TestSuites test_suites, Options options)
 
None setup_zstd_symlink_dir (str zstd_symlink_dir, str zstd)
 

Variables

list ZSTD_SYMLINKS
 
dict EXCLUDED_DIRS
 
dict EXCLUDED_BASENAMES
 
list EXCLUDED_SUFFIXES
 
 TestSuites = typing.Dict[str, typing.List[str]]
 
 CLI_TEST_DIR = os.path.dirname(sys.argv[0])
 
 REPO_DIR = os.path.join(CLI_TEST_DIR, "..", "..")
 
 PROGRAMS_DIR = os.path.join(REPO_DIR, "programs")
 
 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
 
 action
 
 help
 
 default
 
 type
 
 int
 
 nargs
 
 args = parser.parse_args()
 
 timeout
 
 test_dir
 
 bin_dir = os.path.abspath(os.path.join(args.test_dir, "bin"))
 
 zstd_symlink_dir = os.path.join(bin_dir, "symlinks")
 
 scratch_dir = os.path.join(args.test_dir, "scratch")
 
dict env = {}
 
 opts
 
TestSuites tests = get_all_tests(opts)
 
bool success = run_tests(tests, opts)
 

Function Documentation

◆ diff()

str diff ( bytes a,
bytes b )
Returns a diff between two different byte-strings :a: and :b:.

◆ exclude_dir()

bool exclude_dir ( str dirname)
Should files under the directory :dirname: be excluded from the test runner?

◆ exclude_file()

bool exclude_file ( str filename)
Should the file :filename: be excluded from the test runner?

◆ get_all_tests()

TestSuites get_all_tests ( Options options)
Find all the test in the test directory and return the test suites.

◆ glob_diff()

bytes glob_diff ( bytes actual,
bytes expect )
Returns None if the :actual: content matches the expected glob :expect:,
otherwise returns the diff bytes.

◆ glob_line_matches()

bool glob_line_matches ( bytes actual,
bytes expect )
Does the `actual` line match the expected glob line `expect`?

◆ pop_line()

typing.Tuple[typing.Optional[bytes], bytes] pop_line ( bytes data)
Pop the first line from :data: and returns the first line and the remainder
of the data as a tuple. If :data: is empty, returns :(None, data):. Otherwise
the first line always ends in a :\n:, even if it is the last line and :data:
doesn't end in :\n:.

◆ read_file()

bytes read_file ( str filename)
Reads the file :filename: and returns the contents as bytes.

◆ resolve_listed_tests()

TestSuites resolve_listed_tests ( typing.List[str] tests,
Options options )
Resolve the list of tests passed on the command line into their
respective test suites. Tests can either be paths, or test names
relative to the test directory.

◆ run_tests()

bool run_tests ( TestSuites test_suites,
Options options )
Runs all the test in the :test_suites: with the given :options:.
Prints the results to stdout.

◆ setup_zstd_symlink_dir()

None setup_zstd_symlink_dir ( str zstd_symlink_dir,
str zstd )

Variable Documentation

◆ action

action

◆ args

args = parser.parse_args()

◆ bin_dir

bin_dir = os.path.abspath(os.path.join(args.test_dir, "bin"))

◆ CLI_TEST_DIR

CLI_TEST_DIR = os.path.dirname(sys.argv[0])

◆ DATAGEN_PATH

DATAGEN_PATH = os.path.join(TESTS_DIR, "datagen")

◆ default

default

◆ env

dict env = {}

◆ EXCLUDED_BASENAMES

dict EXCLUDED_BASENAMES
Initial value:
1= {
2 "setup",
3 "setup_once",
4 "teardown",
5 "teardown_once",
6 "README.md",
7 "run.py",
8 ".gitignore",
9}

◆ EXCLUDED_DIRS

dict EXCLUDED_DIRS
Initial value:
1= {
2 "bin",
3 "common",
4 "scratch",
5}

◆ EXCLUDED_SUFFIXES

list EXCLUDED_SUFFIXES
Initial value:
1= [
2 ".exact",
3 ".glob",
4 ".ignore",
5 ".exit",
6]

◆ help

help ( void )

◆ int

int

◆ nargs

nargs

◆ opts

opts
Initial value:
1= Options(
2 env=env,
3 timeout=args.timeout,
4 verbose=args.verbose,
5 preserve=args.preserve,
6 test_dir=args.test_dir,
7 scratch_dir=scratch_dir,
8 set_exact_output=args.set_exact_output,
9 )

◆ parser

parser
Initial value:
1= argparse.ArgumentParser(
2 (
3 "Runs the zstd CLI tests. Exits nonzero on failure. Default arguments are\n"
4 "generally correct. Pass --preserve to preserve test output for debugging,\n"
5 "and --verbose to get verbose test output.\n"
6 )
7 )

◆ PROGRAMS_DIR

PROGRAMS_DIR = os.path.join(REPO_DIR, "programs")

◆ REPO_DIR

REPO_DIR = os.path.join(CLI_TEST_DIR, "..", "..")

◆ scratch_dir

scratch_dir = os.path.join(args.test_dir, "scratch")

◆ success

bool success = run_tests(tests, opts)

◆ test_dir

test_dir

◆ tests

◆ TESTS_DIR

TESTS_DIR = os.path.join(REPO_DIR, "tests")

◆ TestSuites

TestSuites = typing.Dict[str, typing.List[str]]

◆ timeout

timeout

◆ type

type

◆ ZSTD_PATH

ZSTD_PATH = os.path.join(PROGRAMS_DIR, "zstd")

◆ zstd_symlink_dir

zstd_symlink_dir = os.path.join(bin_dir, "symlinks")

◆ ZSTD_SYMLINKS

list ZSTD_SYMLINKS
Initial value:
1= [
2 "zstd",
3 "zstdmt",
4 "unzstd",
5 "zstdcat",
6 "zcat",
7 "gzip",
8 "gunzip",
9 "gzcat",
10 "lzma",
11 "unlzma",
12 "xz",
13 "unxz",
14 "lz4",
15 "unlz4",
16]

◆ ZSTDGREP_PATH

ZSTDGREP_PATH = os.path.join(PROGRAMS_DIR, "zstdgrep")

◆ ZSTDLESS_PATH

ZSTDLESS_PATH = os.path.join(PROGRAMS_DIR, "zstdless")