Author: toad
Date: 2008-09-11 11:32:36 +0000 (Thu, 11 Sep 2008)
New Revision: 22589
Modified:
trunk/freenet/src/freenet/node/simulator/BootstrapPullTest.java
trunk/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
trunk/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
trunk/freenet/src/freenet/node/simulator/SeednodePingTest.java
Log:
If the startup throws, nodes may not exit, resulting in a stall and failed
tests.
Modified: trunk/freenet/src/freenet/node/simulator/BootstrapPullTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/BootstrapPullTest.java
2008-09-11 11:30:22 UTC (rev 22588)
+++ trunk/freenet/src/freenet/node/simulator/BootstrapPullTest.java
2008-09-11 11:32:36 UTC (rev 22589)
@@ -42,6 +42,7 @@
public static int EXIT_INSERT_FAILED = 259;
public static int EXIT_FETCH_FAILED = 260;
public static int EXIT_INSERTER_PROBLEM = 261;
+ public static int EXIT_THREW_SOMETHING = 262;
public static int DARKNET_PORT = 5004;
public static int OPENNET_PORT = 5005;
@@ -54,6 +55,7 @@
* @throws InterruptedException
*/
public static void main(String[] args) throws
InvalidThresholdException, IOException, NodeInitException, InterruptedException
{
+ try {
String ipOverride = null;
if(args.length > 0)
ipOverride = args[0];
@@ -116,7 +118,11 @@
System.out.println("RESULT: Fetch took
"+(endFetchTime-startFetchTime)+"ms
("+TimeUtil.formatTime(endFetchTime-startFetchTime)+") of "+uri+" .");
secondNode.park();
System.exit(0);
-
+ } catch (Throwable t) {
+ System.err.println("CAUGHT: "+t);
+ t.printStackTrace();
+ System.exit(EXIT_THREW_SOMETHING);
+ }
}
private static FreenetURI insertData(File dataFile) throws IOException {
Modified: trunk/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
2008-09-11 11:30:22 UTC (rev 22588)
+++ trunk/freenet/src/freenet/node/simulator/BootstrapPushPullTest.java
2008-09-11 11:32:36 UTC (rev 22589)
@@ -32,8 +32,10 @@
public static int EXIT_FAILED_TARGET = 258;
public static int EXIT_INSERT_FAILED = 259;
public static int EXIT_FETCH_FAILED = 260;
+ public static int EXIT_THREW_SOMETHING = 261;
public static void main(String[] args) throws
InvalidThresholdException, IOException, NodeInitException, InterruptedException
{
+ try {
String ipOverride = null;
if(args.length > 0)
ipOverride = args[0];
@@ -113,6 +115,11 @@
System.out.println("RESULT: Fetch took
"+(endFetchTime-startFetchTime)+"ms
("+TimeUtil.formatTime(endFetchTime-startFetchTime)+") of "+uri+" .");
secondNode.park();
System.exit(0);
+ } catch (Throwable t) {
+ System.err.println("CAUGHT: "+t);
+ t.printStackTrace();
+ System.exit(EXIT_THREW_SOMETHING);
+ }
}
private static void waitForTenNodes(Node node) throws
InterruptedException {
Modified: trunk/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
2008-09-11 11:30:22 UTC (rev 22588)
+++ trunk/freenet/src/freenet/node/simulator/BootstrapSeedTest.java
2008-09-11 11:32:36 UTC (rev 22589)
@@ -20,6 +20,7 @@
public static int TARGET_PEERS = 10;
public static int EXIT_NO_SEEDNODES = 257;
public static int EXIT_FAILED_TARGET = 258;
+ public static int EXIT_THREW_SOMETHING = 259;
/**
* @param args
@@ -29,6 +30,7 @@
* @throws IOException
*/
public static void main(String[] args) throws
InvalidThresholdException, NodeInitException, InterruptedException, IOException
{
+ try {
String ipOverride = null;
if(args.length > 0)
ipOverride = args[0];
@@ -75,6 +77,11 @@
System.err.println("Failed to reach target peers count
"+TARGET_PEERS+" in 5 minutes.");
node.park();
System.exit(EXIT_FAILED_TARGET);
+ } catch (Throwable t) {
+ System.err.println("CAUGHT: "+t);
+ t.printStackTrace();
+ System.exit(EXIT_THREW_SOMETHING);
+ }
}
}
Modified: trunk/freenet/src/freenet/node/simulator/SeednodePingTest.java
===================================================================
--- trunk/freenet/src/freenet/node/simulator/SeednodePingTest.java
2008-09-11 11:30:22 UTC (rev 22588)
+++ trunk/freenet/src/freenet/node/simulator/SeednodePingTest.java
2008-09-11 11:32:36 UTC (rev 22589)
@@ -43,6 +43,7 @@
static final long COUNT_SUCCESSES_PERIOD = 7*24*60*60*1000; // 1 week
public static void main(String[] args) throws FSParseException,
IOException, OpennetDisabledException, PeerParseException,
InterruptedException, ReferenceSignatureVerificationException,
NodeInitException, InvalidThresholdException {
+ try {
if(args.length == 1)
STATUS_DIR = new File(args[0]);
RandomSource random = NodeStarter.globalTestInit("seednode-pingtest",
false, Logger.ERROR, "");
@@ -179,5 +180,10 @@
}
node.park();
System.exit(0);
+ } catch (Throwable t) {
+ System.err.println("CAUGHT: "+t);
+ t.printStackTrace();
+ System.exit(1);
}
+ }
}