2023-02-26 03:50:08 +00:00
|
|
|
# So we don't have to reorganize the entire directory tree.
|
|
|
|
incdir = include_directories('../')
|
|
|
|
outdir = join_paths(build_root, 'test', 'out')
|
2024-04-12 15:09:27 +00:00
|
|
|
refdir = ''
|
2023-02-26 03:50:08 +00:00
|
|
|
|
|
|
|
# Convenient testing libraries. An adhoc collection of
|
2024-05-22 01:40:05 +00:00
|
|
|
# mpv objects that test_utils.c needs. Stuff will probably
|
|
|
|
# break if core things are carelessly moved around.
|
2023-02-26 03:50:08 +00:00
|
|
|
test_utils_args = []
|
|
|
|
test_utils_files = [
|
|
|
|
'audio/chmap.c',
|
|
|
|
'audio/format.c',
|
|
|
|
'common/common.c',
|
|
|
|
'misc/bstr.c',
|
|
|
|
'misc/dispatch.c',
|
|
|
|
'misc/json.c',
|
2024-04-17 16:42:15 +00:00
|
|
|
'misc/language.c',
|
2023-02-26 03:50:08 +00:00
|
|
|
'misc/node.c',
|
2024-02-19 09:11:25 +00:00
|
|
|
'misc/path_utils.c',
|
2023-02-26 03:50:08 +00:00
|
|
|
'misc/random.c',
|
|
|
|
'misc/thread_tools.c',
|
|
|
|
'options/m_config_core.c',
|
|
|
|
'options/m_config_frontend.c',
|
|
|
|
'options/m_option.c',
|
|
|
|
'osdep/io.c',
|
2023-10-18 13:45:47 +00:00
|
|
|
'osdep/timer.c',
|
|
|
|
timer_source,
|
2023-02-26 03:50:08 +00:00
|
|
|
'ta/ta.c',
|
|
|
|
'ta/ta_talloc.c',
|
|
|
|
'ta/ta_utils.c'
|
|
|
|
]
|
2023-09-15 14:51:44 +00:00
|
|
|
|
|
|
|
test_utils_deps = [libavutil, libm]
|
|
|
|
|
2023-10-22 01:49:04 +00:00
|
|
|
if win32
|
|
|
|
test_utils_files += 'osdep/windows_utils.c'
|
|
|
|
endif
|
|
|
|
|
2023-10-22 00:43:15 +00:00
|
|
|
if features['pthread-debug']
|
2023-10-22 02:12:14 +00:00
|
|
|
test_utils_files += 'osdep/threads-posix.c'
|
2023-10-22 00:43:15 +00:00
|
|
|
endif
|
|
|
|
|
2023-10-18 13:45:47 +00:00
|
|
|
# The zimg code requires using threads.
|
2023-10-22 00:43:15 +00:00
|
|
|
if not features['win32-threads']
|
2023-09-15 14:51:44 +00:00
|
|
|
test_utils_deps += pthreads
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if features['win32-desktop']
|
2024-06-04 16:49:10 +00:00
|
|
|
test_utils_deps += [cc.find_library('imm32'),
|
|
|
|
cc.find_library('ntdll'),
|
|
|
|
cc.find_library('pathcch')]
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
test_utils_objects = libmpv.extract_objects(test_utils_files)
|
|
|
|
test_utils = static_library('test-utils', 'test_utils.c', include_directories: incdir,
|
|
|
|
c_args: test_utils_args, objects: test_utils_objects,
|
|
|
|
dependencies: test_utils_deps)
|
|
|
|
|
|
|
|
# For getting imgfmts and stuff.
|
|
|
|
img_utils_files = [
|
|
|
|
'misc/thread_pool.c',
|
|
|
|
'video/csputils.c',
|
|
|
|
'video/fmt-conversion.c',
|
|
|
|
'video/img_format.c',
|
|
|
|
'video/mp_image.c',
|
|
|
|
'video/sws_utils.c'
|
|
|
|
]
|
|
|
|
if features['zimg']
|
|
|
|
img_utils_files += ['video/repack.c', 'video/zimg.c']
|
|
|
|
endif
|
|
|
|
|
|
|
|
img_utils_objects = libmpv.extract_objects(img_utils_files)
|
|
|
|
img_utils = static_library('img-utils', 'img_utils.c', include_directories: incdir,
|
2024-02-23 16:57:12 +00:00
|
|
|
dependencies: [libavcodec, libplacebo], objects: img_utils_objects)
|
2023-02-26 03:50:08 +00:00
|
|
|
|
|
|
|
# The actual tests.
|
|
|
|
chmap_files = [
|
2024-06-21 16:24:30 +00:00
|
|
|
'audio/chmap_avchannel.c',
|
|
|
|
'audio/chmap_sel.c',
|
2023-02-26 03:50:08 +00:00
|
|
|
]
|
|
|
|
chmap_objects = libmpv.extract_objects(chmap_files)
|
|
|
|
chmap = executable('chmap', 'chmap.c', include_directories: incdir,
|
2023-08-06 17:36:12 +00:00
|
|
|
dependencies: [libavutil], objects: chmap_objects,
|
|
|
|
link_with: test_utils)
|
2023-02-26 03:50:08 +00:00
|
|
|
test('chmap', chmap)
|
|
|
|
|
|
|
|
gl_video_objects = libmpv.extract_objects('video/out/gpu/ra.c',
|
|
|
|
'video/out/gpu/utils.c')
|
|
|
|
gl_video = executable('gl-video', 'gl_video.c', objects: gl_video_objects,
|
2024-02-23 16:57:12 +00:00
|
|
|
dependencies: [libavutil, libplacebo], include_directories: incdir,
|
2023-09-16 05:42:16 +00:00
|
|
|
link_with: [img_utils, test_utils])
|
2023-02-26 03:50:08 +00:00
|
|
|
test('gl-video', gl_video)
|
|
|
|
|
|
|
|
json = executable('json', 'json.c', include_directories: incdir, link_with: test_utils)
|
|
|
|
test('json', json)
|
|
|
|
|
|
|
|
linked_list = executable('linked-list', files('linked_list.c'), include_directories: incdir)
|
|
|
|
test('linked-list', linked_list)
|
|
|
|
|
2023-10-18 13:45:47 +00:00
|
|
|
timer = executable('timer', files('timer.c'), include_directories: incdir, link_with: test_utils)
|
|
|
|
test('timer', timer)
|
|
|
|
|
2023-11-19 20:22:24 +00:00
|
|
|
format = executable('format', files('format.c'), include_directories: incdir, link_with: test_utils)
|
|
|
|
test('format', format)
|
|
|
|
|
2024-04-17 16:42:15 +00:00
|
|
|
language = executable('language', files('language.c'), include_directories: incdir, link_with: test_utils)
|
|
|
|
test('language', language)
|
|
|
|
|
2024-09-21 14:32:27 +00:00
|
|
|
codepoint_width = executable('codepoint-width', files('codepoint_width.c'),
|
|
|
|
objects: libmpv.extract_objects('misc/codepoint_width.c'),
|
|
|
|
include_directories: incdir, link_with: test_utils)
|
|
|
|
test('codepoint-width', codepoint_width)
|
|
|
|
|
2023-02-26 03:50:08 +00:00
|
|
|
paths_objects = libmpv.extract_objects('options/path.c', path_source)
|
|
|
|
paths = executable('paths', 'paths.c', include_directories: incdir,
|
|
|
|
objects: paths_objects, link_with: test_utils)
|
|
|
|
test('paths', paths)
|
|
|
|
|
|
|
|
if get_option('libmpv')
|
2024-04-15 16:35:44 +00:00
|
|
|
exe = executable('libmpv-test', 'libmpv_test.c',
|
|
|
|
include_directories: incdir, link_with: libmpv)
|
2023-07-26 14:35:01 +00:00
|
|
|
file = join_paths(source_root, 'etc', 'mpv-icon-8bit-16x16.png')
|
2024-05-03 04:35:33 +00:00
|
|
|
test('libmpv', exe, args: file, timeout: 60, should_fail: not features['lua'])
|
2024-04-15 16:35:44 +00:00
|
|
|
|
|
|
|
exe = executable('libmpv-encode', 'libmpv_encode.c',
|
2024-05-21 20:31:17 +00:00
|
|
|
include_directories: incdir, link_with: libmpv)
|
2024-04-15 16:35:44 +00:00
|
|
|
test('libmpv-encode', exe, timeout: 30)
|
2024-07-06 16:29:49 +00:00
|
|
|
|
|
|
|
mpvlib = libmpv
|
|
|
|
shared = get_option('default_library') == 'shared'
|
|
|
|
if get_option('default_library') == 'both'
|
|
|
|
mpvlib = libmpv.get_shared_lib()
|
|
|
|
shared = true
|
|
|
|
endif
|
|
|
|
if shared
|
|
|
|
exe = executable('libmpv-lifetime', sources: 'libmpv_lifetime.c',
|
|
|
|
include_directories: incdir)
|
|
|
|
test('libmpv-lifetime', exe, depends: mpvlib)
|
|
|
|
endif
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-04-12 15:09:27 +00:00
|
|
|
# Supported libavutil versions that work with these tests.
|
2023-02-26 03:50:08 +00:00
|
|
|
# Will need to be manually updated when ffmpeg adds/removes more formats in the future.
|
2024-10-10 02:31:07 +00:00
|
|
|
if libavutil.version().version_compare('>= 59.0.100') and libavutil.version().version_compare('<= 59.39.100')
|
2024-04-12 15:09:27 +00:00
|
|
|
refdir = join_paths(source_root, 'test', 'ref', 'ffmpeg7')
|
2024-10-10 02:31:07 +00:00
|
|
|
elif libavutil.version().version_compare('>= 58.27.100') and libavutil.version().version_compare('< 59.0.100')
|
2024-04-12 15:09:27 +00:00
|
|
|
refdir = join_paths(source_root, 'test', 'ref', 'ffmpeg6')
|
|
|
|
endif
|
2023-02-26 03:50:08 +00:00
|
|
|
|
2024-04-12 15:09:27 +00:00
|
|
|
if refdir != ''
|
2023-03-27 20:42:17 +00:00
|
|
|
# The CI can randomly fail if libavutil isn't explicitly linked again here.
|
2023-02-26 03:50:08 +00:00
|
|
|
img_format = executable('img-format', 'img_format.c', include_directories: incdir,
|
2023-10-23 22:44:18 +00:00
|
|
|
dependencies: [libavutil, libplacebo], link_with: [img_utils, test_utils])
|
2023-02-26 03:50:08 +00:00
|
|
|
test('img-format', img_format, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
|
|
|
|
|
|
|
|
scale_sws_objects = libmpv.extract_objects('video/image_writer.c',
|
|
|
|
'video/repack.c')
|
|
|
|
scale_sws = executable('scale-sws', ['scale_sws.c', 'scale_test.c'], include_directories: incdir,
|
2023-10-23 22:44:18 +00:00
|
|
|
objects: scale_sws_objects, dependencies: [libavutil, libavformat, libswscale, jpeg, zimg, libplacebo],
|
2023-02-26 03:50:08 +00:00
|
|
|
link_with: [img_utils, test_utils])
|
|
|
|
test('scale-sws', scale_sws, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
|
|
|
|
if features['zimg']
|
|
|
|
repack_objects = libmpv.extract_objects('sub/draw_bmp.c')
|
|
|
|
repack = executable('repack', 'repack.c', include_directories: incdir, objects: repack_objects,
|
2023-10-23 22:44:18 +00:00
|
|
|
dependencies: [libavutil, libswscale, zimg, libplacebo], link_with: [img_utils, test_utils])
|
2023-02-26 03:50:08 +00:00
|
|
|
test('repack', repack, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
|
|
|
|
scale_zimg_objects = libmpv.extract_objects('video/image_writer.c')
|
|
|
|
scale_zimg = executable('scale-zimg', ['scale_test.c', 'scale_zimg.c'], include_directories: incdir,
|
2023-10-23 22:44:18 +00:00
|
|
|
objects: scale_zimg_objects, dependencies:[libavutil, libavformat, libswscale, jpeg, zimg, libplacebo],
|
2023-02-26 03:50:08 +00:00
|
|
|
link_with: [img_utils, test_utils])
|
|
|
|
test('scale-zimg', scale_zimg, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
endif
|
|
|
|
endif
|