labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject svn commit: r600124 - in /labs/badca: Makefile.in build/extensionPath.py configure.ac tests/KeysTestCase.py
Date Sat, 01 Dec 2007 13:41:25 GMT
Author: dreid
Date: Sat Dec  1 05:41:25 2007
New Revision: 600124

URL: http://svn.apache.org/viewvc?rev=600124&view=rev
Log:
Add new build helper script
Add configuration of the extension path to configure
Add more information when configure is complete

Correct a minor typo i the Keys test pointed out by 
Mads Toftum.

Added:
    labs/badca/build/extensionPath.py   (with props)
Modified:
    labs/badca/Makefile.in
    labs/badca/configure.ac
    labs/badca/tests/KeysTestCase.py

Modified: labs/badca/Makefile.in
URL: http://svn.apache.org/viewvc/labs/badca/Makefile.in?rev=600124&r1=600123&r2=600124&view=diff
==============================================================================
--- labs/badca/Makefile.in (original)
+++ labs/badca/Makefile.in Sat Dec  1 05:41:25 2007
@@ -9,6 +9,6 @@
 	(cd openssl && @PYTHON@ setup.py clean) || exit 1
 
 test:
-	PYTHONPATH="@top_srcdir@/:@top_srcdir@/openssl/build/lib.linux-i686-2.5" \
+	PYTHONPATH="@EXT_PATH@:$$PYTHONPATH" \
 	@PYTHON@ @top_srcdir@/tests/KeysTestCase.py
 

Added: labs/badca/build/extensionPath.py
URL: http://svn.apache.org/viewvc/labs/badca/build/extensionPath.py?rev=600124&view=auto
==============================================================================
--- labs/badca/build/extensionPath.py (added)
+++ labs/badca/build/extensionPath.py Sat Dec  1 05:41:25 2007
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+
+# This script allows us to get the path that the python extensions are
+# built in, prior to being installed. This allows us to run tests
+# without needing to perform an installation.
+
+import os, sys
+import string
+from distutils.util import get_platform
+
+# Get the root path for the source as this contains the BaDCA package
+testPath = os.path.dirname(sys.argv[0])
+rootPath = os.path.abspath(testPath + '/..')
+
+# These lines from distutils to ensure we have the correct dir names
+plat_specifier = ".%s-%s" % (get_platform(), sys.version[0:3])
+try:
+    debug_ext = sys.pydebug and '_d' or ''
+except AttributeError:
+    debug_ext = ''
+
+print os.path.join(rootPath, 'openssl/build/lib' + debug_ext + plat_specifier)
+

Propchange: labs/badca/build/extensionPath.py
------------------------------------------------------------------------------
    svn:executable = *

Modified: labs/badca/configure.ac
URL: http://svn.apache.org/viewvc/labs/badca/configure.ac?rev=600124&r1=600123&r2=600124&view=diff
==============================================================================
--- labs/badca/configure.ac (original)
+++ labs/badca/configure.ac Sat Dec  1 05:41:25 2007
@@ -22,10 +22,28 @@
 AC_CHECK_LIB(crypto, BN_init)
 AC_CHECK_LIB(ssl, SSL_accept)
 
+dnl Use a simple paython script to find the path that our extensions
+dnl will be built in. This is used to allow tests to be run without the
+dnl need to install the extensions.
+EXT_PATH=`$top_srcdir/build/extensionPath.py`
+AC_MSG_RESULT([Extensions will be built in $EXT_PATH])
+AC_SUBST(EXT_PATH)
+
 AC_SUBST(top_srcdir)
 
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT()
 
-echo "All looks good to build BaDCA!"
+echo "
+All looks good to build BaDCA!
+
+To build BaDCA, type
+
+    make
+
+To test BaDCA, type
+
+    make test
+
+"
 

Modified: labs/badca/tests/KeysTestCase.py
URL: http://svn.apache.org/viewvc/labs/badca/tests/KeysTestCase.py?rev=600124&r1=600123&r2=600124&view=diff
==============================================================================
--- labs/badca/tests/KeysTestCase.py (original)
+++ labs/badca/tests/KeysTestCase.py Sat Dec  1 05:41:25 2007
@@ -14,7 +14,7 @@
 
     def testCreation(self):
         """ Testing creation of keys of different strengths """
-        for r in ( 1024, 2048, 4096 ):
+        for r in ( 1024, 2048, 4096, 8192 ):
             assert self.obj.create(r) == 1, \
                             "Unable to create key of strength " + str(r)
             assert self.obj.bits == r, "Incorrect strength key created"
@@ -24,16 +24,24 @@
         self.assertRaises(Keys.rsa.keySize, self.obj.create, 512)
         self.assertRaises(Keys.rsa.keySize, self.obj.create, 9216)
         self.assertRaises(Keys.rsa.keySize, self.obj.create, 1023)
-        self.assertRaises(Keys.rsa.keySize, self.obj.create, 8917)
+        self.assertRaises(Keys.rsa.keySize, self.obj.create, 8193)
 
     def testReadPublicKey(self):
         """ Test reading in a public key we have a private key available for """
-        testKey = Keys.RSAKey()
-        assert testKey.readPublicKey('tests/keys/test1.public.key') == 1, \
+        assert self.obj.readPublicKey('tests/keys/test1.public.key') == 1, \
                                              "Failed to read public key"
-        assert testKey.isValid(), "Invalid key object created"
-        assert testKey.hasPublic(), "No public key available"
-        assert testKey.hasPrivate(), "No private key available"
+        assert self.obj.isValid(), "Invalid key object created"
+        assert self.obj.hasPublic(), "No public key available"
+        assert self.obj.hasPrivate(), "No private key available"
+
+
+    def testReadPrivateKey(self):
+        """ Test reading of private key """
+        assert self.obj.readPrivateKey('tests/keys/test2.key') == 1, \
+               "Failed to read private key"
+        assert self.obj.isValid(), "Invalid key object created"
+        assert self.obj.hasPublic(), "Public key not available??"
+        assert self.obj.hasPrivate(), "Private key not available??"
 
 
 if __name__ == "__main__":



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message