test/libmpv_encode: minor adjustments for win32 build fix

This commit is contained in:
Kacper Michajłow 2024-05-03 02:30:15 +02:00
parent 4d5642887d
commit cd12e923f8
2 changed files with 12 additions and 3 deletions

View File

@ -20,9 +20,15 @@
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#ifdef _WIN32
#include <sys/types.h>
#include <io.h>
#else
#include <unistd.h>
#endif
// Stolen from osdep/compiler.h
#ifdef __GNUC__
#define PRINTF_ATTRIBUTE(a1, a2) __attribute__ ((format(printf, a1, a2)))
@ -97,6 +103,8 @@ static void check_output(int fd)
puts("output file ok");
}
int mp_mkostemps(char *template, int suffixlen, int flags);
int main(int argc, char *argv[])
{
atexit(exit_cleanup);
@ -108,7 +116,7 @@ int main(int argc, char *argv[])
int fd;
{
char path[] = "./testout.XXXXXX";
fd = mkstemp(path);
fd = mp_mkostemps(path, 0, 0);
if (fd == -1)
fail("mkstemp failed");
out_path = strdup(path);

View File

@ -15,6 +15,7 @@ test_utils_files = [
'common/common.c',
'misc/bstr.c',
'misc/dispatch.c',
'misc/io_utils.c',
'misc/json.c',
'misc/node.c',
'misc/path_utils.c',
@ -124,7 +125,7 @@ if get_option('libmpv')
test('libmpv', exe, args: file, timeout: 60)
exe = executable('libmpv-encode', 'libmpv_encode.c',
include_directories: incdir, link_with: libmpv)
include_directories: incdir, link_with: [libmpv, test_utils])
test('libmpv-encode', exe, timeout: 30)
endif