Skip to content

Commit

Permalink
Improved docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shundhammer committed Nov 28, 2023
1 parent 339808f commit 7c68eba
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 16 deletions.
16 changes: 0 additions & 16 deletions libycp/testsuite/README

This file was deleted.

75 changes: 75 additions & 0 deletions libycp/testsuite/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
## libycp testsuite

### Overview

The ycp testsuite tests the libycp by running all .ycp files in
the ycp.test directory (tests/*.ycp) through runycp.

Every run results in a stdout and stderr output which is
checked against .out and .err respectively.

The file lib/ycp.exp defines a function which runs all tests
contained in tests (i.e. makes a 'glob' on tests/*.ycp)

For every .ycp file you put in tests, you must create the proper
.out and .err file with the following command

runycp < file.ycp > file.out 2> file.err



### Running all Tests

```
make check
```


### Fixing a Failed Test

After running the tests, the `testsuite` directory contains the _actual_ stdout
and stderr files for each individual test, e.g.

- `tmp.out.Builtin-List2`
- `tmp.err.Builtin-List2`

For a failing test, use `diff` to compare the _expected_ stdout and stderr file
in the subdirectory that contains the test against those _actual_ files.

If you are sure that the difference is legitimate, copy the actual stdout file
to the expected stdout file and the actual stderr fil to the expected stderr
file and commit the file(s) to Git.

Check the diff:

```
cd tests/builtin
diff ../../tmp.out.Builtin-List2 Builtin-List2.out
diff ../../tmp.err.Builtin-List2 Builtin-List2.err
```

Looks okay? Then:

```
cp ../../tmp.out.Builtin-List2 Builtin-List2.out
cp ../../tmp.err.Builtin-List2 Builtin-List2.err
```

Run the tests again to make sure it's now really okay:

```
cd ../..
make check
```

Okay now? Check the changes in:

```
cd tests/builtin
git checkin -a -m "Fixed tests"
git push ...
```


0 comments on commit 7c68eba

Please sign in to comment.