Remove UUID-related tests
Remove test-hash Remove UUID tests from run-test.sh Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
parent
a8c4fc5e1f
commit
4cde12bfda
|
@ -76,12 +76,6 @@ 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)
|
||||
TESTS += test-hash
|
||||
|
||||
check_PROGRAMS += test-bz106632
|
||||
test_bz106632_CFLAGS = \
|
||||
-I$(top_builddir) \
|
||||
|
|
|
@ -123,51 +123,6 @@ mkdir $FONTDIR/a
|
|||
cp $FONT2 $FONTDIR/a
|
||||
check
|
||||
|
||||
if [ "x$EXEEXT" = "x" ]; then
|
||||
dotest "Re-creating .uuid"
|
||||
prep
|
||||
cp $FONT1 $FONTDIR
|
||||
$FCCACHE $FONTDIR
|
||||
cat $FONTDIR/.uuid > out1
|
||||
$FCCACHE -f $FONTDIR
|
||||
cat $FONTDIR/.uuid > out2
|
||||
if cmp out1 out2 > /dev/null ; then : ; else
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "*** .uuid was modified unexpectedly"
|
||||
exit 1
|
||||
fi
|
||||
$FCCACHE -r $FONTDIR
|
||||
cat $FONTDIR/.uuid > out2
|
||||
if cmp out1 out2 > /dev/null ; then
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "*** .uuid wasn't modified"
|
||||
exit 1
|
||||
fi
|
||||
rm -f out1 out2
|
||||
|
||||
dotest "Consistency between .uuid and cache name"
|
||||
prep
|
||||
cp $FONT1 $FONTDIR
|
||||
$FCCACHE $FONTDIR
|
||||
cat $FONTDIR/.uuid
|
||||
$FCCACHE -r $FONTDIR
|
||||
uuid=`cat $FONTDIR/.uuid`
|
||||
ls $CACHEDIR/$uuid*
|
||||
if [ $? != 0 ]; then
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "No cache for $uuid"
|
||||
ls $CACHEDIR
|
||||
exit 1
|
||||
fi
|
||||
n=`ls -1 $CACHEDIR/*cache-* | wc -l`
|
||||
if [ $n != 1 ]; then
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "Unexpected cache was created"
|
||||
ls $CACHEDIR
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
dotest "Keep mtime of the font directory"
|
||||
prep
|
||||
cp $FONT1 $FONTDIR
|
||||
|
@ -194,12 +149,6 @@ s!@CACHEDIR@!$TESTTMPDIR/cache.dir!" < $TESTDIR/fonts.conf.in > bind-fonts.conf
|
|||
$BWRAP --bind / / --bind $CACHEDIR $TESTTMPDIR/cache.dir --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev --setenv FONTCONFIG_FILE $TESTTMPDIR/build/test/bind-fonts.conf $TESTTMPDIR/build/fc-match/fc-match$EXEEXT -f "%{file}\n" ":foundry=Misc" > xxx
|
||||
$BWRAP --bind / / --bind $CACHEDIR $TESTTMPDIR/cache.dir --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev --setenv FONTCONFIG_FILE $TESTTMPDIR/build/test/bind-fonts.conf $TESTTMPDIR/build/test/test-bz106618$EXEEXT | sort > flist1
|
||||
$BWRAP --bind / / --bind $CACHEDIR $TESTTMPDIR/cache.dir --bind $FONTDIR $TESTTMPDIR/fonts --bind .. $TESTTMPDIR/build --dev-bind /dev /dev find $TESTTMPDIR/fonts/ -type f -name '*.pcf' | sort > flist2
|
||||
ls -l $CACHEDIR > out2
|
||||
if cmp out1 out2 > /dev/null ; then : ; else
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "cache was updated."
|
||||
exit 1
|
||||
fi
|
||||
if [ x`cat xxx` != "x$TESTTMPDIR/fonts/4x6.pcf" ]; then
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "file property doesn't point to the new place: $TESTTMPDIR/fonts/4x6.pcf"
|
||||
|
@ -225,18 +174,14 @@ mkdir -p $MyPWD/sysroot/$CACHEDIR
|
|||
cp $FONT1 $MyPWD/sysroot/$FONTDIR
|
||||
cp $MyPWD/fonts.conf $MyPWD/sysroot/$MyPWD/fonts.conf
|
||||
$FCCACHE -y $MyPWD/sysroot
|
||||
stat $MyPWD/sysroot/$FONTDIR/.uuid
|
||||
if test $? != 0; then
|
||||
echo "*** Test failed: $TEST"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dotest "creating uuid-based cache file on sysroot"
|
||||
uuid=`cat $MyPWD/sysroot/$FONTDIR/.uuid`
|
||||
ls $MyPWD/sysroot/$CACHEDIR/$uuid*
|
||||
dotest "creating cache file on sysroot"
|
||||
md5=`echo -n $FONTDIR | md5sum | sed 's/ .*$//'`
|
||||
echo "checking for cache file $md5"
|
||||
ls "$MyPWD/sysroot/$CACHEDIR/$md5"*
|
||||
if [ $? != 0 ]; then
|
||||
echo "*** Test failed: $TEST"
|
||||
echo "No cache for $uuid"
|
||||
echo "No cache for $FONTDIR ($md5)"
|
||||
ls $MyPWD/sysroot/$CACHEDIR
|
||||
exit 1
|
||||
fi
|
||||
|
@ -245,19 +190,4 @@ rm -rf $MyPWD/sysroot
|
|||
|
||||
fi
|
||||
|
||||
# dotest "deleting .uuid file on empty dir"
|
||||
# prep
|
||||
# cp $FONT1 $FONT2 $FONTDIR
|
||||
# $FCCACHE $FONTDIR
|
||||
# sleep 1
|
||||
# rm -f $FONTDIR/*pcf
|
||||
# $FCCACHE $FONTDIR
|
||||
# rmdir $FONTDIR > /dev/null 2>&1
|
||||
# if [ $? != 0 ]; then
|
||||
# echo "*** Test failed: $TEST"
|
||||
# echo "$FONTDIR isn't empty"
|
||||
# ls -al $FONTDIR
|
||||
# exit 1
|
||||
# fi
|
||||
|
||||
rm -rf $FONTDIR $CACHEFILE $CACHEDIR $FONTCONFIG_FILE out
|
||||
|
|
186
test/test-hash.c
186
test/test-hash.c
|
@ -1,186 +0,0 @@
|
|||
#include "../src/fchash.c"
|
||||
#include "../src/fcstr.c"
|
||||
|
||||
FcChar8 *
|
||||
FcLangNormalize (const FcChar8 *lang)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
FcChar8 *
|
||||
FcConfigHome (void)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
typedef struct _Test
|
||||
{
|
||||
FcHashTable *table;
|
||||
} Test;
|
||||
|
||||
static Test *
|
||||
init (void)
|
||||
{
|
||||
Test *ret;
|
||||
|
||||
ret = malloc (sizeof (Test));
|
||||
if (ret)
|
||||
{
|
||||
ret->table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
|
||||
(FcCompareFunc) FcStrCmp,
|
||||
FcHashStrCopy,
|
||||
FcHashUuidCopy,
|
||||
(FcDestroyFunc) FcStrFree,
|
||||
FcHashUuidFree);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
fini (Test *test)
|
||||
{
|
||||
FcHashTableDestroy (test->table);
|
||||
free (test);
|
||||
}
|
||||
|
||||
static FcBool
|
||||
test_add (Test *test, char *key, FcBool replace)
|
||||
{
|
||||
uuid_t uuid;
|
||||
void *u;
|
||||
FcBool (*hash_add) (FcHashTable *, void *, void *);
|
||||
FcBool ret = FcFalse;
|
||||
|
||||
uuid_generate_random (uuid);
|
||||
if (replace)
|
||||
hash_add = FcHashTableReplace;
|
||||
else
|
||||
hash_add = FcHashTableAdd;
|
||||
if (!hash_add (test->table, key, uuid))
|
||||
return FcFalse;
|
||||
if (!FcHashTableFind (test->table, key, &u))
|
||||
return FcFalse;
|
||||
ret = (uuid_compare (uuid, u) == 0);
|
||||
FcHashUuidFree (u);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static FcBool
|
||||
test_remove (Test *test, char *key)
|
||||
{
|
||||
void *u;
|
||||
|
||||
if (!FcHashTableFind (test->table, key, &u))
|
||||
return FcFalse;
|
||||
FcHashUuidFree (u);
|
||||
if (!FcHashTableRemove (test->table, key))
|
||||
return FcFalse;
|
||||
if (FcHashTableFind (test->table, key, &u))
|
||||
return FcFalse;
|
||||
|
||||
return FcTrue;
|
||||
}
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
Test *test;
|
||||
int ret = 0;
|
||||
|
||||
test = init ();
|
||||
/* first op to add */
|
||||
if (!test_add (test, "foo", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* second op to add */
|
||||
if (!test_add (test, "bar", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* dup not allowed */
|
||||
if (test_add (test, "foo", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* replacement */
|
||||
if (!test_add (test, "foo", FcTrue))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* removal */
|
||||
if (!test_remove (test, "foo"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* not found to remove */
|
||||
if (test_remove (test, "foo"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* complex op in pointer */
|
||||
if (!test_add (test, "foo", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (test_add (test, "foo", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (!test_remove (test, "foo"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (!test_add (test, "foo", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (!test_remove (test, "bar"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* completely remove */
|
||||
if (!test_remove (test, "foo"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
/* completely remove from the last one */
|
||||
if (!test_add (test, "foo", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (!test_add (test, "bar", FcFalse))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (!test_remove (test, "bar"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
if (!test_remove (test, "foo"))
|
||||
{
|
||||
ret = 1;
|
||||
goto bail;
|
||||
}
|
||||
bail:
|
||||
fini (test);
|
||||
|
||||
return ret;
|
||||
}
|
Loading…
Reference in New Issue