From 3535e326dcb8b7d46e2fa9c43ec330d348a4bf6e Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Fri, 24 Feb 2023 16:24:49 -0600 Subject: [PATCH] player: remove unittest option Since meson has its own unit testing system, let's rework mpv's tests so they integrate nicely with this. To prepare for this, start off by dropping the unittest option. Of course, this means that tests will no longer be supported in the waf build at all but it will be dropped anyway. Note that the tests option is preserved for the meson build. We will still make use of this in the future commits. --- DOCS/man/options.rst | 18 ------------------ ci/build-msys2.sh | 4 ++-- ci/build-tumbleweed.sh | 4 ++-- meson.build | 17 ----------------- options/options.c | 4 ---- options/options.h | 1 - player/main.c | 6 ------ wscript | 5 ----- wscript_build.py | 13 ------------- 9 files changed, 4 insertions(+), 68 deletions(-) diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index bad8821fc8..d87191d83e 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -7166,21 +7166,3 @@ Miscellaneous code is the same.) Conversion is not applied to metadata that is updated at runtime. - - -Debugging ---------- - -``--unittest=`` - Run an internal unit test. There are multiple, and the name specifies which. - - The special value ``all-simple`` runs all tests which do not need further - setup (other arguments and such). Some tests may need additional arguments - to do anything useful. - - On success, the player binary exits with exit status 0, otherwise it returns - with an undefined non-0 exit status (it may crash or abort itself on test - failures). - - This is only enabled if built with ``--enable-tests``, and should normally - be enabled and used by developers only. diff --git a/ci/build-msys2.sh b/ci/build-msys2.sh index 7223a538aa..0afd93e789 100755 --- a/ci/build-msys2.sh +++ b/ci/build-msys2.sh @@ -25,7 +25,7 @@ if [ "$1" = "meson" ]; then meson compile -C build cp ./build/generated/mpv.com ./build meson test -C build - ./build/mpv.com --no-config -v --unittest=all-simple + ./build/mpv.com -v --no-config fi if [ "$1" = "waf" ]; then @@ -53,5 +53,5 @@ if [ "$1" = "waf" ]; then --lua=luajit \ --enable-vulkan ./waf build - ./build_waf/mpv.com -v --no-config -v --unittest=all-simple + ./build_waf/mpv.com -v --no-config fi diff --git a/ci/build-tumbleweed.sh b/ci/build-tumbleweed.sh index 48b464b594..44020848fa 100755 --- a/ci/build-tumbleweed.sh +++ b/ci/build-tumbleweed.sh @@ -15,7 +15,7 @@ if [ "$1" = "meson" ]; then -Dvulkan=enabled meson compile -C build meson test -C build - ./build/mpv --no-config -v --unittest=all-simple + ./build/mpv -v --no-config fi if [ "$1" = "waf" ]; then @@ -32,5 +32,5 @@ if [ "$1" = "waf" ]; then --enable-tests \ --enable-vulkan python3 ./waf build - ./build_waf/mpv -v --no-config -v --unittest=all-simple + ./build_waf/mpv -v --no-config fi diff --git a/meson.build b/meson.build index 0db557f50d..b57ce9d3c0 100644 --- a/meson.build +++ b/meson.build @@ -342,19 +342,6 @@ if features['cplugins'] link_flags += '-rdynamic' endif -features += {'tests': get_option('tests')} -if features['tests'] - sources += files('test/chmap.c', - 'test/gl_video.c', - 'test/img_format.c', - 'test/json.c', - 'test/linked_list.c', - 'test/paths.c', - 'test/scale_sws.c', - 'test/scale_test.c', - 'test/tests.c') -endif - # Note: this include is only used for windows pthreads and # must be accompanied immediately by the following flags. # This currently works because these are the last flags set @@ -752,10 +739,6 @@ if features['zimg'] dependencies += zimg sources += files('video/filter/vf_fingerprint.c', 'video/zimg.c') - if features['tests'] - sources += files('test/repack.c', - 'test/scale_zimg.c') - endif features += {'zimg-st428': zimg.version().version_compare('>= 3.0.5')} endif diff --git a/options/options.c b/options/options.c index 1e49731709..9fa786419b 100644 --- a/options/options.c +++ b/options/options.c @@ -403,10 +403,6 @@ static const m_option_t mp_opts[] = { {"version", OPT_PRINT(print_version)}, {"V", OPT_PRINT(print_version)}, -#if HAVE_TESTS - {"unittest", OPT_STRING(test_mode), .flags = CONF_NOCFG | M_OPT_NOPROP}, -#endif - {"player-operation-mode", OPT_CHOICE(operation_mode, {"cplayer", 0}, {"pseudo-gui", 1}), .flags = M_OPT_PRE_PARSE | M_OPT_NOPROP}, diff --git a/options/options.h b/options/options.h index a44a8253a3..c3a5e727ee 100644 --- a/options/options.h +++ b/options/options.h @@ -145,7 +145,6 @@ typedef struct MPOpts { bool msg_time; char *log_file; - char *test_mode; int operation_mode; char **reset_options; diff --git a/player/main.c b/player/main.c index 1dde63e31f..509f96ac5f 100644 --- a/player/main.c +++ b/player/main.c @@ -61,7 +61,6 @@ #include "audio/out/ao.h" #include "misc/thread_tools.h" #include "sub/osd.h" -#include "test/tests.h" #include "video/out/vo.h" #include "core.h" @@ -385,11 +384,6 @@ int mp_initialize(struct MPContext *mpctx, char **options) check_library_versions(mp_null_log, 0); -#if HAVE_TESTS - if (opts->test_mode && opts->test_mode[0]) - return run_tests(mpctx) ? 1 : -1; -#endif - if (!mpctx->playlist->num_entries && !opts->player_idle_mode && options) { diff --git a/wscript b/wscript index 026c37b598..fafd15b0e1 100644 --- a/wscript +++ b/wscript @@ -78,11 +78,6 @@ build_options = [ 'desc': 'whether to compile-in debugging information', 'default': 'enable', 'func': check_true - }, { - 'name': '--tests', - 'desc': 'unit tests (development only)', - 'default': 'disable', - 'func': check_true }, { # Reminder: normally always built, but enabled by MPV_LEAK_REPORT. # Building it can be disabled only by defining NDEBUG through CFLAGS. diff --git a/wscript_build.py b/wscript_build.py index 224ed8ed63..c8056aad63 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -424,19 +424,6 @@ def build(ctx): ( "sub/sd_ass.c" ), ( "sub/sd_lavc.c" ), - ## Tests - ( "test/chmap.c", "tests" ), - ( "test/gl_video.c", "tests" ), - ( "test/img_format.c", "tests" ), - ( "test/json.c", "tests" ), - ( "test/linked_list.c", "tests" ), - ( "test/paths.c", "tests" ), - ( "test/repack.c", "tests && zimg" ), - ( "test/scale_sws.c", "tests" ), - ( "test/scale_test.c", "tests" ), - ( "test/scale_zimg.c", "tests && zimg" ), - ( "test/tests.c", "tests" ), - ## Video ( "video/csputils.c" ), ( "video/cuda.c", "cuda-hwaccel" ),