This adds a couple new tests, and cleans up the test runner script a little.

2006-03-28  Casey Marshall  <[EMAIL PROTECTED]>

        * jessie-tests/run-tests.sh: add new tests; count number of tests
        run; log the finish date to `check.log.'
        * jessie-tests/gnu/javax/net/ssl/provider/testServerKeyEchange.java,
        * jessie-tests/gnu/javax/net/ssl/provider/testSignature: new
        files.

Index: run-tests.sh
===================================================================
RCS file: /cvsroot/classpath/classpath/jessie-tests/Attic/run-tests.sh,v
retrieving revision 1.1.2.2
diff -u -b -B -r1.1.2.2 run-tests.sh
--- run-tests.sh        28 Mar 2006 06:39:48 -0000      1.1.2.2
+++ run-tests.sh        28 Mar 2006 19:11:05 -0000
@@ -15,12 +15,15 @@
        gnu.javax.net.ssl.provider.testRecord \
        gnu.javax.net.ssl.provider.testServerDHParams \
        gnu.javax.net.ssl.provider.testServerHello \
-       gnu.javax.net.ssl.provider.testServerRSAParams"
+       gnu.javax.net.ssl.provider.testServerKeyExchange \
+       gnu.javax.net.ssl.provider.testServerRSAParams \
+       gnu.javax.net.ssl.provider.testSignature"
 
 rm -rf test-classes
 mkdir test-classes
 ${JAVAC} -d test-classes gnu/javax/net/ssl/provider/*.java || exit 1
 
+ntests=0
 fails=0
 rm -rf check.log check.err
 echo -n "Jessie check run at " | tee check.err > check.log
@@ -35,18 +38,19 @@
       echo FAIL: $test
       let 'fails = fails + 1'
   fi
+  let 'ntests = ntests + 1'
 done
 
 if test ${fails} -eq 1
 then
-    echo $fails failure
-    echo ---- $fails failure ---- >> check.err
+    echo $ntests tests, $fails failure
+    echo ---- $ntests tests, $fails failure ---- >> check.err
 else
-    echo $fails failures
-    echo ---- $fails failures ---- >> check.err
+    echo $ntests tests, $fails failures
+    echo ---- $ntests tests, $fails failures ---- >> check.err
 fi
-echo -n "Jessie check done at " >> check.err
-date >> check.err
+echo -n "Jessie check done at " | tee -a check.err >> check.log
+date | tee -a check.err >> check.log
 
 if test ${fails} -gt 0
     then
Index: gnu/javax/net/ssl/provider/testServerKeyExchange.java
===================================================================
RCS file: gnu/javax/net/ssl/provider/testServerKeyExchange.java
diff -N gnu/javax/net/ssl/provider/testServerKeyExchange.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gnu/javax/net/ssl/provider/testServerKeyExchange.java       28 Mar 2006 
19:11:05 -0000
@@ -0,0 +1,65 @@
+package gnu.javax.net.ssl.provider;
+
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+class testServerKeyExchange
+{
+  public static void main (String[] argv)
+  {
+    try
+      {
+        check ();
+      }
+    catch (Exception x)
+      {
+        System.out.println ("FAIL: caught exception " + x);
+        x.printStackTrace ();
+      }
+  }
+
+  static void check () throws Exception
+  {
+    ByteBuffer buffer = ByteBuffer.allocate (1024);
+    Handshake handshake = new Handshake (buffer, 
CipherSuite.SSL_RSA_WITH_NULL_MD5);
+
+    handshake.setType (Handshake.Type.SERVER_KEY_EXCHANGE);
+    handshake.setLength (1019);
+
+    ServerKeyExchange kex = (ServerKeyExchange) handshake.body ();
+    ServerRSAParams params = (ServerRSAParams) kex.params ();
+    BigInteger modulus = new BigInteger ("FEEDFACEDEADBEEFCAFEBABE00000001", 
16);
+    BigInteger exponent = BigInteger.valueOf (2);
+    params.setModulus (modulus);
+    params.setExponent (exponent);
+
+    Signature sig = kex.signature ();
+    byte[] sigbuf = new byte[256];
+    for (int i = 0; i < sigbuf.length; i++)
+      sigbuf[i] = (byte) i;
+    sig.setSignature (sigbuf);
+
+    handshake.setLength (kex.length ());
+
+    handshake = new Handshake (buffer, CipherSuite.SSL_RSA_WITH_NULL_MD5);
+    kex = (ServerKeyExchange) handshake.body ();
+    params = (ServerRSAParams) kex.params ();
+    sig = kex.signature ();
+
+    if (params.modulus ().equals (modulus))
+      System.out.println ("PASS: modulus");
+    else
+      System.out.println ("FAIL: modulus " + modulus + " != " + params.modulus 
());
+
+    if (params.exponent ().equals (exponent))
+      System.out.println ("PASS: exponent");
+    else
+      System.out.println ("FAIL: exponent " + exponent + " != " + 
params.exponent ());
+
+    if (Arrays.equals (sigbuf, sig.signature ()))
+      System.out.println ("PASS: signature");
+    else
+      System.out.println ("FAIL: signature");
+  }
+}
\ No newline at end of file
Index: gnu/javax/net/ssl/provider/testSignature.java
===================================================================
RCS file: gnu/javax/net/ssl/provider/testSignature.java
diff -N gnu/javax/net/ssl/provider/testSignature.java
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ gnu/javax/net/ssl/provider/testSignature.java       28 Mar 2006 19:11:05 
-0000
@@ -0,0 +1,44 @@
+package gnu.javax.net.ssl.provider;
+
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+
+class testSignature
+{
+  public static void main (String[] argv)
+  {
+    try
+      {
+        check ();
+      }
+    catch (Exception x)
+      {
+        System.out.println ("FAIL: caught exception " + x);
+      }
+  }
+
+  static void check () throws Exception
+  {
+    ByteBuffer buffer = ByteBuffer.allocate (1024);
+    Signature sig = new Signature (buffer, SignatureAlgorithm.RSA);
+    byte[] sigbuf = new byte[256];
+    for (int i = 0; i < sigbuf.length; i++)
+      sigbuf[i] = (byte) i;
+
+    sig.setSignature (sigbuf);
+
+    sig = new Signature (buffer, SignatureAlgorithm.RSA);
+
+    if (sig.length () == 258)
+      System.out.println ("PASS: length");
+    else
+      System.out.println ("FAIL: length (" + sig.length () + ")");
+
+    if (Arrays.equals (sigbuf, sig.signature ()))
+      System.out.println ("PASS: signature");
+    else
+      System.out.println ("FAIL: signature");
+
+    System.err.println (sig);
+  }
+}
\ No newline at end of file

Reply via email to