[libxslt] Add first test case for EXSLT crypto module
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxslt] Add first test case for EXSLT crypto module
- Date: Mon, 5 Aug 2013 10:30:40 +0000 (UTC)
commit 9819dc0d5258c34b1cc1712c80a512a46ad791e7
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Thu Aug 1 18:03:21 2013 +0200
Add first test case for EXSLT crypto module
Add test case from bug #692866 by Feoktistov Alexander.
configure.in | 7 +++++-
tests/exslt/Makefile.am | 2 +-
tests/exslt/crypto/Makefile.am | 46 ++++++++++++++++++++++++++++++++++++++++
tests/exslt/crypto/hash.1.out | 19 ++++++++++++++++
tests/exslt/crypto/hash.1.xml | 26 ++++++++++++++++++++++
tests/exslt/crypto/hash.1.xsl | 36 +++++++++++++++++++++++++++++++
6 files changed, 134 insertions(+), 2 deletions(-)
---
diff --git a/configure.in b/configure.in
index dcbd971..a861e90 100644
--- a/configure.in
+++ b/configure.in
@@ -378,6 +378,7 @@ AC_SUBST(PYTHON_LIBS)
AC_ARG_WITH(crypto, [ --with-crypto Add crypto support to exslt (on)])
WITH_CRYPTO=0
+CRYPTO_TESTDIR=
if test "$with_crypto" = "no" ; then
echo Disabling crypto support
LIBGCRYPT_CFLAGS=""
@@ -389,6 +390,7 @@ case $host in
dnl TODO: to implement --with-crypto=foo to allow switch between
dnl crypto libraries
WITH_CRYPTO=1
+ CRYPTO_TESTDIR=crypto
;;
*)
AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
@@ -404,7 +406,8 @@ case $host in
LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG $libgcrypt_config_args --libs`
AC_DEFINE(HAVE_GCRYPT, 1, [Define if gcrypt library is available.])
echo 'Crypto extensions will be available.'
- WITH_CRYPTO=1
+ WITH_CRYPTO=1
+ CRYPTO_TESTDIR=crypto
fi
else
LIBGCRYPT_CFLAGS=""
@@ -414,6 +417,7 @@ case $host in
esac
fi
AC_SUBST(WITH_CRYPTO)
+AC_SUBST(CRYPTO_TESTDIR)
AC_SUBST(LIBGCRYPT_CFLAGS)
AC_SUBST(LIBGCRYPT_LIBS)
@@ -709,6 +713,7 @@ tests/exslt/sets/Makefile
tests/exslt/strings/Makefile
tests/exslt/date/Makefile
tests/exslt/dynamic/Makefile
+tests/exslt/crypto/Makefile
tests/plugins/Makefile
doc/Makefile
xslt-config
diff --git a/tests/exslt/Makefile.am b/tests/exslt/Makefile.am
index 800701b..81596f5 100644
--- a/tests/exslt/Makefile.am
+++ b/tests/exslt/Makefile.am
@@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS=common functions math sets strings dynamic date
+SUBDIRS=common functions math sets strings dynamic date $(CRYPTO_TESTDIR)
test tests:
@(cur=`pwd` ; for dir in $(SUBDIRS) ; do cd $$dir ; $(MAKE) CHECKER='$(CHECKER)' tests ; cd $$cur ;
done)
diff --git a/tests/exslt/crypto/Makefile.am b/tests/exslt/crypto/Makefile.am
new file mode 100644
index 0000000..9913ad3
--- /dev/null
+++ b/tests/exslt/crypto/Makefile.am
@@ -0,0 +1,46 @@
+## Process this file with automake to produce Makefile.in
+
+$(top_builddir)/xsltproc/xsltproc:
+ @(cd ../../../xsltproc ; $(MAKE) xsltproc)
+
+EXTRA_DIST = \
+ md5.1.out md5.1.xml md5.1.xsl
+
+CLEANFILES = .memdump
+
+valgrind:
+ @echo '## Running the regression tests under Valgrind'
+ $(MAKE) CHECKER='valgrind -q' tests
+
+test tests: $(top_builddir)/xsltproc/xsltproc
+ @echo '## Running exslt crypto tests'
+ @(echo > .memdump)
+ @(for i in $(srcdir)/*.xsl ; do \
+ name=`basename $$i .xsl` ; \
+ if [ ! -f $(srcdir)/$$name.xml ] ; then continue ; fi ; \
+ log=`$(CHECKER) $(top_builddir)/xsltproc/xsltproc \
+ $(srcdir)/$$name.xsl $(srcdir)/$$name.xml > $$name.res 2>$$name.bad;\
+ if [ ! -f $(srcdir)/$$name.out ] ; then \
+ cp $$name.res $(srcdir)/$$name.out ; \
+ if [ -s $$name.bad ] ; then \
+ mv $$name.bad $(srcdir)/$$name.err ; \
+ fi ; \
+ else \
+ if [ ! -s $$name.res ] ; then \
+ echo "Fatal error, no $$name.res\n" ; \
+ else \
+ diff $(srcdir)/$$name.out $$name.res ; \
+ if [ -s $(srcdir)/$$name.err ] ; then \
+ diff $(srcdir)/$$name.err $$name.bad; \
+ else \
+ diff /dev/null $$name.bad; \
+ fi ; \
+ fi ; \
+ fi; \
+ grep "MORY ALLO" .memdump | grep -v "MEMORY ALLOCATED : 0" || true`;\
+ if [ -n "$$log" ] ; then \
+ echo $$name result ; \
+ echo "$$log" ; \
+ fi ; \
+ rm -f $$name.res $$name.bad ; \
+ done)
diff --git a/tests/exslt/crypto/hash.1.out b/tests/exslt/crypto/hash.1.out
new file mode 100644
index 0000000..a3b93d1
--- /dev/null
+++ b/tests/exslt/crypto/hash.1.out
@@ -0,0 +1,19 @@
+text = _Привет, Мир!_ md5 = d2e2e8dc53cb794450113042c7556312 sha1 =
d67f91f1f55b432342ec2392bf1110c86291fdd3
+text = _Привет, Мир?_ md5 = 3aebe789bc330a3bda6ba99e075f833e sha1 =
f4345f343097799e8b495c4c9a1d1d690c37b6eb
+text = _Привет, Мир _ md5 = 73251f813aff056b532c39225b095ef9 sha1 =
419b9e064a167c5500a1033d8d007b74e43c267b
+text = _Привет, Мир._ md5 = ad36162786b7c2d651b19522bc885b21 sha1 =
cb1395c0b22a61d9953c1a22bda7eaffdd61adb7
+text = _Привет, Мир9_ md5 = cbb48a4a4eced9d0349b6e0b2487cfcd sha1 =
8fa81c70276cddb16862543231b4449eef20259a
+text = _Привет, МирЖ_ md5 = b288f1dab6563148b5d1409c4c5c260f sha1 =
9b3094419172552d6e99d5dcd09835463ac4b88a
+text = _Привет, МирZ_ md5 = b4659b1baaa26e4b532666cdf8a854c2 sha1 =
d5becd4eecc8e48a91f0efb98fb7d6eb5202f6dd
+text = _Привет,МирZ _ md5 = d7ae5b6f5e5e43843de9021ade23ded1 sha1 =
74879fb379fc950ecd46ed1b358b72d11dae248e
+text = _Привет, МирZ _ md5 = 6f066fe46c38cafa81266a415ae12a3c sha1 =
270c37447d5a4e2814e4d352b11a22a715550e03
+text = _Привет, МирZ_ md5 = 5aea0ab8c6aa052e79bb54cdd0eae71f sha1 =
23ae83b0b6e5ec346c596ec05fe7065e4f4d97f2
+text = _ПриветМирL_ md5 = 741e7cc90fa5ccabb4c3f707bd387060 sha1 =
6cfd4854b8b19015e48687849a6069ab7f997164
+
+text = _Hello, World!_ md5 = 65a8e27d8879283831b664bd8b7f0ad4 sha1 =
0a0a9f2a6772942557ab5355d76af442f8f65e01
+text = _Hello, World?_ md5 = 925de34d3e74f6439f636a7905458f90 sha1 =
10f5f633e91d0b4e40232aef04a9452c84532407
+text = _Hello, World _ md5 = 037644941130118d5aade8cfb92d77d3 sha1 =
defa00ad8a0ed31720df3be88d29d0d60f085bd3
+text = _Hello, World._ md5 = e9db5cf8349b1166e96a742e198a0dd1 sha1 =
179df601a4e8cfd0a97b29484410a5f42fcbfff1
+text = _Hello, World9_ md5 = faf56df200d7f645a7911c4179614ca8 sha1 =
8a420fad2ccc0504448871245cb5769a42a16cdb
+text = _Hello, WorldЖ_ md5 = ffa8f2b84083d767a672debbe535a68e sha1 =
4a57c7b5874d38a98b6de30496fd51894039334f
+text = _Hello, WorldZ_ md5 = d6ec5883599d8ad6da7a32a094c1375b sha1 =
cdc052e9c8e42b61fd3d45c72211b4d0bafcd39f
diff --git a/tests/exslt/crypto/hash.1.xml b/tests/exslt/crypto/hash.1.xml
new file mode 100644
index 0000000..57bf45f
--- /dev/null
+++ b/tests/exslt/crypto/hash.1.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<patterns>
+
+ <pattern>Привет, Мир!</pattern>
+ <pattern>Привет, Мир?</pattern>
+ <pattern>Привет, Мир </pattern>
+ <pattern>Привет, Мир.</pattern>
+ <pattern>Привет, Мир9</pattern>
+ <pattern>Привет, МирЖ</pattern>
+ <pattern>Привет, МирZ</pattern>
+ <pattern>Привет,МирZ </pattern>
+ <pattern>Привет, МирZ </pattern>
+ <pattern>Привет, МирZ</pattern>
+ <pattern>ПриветМирL</pattern>
+
+ <br/>
+
+ <pattern>Hello, World!</pattern>
+ <pattern>Hello, World?</pattern>
+ <pattern>Hello, World </pattern>
+ <pattern>Hello, World.</pattern>
+ <pattern>Hello, World9</pattern>
+ <pattern>Hello, WorldЖ</pattern>
+ <pattern>Hello, WorldZ</pattern>
+
+</patterns>
diff --git a/tests/exslt/crypto/hash.1.xsl b/tests/exslt/crypto/hash.1.xsl
new file mode 100644
index 0000000..403ea10
--- /dev/null
+++ b/tests/exslt/crypto/hash.1.xsl
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:crypto="http://exslt.org/crypto"
+ exclude-result-prefixes="crypto"
+ version="1.0">
+
+ <xsl:output method="text" encoding="utf-8"/>
+
+ <xsl:variable name="nl" select="'
'"/>
+
+ <xsl:template match="/">
+ <xsl:apply-templates select="patterns/*"/>
+ </xsl:template>
+
+ <xsl:template match="br">
+ <xsl:value-of select="$nl"/>
+ </xsl:template>
+
+ <xsl:template match="pattern">
+ <xsl:variable name="text" select="."/>
+
+ <xsl:text>text = _</xsl:text>
+ <xsl:value-of select="$text"/>
+ <xsl:text>_</xsl:text>
+
+ <xsl:text> md5 = </xsl:text>
+ <xsl:value-of select="crypto:md5($text)"/>
+
+ <xsl:text> sha1 = </xsl:text>
+ <xsl:value-of select="crypto:sha1($text)"/>
+
+ <xsl:value-of select="$nl"/>
+ </xsl:template>
+
+</xsl:stylesheet>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]