Skip to content

Commit

Permalink
buildsys: introduce input-verify subcommand to misc/units
Browse files Browse the repository at this point in the history
Conceptualy derived from a pull request, universal-ctags#1909 sent by @ahakanbaba.

A example session:
$ bash misc/units verify-input Units misc/verifiers
..
Category: ROOT
------------------------------------------------------------
simple-json.d/input.json with jq                                 valid
zephir-simple.d/input.zep with zoop                              unavailable

Summary
------------------------------------------------------------
  #valid:                                 44
  #invalid:                               19
  #skipped (known invalidation)           1
  #skipped (verifier unavailable)         1

Unavailable verifiers
------------------------------------------------------------
	zoop

You can specify verfiiers to use with --verifiers= option.
$ dash misc/units verify-input --verifiers=jq Units misc/verifiers
..

Usage:
A test case developer puts "verfier" file to one's test case directory
or one's category directory. Put a name of verifier to the file.
If the file is at a category directory (Units/*.r), the verifier specified
in a file is used for verifying all input files under the category.
Put "verify" file in a test case directory to override the verifier specified
in the category directory.
"KNOWN-INVALIDATION" is a special verifier. If the input is kept invalid
intentionally, specify the verifier.

A verifier developer writes verifier-foo file and puts it to misc/verifiers.
Shell is suitable for writing the file. The execution bit of the file must be set.
Here, "foo" is the name of verifier which may be specified in "verfier" files
under Units. The file name is made a bit redundant.

misc/units runs a verifier command in two different modes.
If "is_runnable" subcommand is given as the first argument, return 0 if
the verifier is ready to run. A verifier may depend on external
tools. If the verifier cannot find the external tools in the runtime environment,
the verifier exits with non-zero. misc/units never runs the verifier if the
verifier exits with non-zero for the subcommand.

If "verify" subcommand is given as the frist argument, the script
do verify the input file passed as the second argument. It returns
0 if the input is valid, or non-zero if it is invalid.

TODO:
The above memo should be written in docs/testing.rst.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
  • Loading branch information
masatake committed Oct 19, 2018
1 parent 3bdc816 commit 8cee479
Show file tree
Hide file tree
Showing 3 changed files with 509 additions and 2 deletions.
Loading

0 comments on commit 8cee479

Please sign in to comment.