Skip to content

Commit

Permalink
Merge pull request #165 from yast/huha-fix-testsuite
Browse files Browse the repository at this point in the history
Recoded ISO-8859-1 to UTF-8 to prevent build failure (bsc#1217523)
  • Loading branch information
shundhammer authored Nov 28, 2023
2 parents 025f5a9 + 7cbbaac commit f024117
Show file tree
Hide file tree
Showing 10 changed files with 87 additions and 1,324 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 ...
```


10 changes: 3 additions & 7 deletions libycp/testsuite/tests/builtin/Builtin-String1.err
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,22 @@ Parsed:
----------------------------------------------------------------------
Parsed:
----------------------------------------------------------------------
"** tolower and toascii **"
"** tolower **"
----------------------------------------------------------------------
Parsed:
----------------------------------------------------------------------
tolower ("aBcDeF")
----------------------------------------------------------------------
Parsed:
----------------------------------------------------------------------
toascii ("a�B�c")
----------------------------------------------------------------------
Parsed:
----------------------------------------------------------------------
"** find et.al. **"
----------------------------------------------------------------------
[Parser] tests/builtin/Builtin-String1.ycp:45 Warning: find(...) is deprecated, please fix
[Parser] tests/builtin/Builtin-String1.ycp:43 Warning: find(...) is deprecated, please fix
Parsed:
----------------------------------------------------------------------
find ("abcdefghi", "efg")
----------------------------------------------------------------------
[Parser] tests/builtin/Builtin-String1.ycp:46 Warning: find(...) is deprecated, please fix
[Parser] tests/builtin/Builtin-String1.ycp:44 Warning: find(...) is deprecated, please fix
Parsed:
----------------------------------------------------------------------
find ("aaaaa", "z")
Expand Down
3 changes: 1 addition & 2 deletions libycp/testsuite/tests/builtin/Builtin-String1.out
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@
("")
("")
("** crypt - disabled **")
("** tolower and toascii **")
("** tolower **")
("abcdef")
("aBc")
("** find et.al. **")
(4)
(-1)
Expand Down
4 changes: 1 addition & 3 deletions libycp/testsuite/tests/builtin/Builtin-String1.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,9 @@
//(cryptmd5 ("readable"))


("** tolower and toascii **")
("** tolower **")

(tolower ("aBcDeF"))
(toascii ("a�B�c"))


("** find et.al. **")

Expand Down
Loading

0 comments on commit f024117

Please sign in to comment.