summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-04-16 20:21:37 +0200
committerFrantisek Sumsal <frantisek@sumsal.cz>2023-04-16 20:30:58 +0200
commit3d9c3b7e89fd7b48cdabe76ef8aa5d54143e7575 (patch)
treed33a1ddc1f54e718151628e7d64af71fe18d394c /src/test
parent451812680755bdf62512bc3c174278280d5ce9cb (diff)
downloadsystemd-3d9c3b7e89fd7b48cdabe76ef8aa5d54143e7575.tar.gz
test: modernize test-async a bit
Mainly to give it some debug output to, hopefully, see why it sometimes gets stuck in CI when run with sanitizers.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test-async.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/test/test-async.c b/src/test/test-async.c
index b97fedcfc6..69785e47fa 100644
--- a/src/test/test-async.c
+++ b/src/test/test-async.c
@@ -4,8 +4,9 @@
#include <unistd.h>
#include "async.h"
-#include "macro.h"
+#include "fs-util.h"
#include "tmpfile-util.h"
+#include "tests.h"
static bool test_async = false;
@@ -15,24 +16,22 @@ static void *async_func(void *arg) {
return NULL;
}
-int main(int argc, char *argv[]) {
+TEST(test_async) {
+ _cleanup_(unlink_tempfilep) char name[] = "/tmp/test-asynchronous_close.XXXXXX";
int fd;
- char name[] = "/tmp/test-asynchronous_close.XXXXXX";
fd = mkostemp_safe(name);
assert_se(fd >= 0);
asynchronous_close(fd);
assert_se(asynchronous_job(async_func, NULL) >= 0);
-
assert_se(asynchronous_sync(NULL) >= 0);
sleep(1);
assert_se(fcntl(fd, F_GETFD) == -1);
+ assert_se(errno == EBADF);
assert_se(test_async);
-
- (void) unlink(name);
-
- return 0;
}
+
+DEFINE_TEST_MAIN(LOG_DEBUG);