Commit Graph
22 Commits
Author SHA1 Message Date
Joachim Nilsson ebe3888d6f Minor, whitespace fixes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 23:23:43 +02:00
Joachim Nilsson 99ef6eb884 Remove __attribute__ ((unused)), use -Wno-unused-parameter instead
The __attribute__ ((unused)) is useful sometimes to declare variables as
intended to be unused, e.g. in callback functions.  However, they tend
to clutter up the code making hard to read.  We therefore remove all
uses of it and instead set -Wno-unused-parameter.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-25 23:19:02 +02:00
Joachim Nilsson 6ae98d135c tests: Restart stopped timer before calling uev_exit()
There's an issue with uftpd not exiting properly.  Cannot nail it down
properly but it seems to be related to the stopping of active timers.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-04 07:11:23 +02:00
Joachim Nilsson 2ff15101ae New API test to verify uev_exit() terminates properly
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-09-01 18:54:56 +02:00
Joachim Nilsson 748ebc998c Minor, whitespace
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-28 21:17:43 +01:00
Joachim Nilsson 0e97bfdc5a tests/: Return result of tests, not return value of uev_run()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2018-01-28 16:32:38 +01:00
Joachim Nilsson 2bea4192db Handle UEV_HUP properly in examples and unit tests
If an I/O watcher callback fails to read(), returning zero, we check
events for UEV_HUP to detect EOF or socket remote end shutdown().

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 12:56:39 +01:00
Joachim Nilsson ebb574136b Make sure to restart I/O watcher when event loop returns error
This patch adds UEV_ERROR handling to the test I/O watcher, restarting
the watcher properly.  Also, additional error handling to read(), which
was unchecked and failed when fuzzing the libc read() function.

We also take the opportunity to document the reasons for when using the
w->fd (watcher descriptor) and when *not* to in the test.  Even to the
author this was confusing and looked suspicious.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 12:17:41 +01:00
Joachim Nilsson d7485c59ec Fix logical error, read before set, found by Valgrind
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 12:17:41 +01:00
Joachim Nilsson 505a7214a8 tests: Add basic error handling to callbacks, for reference
Many users look at both examples *and* unit tests to learn how to use a
library.  We should pride ourselves in that we have not just working but
also correct and readable tests.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-11-14 12:17:41 +01:00
Joachim Nilsson ed5c9bb06c Relocate source fiiles to src/ subdirectory
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2017-09-19 08:12:21 +02:00
Joachim Nilsson aa62e60137 Ensure check.h is included for all unit tests
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-27 20:30:19 +01:00
Joachim Nilsson e765e42eb9 Verify that a timer can be stopped *before* uev_run()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-25 17:28:15 +01:00
Joachim Nilsson 56a2e7ff30 Unit test for new active API
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-23 23:20:48 +01:00
Joachim Nilsson 73ae8ba098 complete: Update test for unit test framework
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 01:30:40 +01:00
Joachim Nilsson 6a19fa7e93 cronrun: Update cron test to verify interval as well
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 01:27:49 +01:00
Joachim Nilsson de4d969ca0 Move complete test from examples/ --> tests/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 01:12:47 +01:00
Joachim Nilsson 389c3b27ab Move cronrun test from examples/ --> tests/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 01:09:38 +01:00
Joachim Nilsson 03a29440ef Move signal test from examples/ --> tests/
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 01:06:48 +01:00
Joachim Nilsson 9b3af80082 Add .gitignore for unit tests
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 00:37:39 +01:00
Joachim Nilsson 8f2c9f7f0e Add timer.c unit test
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 00:36:21 +01:00
Joachim Nilsson 6a21b7a90b Add unit testing framework from libite (-lite)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
2016-11-22 00:35:19 +01:00