From 99a0730696624465bcf42935e37f27952546bd9a Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 8 Nov 2001 02:07:36 +0000 Subject: [PATCH] First pass at moving all of Narya test stuff into the tests directory. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@598 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../threerings/whirled/data/DummyScene.java | 4 +- .../server/persist/DummySceneRepository.java | 4 +- tests/bin/runjava | 97 +++++++++++++++++++ tests/build.xml | 61 ++++++++++++ .../com/threerings/cast/builder/TestApp.java | 8 +- .../threerings/cast/builder/TestFrame.java | 5 +- .../threerings/crowd/client/TestClient.java | 5 +- .../src/java/com/threerings/io/FrameTest.java | 5 +- .../com/threerings/parlor/TestClient.java | 4 +- .../com/threerings/parlor/TestConfig.java | 4 +- .../com/threerings/parlor/TestController.java | 4 +- .../com/threerings/parlor/TestManager.java | 4 +- .../com/threerings/parlor/TestServer.java | 4 +- .../presents/client/TestClient.java | 10 +- .../presents/client/TestReceiver.java | 5 +- .../presents/client/TestService.java | 6 +- .../threerings/presents/server/DOMTest.java | 5 +- .../presents/server/DestroyedRefTest.java | 5 +- .../threerings/presents/server/RefTest.java | 5 +- .../presents/server/TestObject.dobj | 4 +- .../presents/server/TestProvider.java | 6 +- .../presents/server/TestServer.java | 5 +- .../whirled/DummyClientSceneRepository.java | 4 +- .../com/threerings/whirled/TestClient.java | 4 +- .../com/threerings/whirled/TestConfig.java | 4 +- .../threerings/whirled/TestController.java | 4 +- 26 files changed, 210 insertions(+), 66 deletions(-) create mode 100755 tests/bin/runjava create mode 100644 tests/build.xml diff --git a/src/java/com/threerings/whirled/data/DummyScene.java b/src/java/com/threerings/whirled/data/DummyScene.java index 13413acdf..abdba2f46 100644 --- a/src/java/com/threerings/whirled/data/DummyScene.java +++ b/src/java/com/threerings/whirled/data/DummyScene.java @@ -1,7 +1,7 @@ // -// $Id: DummyScene.java,v 1.5 2001/10/11 04:07:54 mdb Exp $ +// $Id: DummyScene.java,v 1.6 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.whirled.test; +package com.threerings.whirled; import com.threerings.crowd.data.PlaceConfig; import com.threerings.whirled.data.Scene; diff --git a/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java b/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java index c54a8c966..129ad52df 100644 --- a/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java +++ b/src/java/com/threerings/whirled/server/persist/DummySceneRepository.java @@ -1,7 +1,7 @@ // -// $Id: DummySceneRepository.java,v 1.4 2001/10/05 23:59:37 mdb Exp $ +// $Id: DummySceneRepository.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.whirled.test; +package com.threerings.whirled; import com.samskivert.io.PersistenceException; diff --git a/tests/bin/runjava b/tests/bin/runjava new file mode 100755 index 000000000..9388fc739 --- /dev/null +++ b/tests/bin/runjava @@ -0,0 +1,97 @@ +#!/usr/bin/perl -w + +use Getopt::Std; + +my $usage = "Usage: $0 [-p pid_file] args\n"; + +# locations of stuff +chomp($location = `dirname $0`); + +# get the server root by popping the /bin off of our parent directory +@parts = split(/\//, $location); +pop(@parts); +my $root = join("/", @parts); + +# but we're in the test directory, so we want up one +$root = "$root/.."; + +# make sure JAVA_HOME is set +my $jhome = $ENV{"JAVA_HOME"}; +if (!defined $jhome) { + warn "$0: Error: No JAVA_HOME specified!\n"; + warn "\n"; + warn "You must set your JAVA_HOME environment variable to the\n"; + warn "the absolute path of your JDK installation. For example:\n"; + warn "\n"; + warn " % JAVA_HOME=/usr/local/jdk1.2\n"; + warn " % export JAVA_HOME\n"; + die "\n"; +} + +# make sure it's set to a directory +if (! -d $jhome) { + die "$0: Can't find a java interpreter in '$jhome'.\n"; +} + +my $java = "$jhome/bin/java"; +my $jlib = "$jhome/lib/classes.zip"; + +# determine our machine architecture +my $ostype = `uname -s`; +my $machtype = `uname -m`; +chomp($ostype); +chomp($machtype); +my $arch = "$machtype-$ostype"; + +# add our native libraries to the runtime library path +my $libs = "$root/lib/$arch"; +my $libpath = $ENV{"LD_LIBRARY_PATH"}; + +if (defined $libpath) { + $ENV{"LD_LIBRARY_PATH"} = "$libs:$libpath"; +} else { + $ENV{"LD_LIBRARY_PATH"} = $libs; +} + +# put everything in our class path +my $classpath = "-classpath $jlib:$root/dist/classes:$root/tests/dist/classes"; + +# any zip or jar files in our lib/ directory get added to the class path +if (opendir(DIR, "$root/lib")) { + foreach $lib (grep { /.(zip|jar)/ && -f "$root/lib/$_" } readdir(DIR)) { + $classpath .= ":$root/lib/$lib"; + } + closedir DIR; +} + +# specify our server root (this is for server code) +my $rootarg = "-Droot=$root"; + +my $pid_file = undef; +my $i = 0; + +# strip out the -p args (we'd use getopt() but the damned thing provides +# no way of escaping arguments so that we can pass args to runjava that +# get passed down to the JVM) +for ($i = 0; $i < @ARGV; $i++) { + my $arg = $ARGV[$i]; + + # stop when we see -- (and strip it out because Java don't dig --) + if ($arg eq "--") { + splice(@ARGV, $i, 1); + last; + } + + if ($arg eq "-p") { + $pid_file = $ARGV[$i+1]; + splice(@ARGV, $i, 2); + $i -= 1; # decrement i so that things stay in sync + } +} + +# log the pid file if requested to do so +print `echo $$ > $pid_file` if (defined $pid_file); + +my $cmd = "$java -mx256M $classpath $rootarg " . join(" ", @ARGV); +# print "$cmd\n"; +exec($cmd); diff --git a/tests/build.xml b/tests/build.xml new file mode 100644 index 000000000..dcbbb57b8 --- /dev/null +++ b/tests/build.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/src/java/com/threerings/cast/builder/TestApp.java b/tests/src/java/com/threerings/cast/builder/TestApp.java index ec2c9c93b..ba4483947 100644 --- a/tests/src/java/com/threerings/cast/builder/TestApp.java +++ b/tests/src/java/com/threerings/cast/builder/TestApp.java @@ -1,7 +1,7 @@ // -// $Id: TestApp.java,v 1.2 2001/11/01 01:40:42 shaper Exp $ +// $Id: TestApp.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.cast.builder.test; +package com.threerings.cast.builder; import java.io.IOException; import javax.swing.JFrame; @@ -9,11 +9,11 @@ import javax.swing.JFrame; import com.samskivert.util.Config; import com.samskivert.swing.util.SwingUtil; +import com.threerings.media.ImageManager; + import com.threerings.cast.Log; import com.threerings.cast.CharacterManager; -import com.threerings.media.ImageManager; - import com.threerings.miso.util.MisoUtil; public class TestApp diff --git a/tests/src/java/com/threerings/cast/builder/TestFrame.java b/tests/src/java/com/threerings/cast/builder/TestFrame.java index 8b4c484d4..0d9660018 100644 --- a/tests/src/java/com/threerings/cast/builder/TestFrame.java +++ b/tests/src/java/com/threerings/cast/builder/TestFrame.java @@ -1,12 +1,11 @@ // -// $Id: TestFrame.java,v 1.1 2001/10/30 16:16:01 shaper Exp $ +// $Id: TestFrame.java,v 1.2 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.cast.builder.test; +package com.threerings.cast.builder; import javax.swing.JFrame; import com.threerings.cast.CharacterManager; -import com.threerings.cast.builder.BuilderPanel; public class TestFrame extends JFrame { diff --git a/tests/src/java/com/threerings/crowd/client/TestClient.java b/tests/src/java/com/threerings/crowd/client/TestClient.java index dc9693d1b..9850b1e69 100644 --- a/tests/src/java/com/threerings/crowd/client/TestClient.java +++ b/tests/src/java/com/threerings/crowd/client/TestClient.java @@ -1,7 +1,7 @@ // -// $Id: TestClient.java,v 1.6 2001/10/11 04:07:51 mdb Exp $ +// $Id: TestClient.java,v 1.7 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.crowd.client.test; +package com.threerings.crowd.client; import com.samskivert.util.Config; import com.samskivert.util.Queue; @@ -11,7 +11,6 @@ import com.threerings.presents.dobj.DObjectManager; import com.threerings.presents.net.*; import com.threerings.crowd.Log; -import com.threerings.crowd.client.*; import com.threerings.crowd.util.CrowdContext; public class TestClient diff --git a/tests/src/java/com/threerings/io/FrameTest.java b/tests/src/java/com/threerings/io/FrameTest.java index 8852d1e57..577272ec0 100644 --- a/tests/src/java/com/threerings/io/FrameTest.java +++ b/tests/src/java/com/threerings/io/FrameTest.java @@ -1,10 +1,9 @@ // -// $Id: FrameTest.java,v 1.3 2001/10/11 04:07:53 mdb Exp $ +// $Id: FrameTest.java,v 1.4 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.io.test; +package com.threerings.presents.io; import java.io.*; -import com.threerings.presents.io.*; public class FrameTest { diff --git a/tests/src/java/com/threerings/parlor/TestClient.java b/tests/src/java/com/threerings/parlor/TestClient.java index 0c606a9be..07da88041 100644 --- a/tests/src/java/com/threerings/parlor/TestClient.java +++ b/tests/src/java/com/threerings/parlor/TestClient.java @@ -1,7 +1,7 @@ // -// $Id: TestClient.java,v 1.4 2001/10/11 21:08:22 mdb Exp $ +// $Id: TestClient.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.parlor.test; +package com.threerings.parlor; import com.samskivert.util.Config; import com.samskivert.util.Queue; diff --git a/tests/src/java/com/threerings/parlor/TestConfig.java b/tests/src/java/com/threerings/parlor/TestConfig.java index a2a24fd95..e66b4b530 100644 --- a/tests/src/java/com/threerings/parlor/TestConfig.java +++ b/tests/src/java/com/threerings/parlor/TestConfig.java @@ -1,7 +1,7 @@ // -// $Id: TestConfig.java,v 1.2 2001/10/11 21:08:22 mdb Exp $ +// $Id: TestConfig.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.parlor.test; +package com.threerings.parlor; import java.io.IOException; import java.io.DataInputStream; diff --git a/tests/src/java/com/threerings/parlor/TestController.java b/tests/src/java/com/threerings/parlor/TestController.java index 9490aa74b..e263cea9a 100644 --- a/tests/src/java/com/threerings/parlor/TestController.java +++ b/tests/src/java/com/threerings/parlor/TestController.java @@ -1,7 +1,7 @@ // -// $Id: TestController.java,v 1.4 2001/10/11 21:08:22 mdb Exp $ +// $Id: TestController.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.parlor.test; +package com.threerings.parlor; import com.threerings.crowd.client.PlaceView; import com.threerings.parlor.game.GameController; diff --git a/tests/src/java/com/threerings/parlor/TestManager.java b/tests/src/java/com/threerings/parlor/TestManager.java index f990a217d..7477e395b 100644 --- a/tests/src/java/com/threerings/parlor/TestManager.java +++ b/tests/src/java/com/threerings/parlor/TestManager.java @@ -1,7 +1,7 @@ // -// $Id: TestManager.java,v 1.2 2001/10/11 21:12:29 mdb Exp $ +// $Id: TestManager.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.parlor.test; +package com.threerings.parlor; import com.threerings.parlor.game.GameManager; diff --git a/tests/src/java/com/threerings/parlor/TestServer.java b/tests/src/java/com/threerings/parlor/TestServer.java index 4e1243e87..051ae83fc 100644 --- a/tests/src/java/com/threerings/parlor/TestServer.java +++ b/tests/src/java/com/threerings/parlor/TestServer.java @@ -1,7 +1,7 @@ // -// $Id: TestServer.java,v 1.2 2001/10/11 04:07:51 mdb Exp $ +// $Id: TestServer.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.parlor.test; +package com.threerings.parlor; import com.threerings.crowd.server.CrowdServer; diff --git a/tests/src/java/com/threerings/presents/client/TestClient.java b/tests/src/java/com/threerings/presents/client/TestClient.java index 7b18dcfda..da82918ba 100644 --- a/tests/src/java/com/threerings/presents/client/TestClient.java +++ b/tests/src/java/com/threerings/presents/client/TestClient.java @@ -1,16 +1,14 @@ // -// $Id: TestClient.java,v 1.11 2001/10/12 00:03:03 mdb Exp $ +// $Id: TestClient.java,v 1.12 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.client.test; +package com.threerings.presents.client; import com.samskivert.util.Queue; import com.threerings.presents.Log; -import com.threerings.presents.net.*; -import com.threerings.presents.client.*; import com.threerings.presents.dobj.*; - -import com.threerings.presents.server.test.TestObject; +import com.threerings.presents.net.*; +import com.threerings.presents.server.TestObject; /** * A standalone test client. diff --git a/tests/src/java/com/threerings/presents/client/TestReceiver.java b/tests/src/java/com/threerings/presents/client/TestReceiver.java index 71ae19db2..4040872f7 100644 --- a/tests/src/java/com/threerings/presents/client/TestReceiver.java +++ b/tests/src/java/com/threerings/presents/client/TestReceiver.java @@ -1,10 +1,9 @@ // -// $Id: TestReceiver.java,v 1.4 2001/10/11 04:07:52 mdb Exp $ +// $Id: TestReceiver.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.client.test; +package com.threerings.presents.client; import com.threerings.presents.Log; -import com.threerings.presents.client.InvocationReceiver; public class TestReceiver implements InvocationReceiver { diff --git a/tests/src/java/com/threerings/presents/client/TestService.java b/tests/src/java/com/threerings/presents/client/TestService.java index 66da15b61..10c9749eb 100644 --- a/tests/src/java/com/threerings/presents/client/TestService.java +++ b/tests/src/java/com/threerings/presents/client/TestService.java @@ -1,11 +1,9 @@ // -// $Id: TestService.java,v 1.4 2001/10/11 04:07:52 mdb Exp $ +// $Id: TestService.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.client.test; +package com.threerings.presents.client; import com.threerings.presents.Log; -import com.threerings.presents.client.Client; -import com.threerings.presents.client.InvocationDirector; /** * A test of the invocation services. diff --git a/tests/src/java/com/threerings/presents/server/DOMTest.java b/tests/src/java/com/threerings/presents/server/DOMTest.java index bc70e204a..9e1116b30 100644 --- a/tests/src/java/com/threerings/presents/server/DOMTest.java +++ b/tests/src/java/com/threerings/presents/server/DOMTest.java @@ -1,11 +1,10 @@ // -// $Id: DOMTest.java,v 1.4 2001/10/24 00:36:40 mdb Exp $ +// $Id: DOMTest.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.server.test; +package com.threerings.presents.server; import com.threerings.presents.Log; import com.threerings.presents.dobj.*; -import com.threerings.presents.server.*; /** * A simple test case for the dobjmgr. diff --git a/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java b/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java index ac247a6f1..389dba614 100644 --- a/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java +++ b/tests/src/java/com/threerings/presents/server/DestroyedRefTest.java @@ -1,11 +1,10 @@ // -// $Id: DestroyedRefTest.java,v 1.4 2001/10/24 00:36:40 mdb Exp $ +// $Id: DestroyedRefTest.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.server.test; +package com.threerings.presents.server; import com.threerings.presents.Log; import com.threerings.presents.dobj.*; -import com.threerings.presents.server.PresentsServer; /** * Tests that the dobjmgr will not allow a destroyed object to be added to diff --git a/tests/src/java/com/threerings/presents/server/RefTest.java b/tests/src/java/com/threerings/presents/server/RefTest.java index 711410f96..4a0ead112 100644 --- a/tests/src/java/com/threerings/presents/server/RefTest.java +++ b/tests/src/java/com/threerings/presents/server/RefTest.java @@ -1,11 +1,10 @@ // -// $Id: RefTest.java,v 1.4 2001/10/24 00:36:40 mdb Exp $ +// $Id: RefTest.java,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.server.test; +package com.threerings.presents.server; import com.threerings.presents.Log; import com.threerings.presents.dobj.*; -import com.threerings.presents.server.PresentsServer; /** * Tests the oid list reference tracking code. diff --git a/tests/src/java/com/threerings/presents/server/TestObject.dobj b/tests/src/java/com/threerings/presents/server/TestObject.dobj index 0b111949d..593db4e42 100644 --- a/tests/src/java/com/threerings/presents/server/TestObject.dobj +++ b/tests/src/java/com/threerings/presents/server/TestObject.dobj @@ -1,7 +1,7 @@ // -// $Id: TestObject.dobj,v 1.4 2001/10/11 04:07:53 mdb Exp $ +// $Id: TestObject.dobj,v 1.5 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.server.test; +package com.threerings.presents.server; import com.threerings.presents.dobj.*; diff --git a/tests/src/java/com/threerings/presents/server/TestProvider.java b/tests/src/java/com/threerings/presents/server/TestProvider.java index 5812b1a9d..36bd24556 100644 --- a/tests/src/java/com/threerings/presents/server/TestProvider.java +++ b/tests/src/java/com/threerings/presents/server/TestProvider.java @@ -1,13 +1,11 @@ // -// $Id: TestProvider.java,v 1.8 2001/10/11 04:07:53 mdb Exp $ +// $Id: TestProvider.java,v 1.9 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.server.test; +package com.threerings.presents.server; import com.threerings.presents.Log; import com.threerings.presents.client.test.TestService; import com.threerings.presents.data.ClientObject; -import com.threerings.presents.server.PresentsServer; -import com.threerings.presents.server.InvocationProvider; /** * A test of the invocation services. diff --git a/tests/src/java/com/threerings/presents/server/TestServer.java b/tests/src/java/com/threerings/presents/server/TestServer.java index 4d88feaea..e54459527 100644 --- a/tests/src/java/com/threerings/presents/server/TestServer.java +++ b/tests/src/java/com/threerings/presents/server/TestServer.java @@ -1,11 +1,10 @@ // -// $Id: TestServer.java,v 1.6 2001/10/24 00:36:40 mdb Exp $ +// $Id: TestServer.java,v 1.7 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.presents.server.test; +package com.threerings.presents.server; import com.threerings.presents.Log; import com.threerings.presents.dobj.*; -import com.threerings.presents.server.*; public class TestServer extends PresentsServer { diff --git a/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java b/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java index a68b3d3b2..74b0c462a 100644 --- a/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java +++ b/tests/src/java/com/threerings/whirled/DummyClientSceneRepository.java @@ -1,7 +1,7 @@ // -// $Id: DummyClientSceneRepository.java,v 1.2 2001/10/05 23:59:37 mdb Exp $ +// $Id: DummyClientSceneRepository.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.whirled.test; +package com.threerings.whirled; import java.io.IOException; diff --git a/tests/src/java/com/threerings/whirled/TestClient.java b/tests/src/java/com/threerings/whirled/TestClient.java index ecfe671a9..693f9c0aa 100644 --- a/tests/src/java/com/threerings/whirled/TestClient.java +++ b/tests/src/java/com/threerings/whirled/TestClient.java @@ -1,7 +1,7 @@ // -// $Id: TestClient.java,v 1.6 2001/10/11 04:07:54 mdb Exp $ +// $Id: TestClient.java,v 1.7 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.whirled.test; +package com.threerings.whirled; import com.samskivert.util.Config; import com.samskivert.util.Queue; diff --git a/tests/src/java/com/threerings/whirled/TestConfig.java b/tests/src/java/com/threerings/whirled/TestConfig.java index 5f19d4670..88e977974 100644 --- a/tests/src/java/com/threerings/whirled/TestConfig.java +++ b/tests/src/java/com/threerings/whirled/TestConfig.java @@ -1,7 +1,7 @@ // -// $Id: TestConfig.java,v 1.2 2001/10/11 04:07:54 mdb Exp $ +// $Id: TestConfig.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.whirled.test; +package com.threerings.whirled; import com.threerings.crowd.data.PlaceConfig; import com.threerings.whirled.server.SceneManager; diff --git a/tests/src/java/com/threerings/whirled/TestController.java b/tests/src/java/com/threerings/whirled/TestController.java index 0c40d34f7..96164f111 100644 --- a/tests/src/java/com/threerings/whirled/TestController.java +++ b/tests/src/java/com/threerings/whirled/TestController.java @@ -1,7 +1,7 @@ // -// $Id: TestController.java,v 1.2 2001/10/11 04:07:54 mdb Exp $ +// $Id: TestController.java,v 1.3 2001/11/08 02:07:36 mdb Exp $ -package com.threerings.whirled.test; +package com.threerings.whirled; import com.threerings.crowd.client.*;