Fix make check on cross-compiled env

This commit is contained in:
Akira TAGOH 2019-03-22 07:45:09 +00:00
parent 98099ffc9f
commit f6810ede60
6 changed files with 80 additions and 2 deletions

View File

@ -11,6 +11,7 @@ AM_TESTS_ENVIRONMENT= \
BUILT_SOURCES = $(builddir)/out.expected
SH_LOG_COMPILER = sh
LOG_COMPILER = ${srcdir}/wrapper-script.sh
TESTS=run-test.sh
TESTDATA = \
@ -75,6 +76,7 @@ endif
check_PROGRAMS += test-bz106618
test_bz106618_LDADD = $(top_builddir)/src/libfontconfig.la
if !OS_WIN32
check_PROGRAMS += test-hash
test_hash_CFLAGS = -I$(top_builddir) -I$(top_builddir)/src $(UUID_CFLAGS)
test_hash_LDADD = $(UUID_LIBS)
@ -91,6 +93,7 @@ test_bz106632_CFLAGS = \
$(NULL)
test_bz106632_LDADD = $(top_builddir)/src/libfontconfig.la
TESTS += test-bz106632
endif
check_PROGRAMS += test-issue107
test_issue107_LDADD = \
@ -99,6 +102,7 @@ test_issue107_LDADD = \
TESTS += test-issue107
if !ENABLE_SHARED
if !OS_WIN32
check_PROGRAMS += test-issue110
test_issue110_CFLAGS = \
-I$(top_builddir) \
@ -127,6 +131,7 @@ test_d1f48f11_LDADD = \
$(NULL)
TESTS += test-d1f48f11
endif
endif
EXTRA_DIST=run-test.sh run-test-conf.sh $(TESTDATA) out.expected-long-family-names out.expected-no-long-family-names

View File

@ -31,11 +31,12 @@ BUILDTESTDIR=${builddir-"$MyPWD"}
FONTDIR="$MyPWD"/fonts
CACHEDIR="$MyPWD"/cache.dir
EXPECTED=${EXPECTED-"out.expected"}
LOG_COMPILER=${LOG_COMPILER-"$TESTDIR/wrapper-script.sh"}
ECHO=true
FCLIST=../fc-list/fc-list$EXEEXT
FCCACHE=../fc-cache/fc-cache$EXEEXT
FCLIST="$LOG_COMPILER ../fc-list/fc-list$EXEEXT"
FCCACHE="$LOG_COMPILER ../fc-cache/fc-cache$EXEEXT"
which bwrap > /dev/null 2>&1
if [ $? -eq 0 ]; then
@ -122,6 +123,7 @@ mkdir $FONTDIR/a
cp $FONT2 $FONTDIR/a
check
if [ "x$EXEEXT" = "x" ]; then
dotest "Re-creating .uuid"
prep
cp $FONT1 $FONTDIR
@ -164,6 +166,7 @@ if [ $n != 1 ]; then
ls $CACHEDIR
exit 1
fi
fi
dotest "Keep mtime of the font directory"
prep
@ -214,6 +217,7 @@ fi
rm -rf $TESTTMPDIR out1 out2 xxx flist1 flist2 bind-fonts.conf
fi
if [ "x$EXEEXT" = "x" ]; then
dotest "sysroot option"
prep
mkdir -p $MyPWD/sysroot/$FONTDIR
@ -239,6 +243,8 @@ fi
rm -rf $MyPWD/sysroot
fi
# dotest "deleting .uuid file on empty dir"
# prep
# cp $FONT1 $FONT2 $FONTDIR

View File

@ -45,6 +45,24 @@
# define FC_DIR_SEPARATOR_S "/"
#endif
#ifdef _WIN32
#include <direct.h>
#define mkdir(path,mode) _mkdir(path)
int
setenv(const char *name, const char *value, int o)
{
size_t len = strlen(name) + strlen(value) + 1;
char *s = malloc(len+1);
int ret;
snprintf(s, len, "%s=%s", name, value);
ret = _putenv(s);
free(s);
return ret;
}
#endif
extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
extern FcChar8 *FcStrCanonFilename (const FcChar8 *);

View File

@ -45,6 +45,24 @@
# define FC_DIR_SEPARATOR_S "/"
#endif
#ifdef _WIN32
#include <direct.h>
#define mkdir(path,mode) _mkdir(path)
int
setenv(const char *name, const char *value, int o)
{
size_t len = strlen(name) + strlen(value) + 1;
char *s = malloc(len+1);
int ret;
snprintf(s, len, "%s=%s", name, value);
ret = _putenv(s);
free(s);
return ret;
}
#endif
extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
#ifdef HAVE_MKDTEMP

View File

@ -45,6 +45,24 @@
# define FC_DIR_SEPARATOR_S "/"
#endif
#ifdef _WIN32
#include <direct.h>
#define mkdir(path,mode) _mkdir(path)
int
setenv(const char *name, const char *value, int o)
{
size_t len = strlen(name) + strlen(value) + 1;
char *s = malloc(len+1);
int ret;
snprintf(s, len, "%s=%s", name, value);
ret = _putenv(s);
free(s);
return ret;
}
#endif
extern FcChar8 *FcConfigRealFilename (FcConfig *, FcChar8 *);
#ifdef HAVE_MKDTEMP

13
test/wrapper-script.sh Executable file
View File

@ -0,0 +1,13 @@
#! /bin/bash
case "$1" in
*.exe)
fccwd=`pwd`
cd $(IFS=:;for i in $PATH; do echo $i|grep mingw> /dev/null; [ $? -eq 0 ] && echo $i; done)
/usr/bin/env wine $fccwd/$@
;;
*)
$@
;;
esac