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
This commit is contained in:
Michael Bayne
2001-11-08 02:07:36 +00:00
parent f6c08bfbbd
commit 99a0730696
26 changed files with 210 additions and 66 deletions
+97
View File
@@ -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);
+61
View File
@@ -0,0 +1,61 @@
<!-- build configuration -->
<project name="narya tests" default="test" basedir=".">
<!-- things you may want to change -->
<property name="build.compiler" value="jikes"/>
<property name="java.libraries" value="/usr/share/java"/>
<property name="junit.fork" value="false"/>
<!-- things you probably don't want to change -->
<property name="test.dir" value="."/>
<property name="src.dir" value="src/java"/>
<property name="deploy.dir" value="dist"/>
<!-- declare our classpath -->
<path id="classpath">
<pathelement location="../${deploy.dir}/classes"/>
<pathelement location="${deploy.dir}/classes"/>
<fileset dir="../lib" includes="**/*.jar"/>
<fileset dir="${java.libraries}" includes="**/*.jar"/>
</path>
<!-- prepares the application directories -->
<target name="prepare">
<mkdir dir="${deploy.dir}"/>
<mkdir dir="${deploy.dir}/classes"/>
<copy todir="${deploy.dir}/classes">
<fileset dir="${src.dir}" includes="**/*.properties"/>
</copy>
<copy todir="${deploy.dir}/classes/rsrc">
<fileset dir="rsrc" includes="**/*"/>
</copy>
</target>
<!-- cleans out the installed application -->
<target name="clean">
<delete dir="${deploy.dir}"/>
</target>
<!-- build the java class files -->
<target name="compile" depends="prepare">
<javac srcdir="${src.dir}" destdir="${deploy.dir}/classes"
debug="on" optimize="off" deprecation="off">
<classpath refid="classpath"/>
</javac>
</target>
<!-- run the tests -->
<target name="test" depends="compile" description="Run tests.">
<junit printsummary="no" haltonfailure="yes" fork="${junit.fork}">
<classpath refid="classpath"/>
<sysproperty key="test_dir" value="${test.dir}"/>
<formatter type="brief" usefile="false"/>
<batchtest>
<fileset dir="${src.dir}">
<include name="**/*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
</project>
@@ -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
@@ -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
{
@@ -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
@@ -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
{
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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;
@@ -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.
@@ -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
{
@@ -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.
@@ -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.
@@ -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
@@ -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.
@@ -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.*;
@@ -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.
@@ -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
{
@@ -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;
@@ -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;
@@ -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;
@@ -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.*;