You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mt...@apache.org on 2011/04/13 23:55:48 UTC
svn commit: r1091931 - in /commons/sandbox/runtime/trunk: ./
src/main/test/org/apache/commons/runtime/
Author: mturk
Date: Wed Apr 13 21:55:48 2011
New Revision: 1091931
URL: http://svn.apache.org/viewvc?rev=1091931&view=rev
Log:
Make parent/child test support
Modified:
commons/sandbox/runtime/trunk/build.xml
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java
commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java
Modified: commons/sandbox/runtime/trunk/build.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/build.xml?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/build.xml (original)
+++ commons/sandbox/runtime/trunk/build.xml Wed Apr 13 21:55:48 2011
@@ -367,25 +367,46 @@ The Apache Software Foundation (http://w
</taskdef>
</target>
- <!-- =================================================================== -->
- <!-- Junit tests -->
- <!-- =================================================================== -->
- <target name="test" depends="tests">
- <testng outputdir="${build.dir}/out/report"
+ <macrodef name="runtest">
+ <attribute name="groups" default="init"/>
+ <attribute name="name" default="Main Test Suite"/>
+ <sequential>
+ <testng outputdir="${build.dir}/out/@{name}"
workingdir="${build.dir}/out"
verbose="1"
haltOnfailure="true"
- suitename="${name} Test Suite">
- <classpath refid="test.classpath"/>
- <classfileset dir="${build.dest}/test">
- <include name="**/*.class"/>
- </classfileset>
- <env key="PATH" path="${runtime.library.path}${path.separator}${java.library.path}"/>
- <env key="Path" path="${runtime.library.path}${path.separator}${java.library.path}"/>
- <jvmarg value="-Djava.library.path=${runtime.library.path}"/>
- <jvmarg value="-Xmx512m"/>
- <jvmarg line="${args}"/>
- </testng>
+ groups="@{groups}"
+ suitename="@{name}">
+ <classpath refid="test.classpath"/>
+ <classfileset dir="${build.dest}/test">
+ <include name="**/*.class"/>
+ </classfileset>
+ <env key="PATH" path="${runtime.library.path}${path.separator}${java.library.path}"/>
+ <env key="Path" path="${runtime.library.path}${path.separator}${java.library.path}"/>
+ <jvmarg value="-Djava.library.path=${runtime.library.path}"/>
+ <jvmarg value="-Xmx512m"/>
+ <jvmarg line="${args}"/>
+ </testng>
+ </sequential>
+ </macrodef>
+
+ <!-- =================================================================== -->
+ <!-- Unit tests -->
+ <!-- =================================================================== -->
+ <target name="test" depends="tests">
+ <runtest groups="init,core,private"/>
+ </target>
+
+ <target name="testsemaphore" depends="tests">
+ <parallel>
+ <sequential>
+ <runtest groups="init,semaphore.parent" name="Semaphore Parent"/>
+ </sequential>
+ <sequential>
+ <sleep seconds="1" />
+ <runtest groups="init,semaphore.child" name="Semaphore Child"/>
+ </sequential>
+ </parallel>
</target>
<!-- =================================================================== -->
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestArray.java Wed Apr 13 21:55:48 2011
@@ -25,7 +25,7 @@ import org.apache.commons.runtime.util.A
public class TestArray
{
- @Test(groups = { "utils" })
+ @Test(groups = { "core" })
public void arrayCopy()
throws Exception
{
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestMain.java Wed Apr 13 21:55:48 2011
@@ -19,6 +19,8 @@ package org.apache.commons.runtime;
import org.testng.annotations.*;
import org.testng.Assert;
+
+@Test(groups = { "init" })
public class TestMain
{
@BeforeSuite
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestNioByteBuffer.java Wed Apr 13 21:55:48 2011
@@ -22,7 +22,7 @@ import org.testng.annotations.*;
import org.testng.Assert;
import java.nio.ByteBuffer;
-@Test(groups = { "utils" })
+@Test(groups = { "core" })
public class TestNioByteBuffer
{
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestReflect.java Wed Apr 13 21:55:48 2011
@@ -20,10 +20,10 @@ import java.lang.reflect.*;
import org.testng.annotations.*;
import org.testng.Assert;
+@Test(groups = { "core" })
public class TestReflect
{
- @Test(groups = { "utils" })
public void findClass()
{
// Uses JNI class naming.
@@ -33,7 +33,6 @@ public class TestReflect
Assert.assertEquals("java.lang.System", c1.getCanonicalName());
}
- @Test(groups = { "utils" })
public void allocObject()
throws Exception
{
@@ -46,7 +45,6 @@ public class TestReflect
Assert.assertEquals("", o.toString());
}
- @Test(groups = { "utils" })
public void reflectedClass()
throws Exception
{
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestSemaphore.java Wed Apr 13 21:55:48 2011
@@ -24,11 +24,34 @@ import org.testng.Assert;
public class TestSemaphore
{
- @Test(groups = { "utils" })
+ private static final String semname = "acrSemop23";
+
+ @Test(groups = { "private" })
public void factory()
{
SemaphoreImpl si = Semaphore.getImpl();
Assert.assertNotNull(si);
}
+ @Test(groups = { "semaphore.parent" })
+ public void create()
+ throws Exception
+ {
+ Semaphore s = Semaphore.getImpl().create(semname, 0);
+ Assert.assertNotNull(s);
+ s.acquire();
+ s.release();
+ s.close();
+ }
+
+ @Test(groups = { "semaphore.child" })
+ public void open()
+ throws Exception
+ {
+ Semaphore s = Semaphore.getImpl().open(semname);
+ Assert.assertNotNull(s);
+ s.release();
+ s.close();
+ }
+
}
Modified: commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java?rev=1091931&r1=1091930&r2=1091931&view=diff
==============================================================================
--- commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java (original)
+++ commons/sandbox/runtime/trunk/src/main/test/org/apache/commons/runtime/TestUtils.java Wed Apr 13 21:55:48 2011
@@ -25,13 +25,13 @@ import org.apache.commons.runtime.util.U
public class TestUtils
{
- @Test(groups = { "utils" })
+ @Test(groups = { "core" })
public void getTempPath()
{
Assert.assertNotNull(Utils.getTempPath());
}
- @Test(groups = { "utils" })
+ @Test(groups = { "core" })
public void createTempDirectory()
throws IOException
{