提交 f67522e3 作者: Christian Couder

sharness/README: add writing tests and debugging

Add information from the discussion of PR #891.
While at it, suggest using -v and -i options to debug one test.

License: MIT
Signed-off-by: 's avatarChristian Couder <chriscool@tuxfamily.org>
上级 ae35bd26
......@@ -16,7 +16,6 @@ The usual ipfs env flags also apply:
IPFS_LOGGING=debug TEST_VERBOSE=1 make
```
## Running just one test
You can run only one test script by launching it like a regular shell
......@@ -26,6 +25,16 @@ script:
$ ./t0010-basic-commands.sh
```
## Debugging one test
You can use the `-v` option to make it verbose and the `-i` option to
make it stop as soon as one test fails.
For example:
```
$ ./t0010-basic-commands.sh -v -i
```
## Sharness
When running "make" in this directory for the first time, sharness
......@@ -40,6 +49,17 @@ send pull requests there.
## Writing Tests
Please have a look at existing tests and try to follow their example.
When possible and not too inefficient, that means most of the time,
an ipfs command should not be on the left side of a pipe, because if
the ipfs command fails (exit non zero), the pipe will mask this failure.
For example after `false | true`, `echo $?` prints 0 (despite `false`
failing).
It should be possible to put most of the code inside `test_expect_success`,
or sometimes `test_expect_failure`, blocks, and to chain all the commands
inside those blocks with `&&`, or `||` for diagnostic commands.
### Diagnostics
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论