diff options
author | Dudemanguy <random342@airmail.cc> | 2023-02-25 21:50:08 -0600 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-03-02 15:45:27 +0000 |
commit | 9db818279aa63d071f2bca369235285314444dcd (patch) | |
tree | 9aafc5cf73e19ae8ea69751c060cab9766a6b9a4 /test/scale_zimg.c | |
parent | 61532421571f972f076b3700d7ae468c0a0438c0 (diff) | |
download | mpv-9db818279aa63d071f2bca369235285314444dcd.tar.bz2 mpv-9db818279aa63d071f2bca369235285314444dcd.tar.xz |
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.
Diffstat (limited to 'test/scale_zimg.c')
-rw-r--r-- | test/scale_zimg.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/test/scale_zimg.c b/test/scale_zimg.c index f5957067c2..57894bea67 100644 --- a/test/scale_zimg.c +++ b/test/scale_zimg.c @@ -21,7 +21,7 @@ static const struct scale_test_fns fns = { .supports_fmts = supports_fmts, }; -static void run(struct test_ctx *ctx) +int main(int argc, char *argv[]) { struct mp_zimg_context *zimg = mp_zimg_alloc(); zimg->opts.threads = 1; @@ -30,12 +30,12 @@ static void run(struct test_ctx *ctx) stest->fns = &fns; stest->fns_priv = zimg; stest->test_name = "repack_zimg"; - stest->ctx = ctx; + stest->refdir = talloc_strdup(stest, argv[1]); + stest->outdir = talloc_strdup(stest, argv[2]); repack_test_run(stest); - FILE *f = test_open_out(ctx, "zimg_formats.txt"); - init_imgfmts_list(); + FILE *f = test_open_out(stest->outdir, "zimg_formats.txt"); for (int n = 0; n < num_imgfmts; n++) { int imgfmt = imgfmts[n]; fprintf(f, "%15s%7s%7s%7s%8s |\n", mp_imgfmt_to_name(imgfmt), @@ -47,14 +47,10 @@ static void run(struct test_ctx *ctx) } fclose(f); - assert_text_files_equal(stest->ctx, "zimg_formats.txt", "zimg_formats.txt", + assert_text_files_equal(stest->refdir, stest->outdir, "zimg_formats.txt", "This can fail if FFmpeg/libswscale adds or removes pixfmts."); talloc_free(stest); talloc_free(zimg); + return 0; } - -const struct unittest test_repack_zimg = { - .name = "repack_zimg", - .run = run, -}; |