From 22ca1491bcf554339e835fbdc30576972f194356 Mon Sep 17 00:00:00 2001 From: smeghead <smeghead> Date: Thu, 27 Jan 2005 00:21:10 +0000 Subject: [PATCH] 2005-01-26 smeghead * Added a couple of scripts, i2ptest.sh and i2pbench.sh, to manage the core tests and benchmarks. * Routerconsole now builds under gcj 3.4.3. * Corrected divide by zero error in TunnelId class under gcj (jrandom++). --- apps/routerconsole/java/build.xml | 4 +- core/java/src/net/i2p/data/TunnelId.java | 4 +- core/perl/i2pbench.sh | 13 +++ core/perl/i2ptest.sh | 122 +++++++++++++++++++++++ history.txt | 8 +- 5 files changed, 147 insertions(+), 4 deletions(-) create mode 100644 core/perl/i2pbench.sh create mode 100644 core/perl/i2ptest.sh diff --git a/apps/routerconsole/java/build.xml b/apps/routerconsole/java/build.xml index 35ec90f8d2..db32d574a8 100644 --- a/apps/routerconsole/java/build.xml +++ b/apps/routerconsole/java/build.xml @@ -48,7 +48,7 @@ <mkdir dir="../jsp/WEB-INF/" /> <mkdir dir="../jsp/WEB-INF/classes" /> <!-- there are various jspc ant tasks, but they all seem a bit flakey --> - <java classname="org.apache.jasper.JspC" fork="true" > + <java classname="org.apache.jasper.JspC" fork="true"> <classpath> <pathelement location="../../jetty/jettylib/jasper-compiler.jar" /> <pathelement location="../../jetty/jettylib/jasper-runtime.jar" /> @@ -57,6 +57,8 @@ <pathelement location="../../systray/java/build/obj" /> <pathelement location="../../systray/java/lib/systray4j.jar" /> <!-- some javacs resolve recursively... --> <pathelement location="../../../installer/lib/wrapper/win32/wrapper.jar" /> <!-- we dont care if we're not on win32 --> + <pathelement location="../../../core/java/build/i2p.jar" /> + <pathelement location="../../../router/java/build/router.jar" /> <pathelement location="build/routerconsole.jar" /> </classpath> <arg value="-d" /> diff --git a/core/java/src/net/i2p/data/TunnelId.java b/core/java/src/net/i2p/data/TunnelId.java index 415c293f0a..6381f6be7d 100644 --- a/core/java/src/net/i2p/data/TunnelId.java +++ b/core/java/src/net/i2p/data/TunnelId.java @@ -27,8 +27,8 @@ public class TunnelId extends DataStructureImpl { private long _tunnelId; private int _type; - public static final long MAX_ID_VALUE = (1l<<32l)-1l; - + public static final long MAX_ID_VALUE = (1l<<32l)-2l; + public final static int TYPE_UNSPECIFIED = 0; public final static int TYPE_INBOUND = 1; public final static int TYPE_OUTBOUND = 2; diff --git a/core/perl/i2pbench.sh b/core/perl/i2pbench.sh new file mode 100644 index 0000000000..464e962d57 --- /dev/null +++ b/core/perl/i2pbench.sh @@ -0,0 +1,13 @@ +#!/usr/bin/perl + +print "\nBenchmark Suite #1: i2p/core/java/test/net/i2p/crypto/*\n\n"; + +@testclasses = ( "AES256Bench", "DSABench", "ElGamalBench", "SHA256Bench" ); + +foreach $testclass (@testclasses) { + print "[BENCHMARK] $testclass:\n\n"; + system("java -cp lib/i2p.jar:lib/jbigi.jar net.i2p.crypto.$testclass"); + print "\n"; +} + +print "\n*** ALL BENCHMARKS COMPLETE ***\n\n"; diff --git a/core/perl/i2ptest.sh b/core/perl/i2ptest.sh new file mode 100644 index 0000000000..63cdaf5858 --- /dev/null +++ b/core/perl/i2ptest.sh @@ -0,0 +1,122 @@ +#!/usr/bin/perl +# Yeah yeah, a lot of repetitive code here, but it works for now. + +$failed = 0; +$passed = 0; +$failedtotal = 0; +$passedtotal = 0; + +print "\nTest Suite #1: i2p/core/java/test/net/i2p/data/*Test\n\n"; + +@testclasses = ( "AbuseReason", "AbuseSeverity", "Boolean", "Certificate", + "CreateLeaseSetMessage", "CreateSessionMessage", "Date", "Destination", + "DestroySessionMessage", "DisconnectMessage", "Hash", "LeaseSet", "Lease", + "Mapping", "MessageId", "MessagePayloadMessage", "MessageStatusMessage", + "Payload", "PrivateKey", "PublicKey", "ReceiveMessageBeginMessage", + "ReceiveMessageEndMessage", "ReportAbuseMessage", "RequestLeaseSetMessage", + "RouterAddress", "RouterIdentity", "RouterInfo", "SendMessageMessage", + "SessionConfig", "SessionId", "SessionKey", "SessionStatusMessage", + "Signature", "SigningPrivateKey", "SigningPublicKey", "String", "TunnelId", + "UnsignedInteger" ); + +foreach $testclass (@testclasses) { + print "[TEST] $testclass: "; + if(! system("java -cp lib/i2p.jar:lib/jbigi.jar net.i2p.data.TestData test $testclass $testclass.dat > /dev/null 2>test.tmp")) { + print "OK\n"; + $passed++; + } else { + print "FAILED\n"; + print "Error Messages:\n\n"; + open TMP, "test.tmp"; + while (<TMP>) { + print "$_"; + } + print "\n"; + $failed++; + } + system("rm -f $testclass.dat test.tmp > /dev/null 2>&1"); +} + +print "\nTEST SUITE #1 RESULTS\nPassed: $passed\nFailed: $failed\n\n"; + +$failedtotal += $failed; +$passedtotal += $passed; +$failed = 0; +$passed = 0; + +print "\nTest Suite #2: i2p/core/java/test/net/i2p/crypto/*\n\n"; + +@testclasses = ( "ElGamalAESEngine", "ElGamalVerify", "SessionEncryptionTest" ); + +foreach $testclass (@testclasses) { + if ($testclass eq "SessionEncryptionTest") { + print "[TEST] $testclass: "; + if(! system("java -cp lib/i2p.jar:lib/jbigi.jar net.i2p.crypto.SessionEncryptionTest > /dev/null 2>test.tmp")) { + print "OK\n"; + $passed++; + } else { + print "FAILED\n"; + print "Error Messages:\n\n"; + open TMP, "test.tmp"; + while (<TMP>) { + print "$_"; + } + $failed++; + } + } else { + print "[TEST] $testclass:\n\n"; + if(! system("java -cp lib/i2p.jar:lib/jbigi.jar net.i2p.crypto.$testclass")) { + $passed++; + } else { + $failed++; + } + } + print "\n"; + system("rm -f test.tmp > /dev/null 2>&1"); +} + +print "\nTEST SUITE #2 RESULTS\nPassed: $passed\nFailed: $failed\n\n"; + +$failedtotal += $failed; +$passedtotal += $passed; +$failed = 0; +$passed = 0; + +print "\nTest Suite #3: Miscellaneous\n\n"; + +@testclasses = ( "net.i2p.util.LogManager", "net.i2p.util.OrderedProperties", + "net.i2p.stat.RateStat", "net.i2p.data.UnsignedInteger" ); + +foreach $testclass (@testclasses) { + if ($testclass eq "net.i2p.data.UnsignedInteger") { + print "[TEST] $testclass:\n\n"; + if(! system("java -cp lib/i2p.jar:lib/jbigi.jar net.i2p.data.UnsignedInteger")) { + $passed++; + } else { + $failed++; + } + print "\n"; + } else { + print "[TEST] $testclass: "; + if(! system("java -cp lib/i2p.jar:lib/jbigi.jar $testclass > /dev/null 2>test.tmp")) { + print "OK\n"; + $passed++; + } else { + print "FAILED\n"; + print "Error Messages:\n\n"; + open TMP, "test.tmp"; + while (<TMP>) { + print "$_"; + } + $failed++; + } + } + system("rm -f test.tmp > /dev/null 2>&1"); +} + +print "\nTEST SUITE #3 RESULTS\nPassed: $passed\nFailed: $failed\n\n"; + +$failedtotal += $failed; +$passedtotal += $passed; + +print "\n*** ALL TESTS COMPLETE ***\n\nTotal Passed: $passedtotal\nTotal Failed: $failedtotal\n\n"; diff --git a/history.txt b/history.txt index af18a09ed0..dcf551e837 100644 --- a/history.txt +++ b/history.txt @@ -1,4 +1,10 @@ -$Id: history.txt,v 1.133 2005/01/24 17:42:05 smeghead Exp $ +$Id: history.txt,v 1.134 2005/01/26 01:29:19 smeghead Exp $ + +2005-01-26 smeghead + * Added a couple of scripts, i2ptest.sh and i2pbench.sh, to manage the core + tests and benchmarks. + * Routerconsole now builds under gcj 3.4.3. + * Corrected divide by zero error in TunnelId class under gcj (jrandom++). 2005-01-25 smeghead * Tweaked some classes to enable gcj 3.4.3 to compile the router and -- GitLab