From 9db818279aa63d071f2bca369235285314444dcd Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sat, 25 Feb 2023 21:50:08 -0600 Subject: test: integrate unittests with meson This reworks all of mpv's unit tests so they are compiled as separate executables (optional) and run via meson test. Because most of the tests are dependant on mpv's internals, existing compiled objects are leveraged to create static libs and used when necessary. As an aside, a function was moved into video/out/gpu/utils for sanity's sake (otherwise most of vo would have been needed). As a plus, meson multithreads running tests automatically and also the output no longer pollutes the source directory. There are tests that can break due to ffmpeg changes, so they require a specific minimum libavutil version to be built. --- test/paths.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'test/paths.c') diff --git a/test/paths.c b/test/paths.c index 66d4ee2e2d..aa610db437 100644 --- a/test/paths.c +++ b/test/paths.c @@ -1,7 +1,8 @@ #include "common/common.h" +#include "common/msg.h" #include "config.h" #include "options/path.h" -#include "tests.h" +#include "test_utils.h" static void test_join(char *file, int line, char *a, char *b, char *c) { @@ -29,7 +30,7 @@ static void test_abs(char *file, int line, bool abs, char *a) #define TEST_ABS(abs, a) \ test_abs(__FILE__, __LINE__, abs, a) -static void run(struct test_ctx *ctx) +int main(void) { TEST_ABS(true, "/ab"); TEST_ABS(false, "ab"); @@ -60,9 +61,5 @@ static void run(struct test_ctx *ctx) TEST_JOIN("c:a", "b", "c:a/b"); TEST_JOIN("c:", "b", "c:b"); #endif + return 0; } - -const struct unittest test_paths = { - .name = "paths", - .run = run, -}; -- cgit v1.2.3