GitHub user mike-jumper opened a pull request:
https://github.com/apache/guacamole-server/pull/203
GUACAMOLE-662: Fix handling of unit tests within build.
This change corrects the way unit tests are handled within the
guacamole-server build, logging the correct number of tests/passes/failures and
failing the build overall if at least one test fails.
This required:
* Removing a ton of boilerplate C test runners, replacing them with
generated code (see `util/generate-test-runner.pl` and `README-unit-testing.md`
within these changes)
* Refactoring existing tests to leverage `util/generate-test-runner.pl`,
taking the opportunity to clean up and reorganize accordingly.
* Fixing the way several of these tests `fork()` - parent/child logic was
switched, resulting in race conditions in logging of test results.
The new `util/generate-test-runner.pl` script allows unit tests to be
written as simple function declarations following conventions documented in
`README-unit-testing.md`. So long as those conventions are followed, only the
test functions themselves are required, and the necessary boilerplate to
actually run those functions, collect results, etc. is generated automatically.
**NOTE:** Merging these changes will likely result in the build failing
within CI when `make check` is run. This is actually a Good Thing, as the build
really should have been failing all this time due to
[GUACAMOLE-510](https://issues.apache.org/jira/browse/GUACAMOLE-510).
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/mike-jumper/guacamole-server fix-unit-tests
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/guacamole-server/pull/203.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #203
----
commit 2827af33d672b2b34ba9ede3a81f220c2c4a3954
Author: Michael Jumper <mjumper@...>
Date: 2018-11-14T05:35:16Z
GUACAMOLE-662: Correct fork logic (main test process should be PARENT, not
child).
commit d7118fda707cf888eede291d547aee5aa5e293c1
Author: Michael Jumper <mjumper@...>
Date: 2018-11-13T21:24:23Z
GUACAMOLE-662: Add utility script for automatically generating CUnit test
runners.
commit ca4009c9824b26af9c2785fc847dfe7f9f14bc1d
Author: Michael Jumper <mjumper@...>
Date: 2018-11-14T03:55:06Z
GUACAMOLE-662: Log test output in TAP format.
commit 877bf59cb6f64cf6ca663cfedd65efdc579874e8
Author: Michael Jumper <mjumper@...>
Date: 2018-11-14T04:34:29Z
GUACAMOLE-662: Force line-buffered output.
commit f8d57810a87654b66bf3eaf87851636d66a3132d
Author: Michael Jumper <mjumper@...>
Date: 2018-11-13T21:26:43Z
GUACAMOLE-662: Migrate tests to test runners generated by new convenience
script. Remove unnecessary test runners.
----
---