diff options
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 58 | 
1 files changed, 50 insertions, 8 deletions
| @@ -56,14 +56,26 @@ cmake --build build  erebos-tester --verbose  ``` -To run tests from a given test file, pass it as command-line argument: +To run all tests from project configuration (see below), run the tester without any argument:  ``` -erebos-tester path/to/script.test +erebos-tester +``` + +To run only some named tests, list the names on command line: +``` +erebos-tester FirstTest SecondTest +``` + +To run tests from a given test file, pass it as command-line argument (the path +must contain a slash, so use e.g. `./script.et` for script in the current +directory): +``` +erebos-tester path/to/script.et  ```  To select single test from a file, use `:` separator:  ``` -erebos-tester path/to/script.test:TestName +erebos-tester path/to/script.et:TestName  ```  Configuration @@ -76,6 +88,7 @@ This is a YAML file with following fields:  * `tool`: path to the test tool, which may be overridden by the `--tool` command-line option.  * `tests`: glob pattern that expands to all the test script files that should be used. +* `timeout`: initial timeout for test steps like `expect`, given as `int` or `float`; defaults to `1` if not specified.  Script language  --------------- @@ -166,6 +179,7 @@ let re2 = /$str$re1/ # match '.' followed by any character  #### boolean  Result of comparison operators `==` and `/=`. +Values are `True` and `False`.  #### network @@ -231,11 +245,12 @@ node <name> [on <network>]  Create a node on network `<network>` (or context network if omitted) and assign the new node to the variable `<name>`.  ``` -spawn as <name> [on (<node> | <network>)] +spawn as <name> [on (<node> | <network>)] [args <arguments>]  ```  Spawn a new test process on `<node>` or `<network>` (or one from context) and assign the new process to variable `<name>`.  When spawning on network, create a new node for this process. +Extra `<arguments>` to the tool can be given as a list of strings using the `args` keyword.  The process is terminated when the variable `<name>` goes out of scope (at the end of the block in which it was created) by closing its stdin.  When the process fails to terminate successfully within a timeout, the test fails. @@ -246,7 +261,7 @@ send <string> to <process>  Send line with `<string>` to the standard input of `<process>`.  ``` -expect <regex> from <process> [capture <var1> [, <var2> ... ]] +expect <regex> from <process> [timeout <timeout>] [capture <var1> [, <var2> ... ]]  ```  Check whether `<process>` produces line matching `<regex>` on standard output, and if this does not happen within current timeout, the test fails.  Output lines produced before starting this command and not matched by some previous `expect` are accepted as well. @@ -259,6 +274,9 @@ The regular expression can contain capture groups – parts enclosed in parenthe  In that case the expect command has to have the `capture` clause with matching number of variable names.  Results of the captures are then assigned to the newly created variables as strings. +If the `timeout` clause is used, the current timeout value is multiplied by the given `<timeout>` for this `expect` call. +Timeout of zero can be used to expect a matching output line to have been already produced in the past. +  ```  flush [from <proc>] [matching <regex>]  ``` @@ -267,6 +285,15 @@ Flush memory of `<proc>` output, so no following `expect` command will match any  If the `matching` clause is used, discard only output lines matching `<regex>`.  ``` +ignore [from <proc>] [matching <regex>] +``` + +Ignore output lines from `<proc>` (or context process) that match the given +`<regex>` (or all lines if the `matching` clause is not used). Affects both +past and future output of the process; the effect lasts until the end of +the block. + +```  guard <expr>  ``` @@ -322,6 +349,13 @@ with <expr>:  Execute `<test block>` with `<expr>` as context.  ``` +multiply_timeout by <multiplier> +``` + +Modify the timeout used for commands like `expect` by multiplying it with `<multiplier>`. +The effect lasts until the end of the block. + +```  wait  ``` @@ -453,9 +487,17 @@ test:      send to p "use-asset ${my_asset.path}"  ``` -The `my_asset.path` expression expands to a strict containing path to the asset -that can be used by the spawn process `p`. The process should not try to modify -the file. +The `my_asset.path` expression expands to a string containing path to the asset +that can be used by the spawned process `p`. The process should not try to +modify the file. + +Assets can be exported for use in other modules using the `export` keyword, +just like other definitions: + +``` +export asset my_asset: +    path: ../path/to/file +```  Optional dependencies |