aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse/plugins/com.android.ide.eclipse.gldebugger
diff options
context:
space:
mode:
authorSiva Velusamy <vsiva@google.com>2011-09-06 11:43:16 -0700
committerSiva Velusamy <vsiva@google.com>2011-09-06 15:02:38 -0700
commit4c0d03e5555f30129dcc9bd7c644b26978aebaf4 (patch)
tree53d18c9a97fb5c7f10cea29441a69de5ac6be866 /eclipse/plugins/com.android.ide.eclipse.gldebugger
parentd0ebbd169d7133858752dab63efd80b65e6237f0 (diff)
downloadsdk-4c0d03e5555f30129dcc9bd7c644b26978aebaf4.zip
sdk-4c0d03e5555f30129dcc9bd7c644b26978aebaf4.tar.gz
sdk-4c0d03e5555f30129dcc9bd7c644b26978aebaf4.tar.bz2
Move gldebugger tests to separate tests plugin.
Change-Id: I0f1d353c3d5cbd3c21c529472a42d9e8123f909d
Diffstat (limited to 'eclipse/plugins/com.android.ide.eclipse.gldebugger')
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.gldebugger/.classpath3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/build.properties3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageParserExTest.java119
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageQueueTest.java185
5 files changed, 8 insertions, 314 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/.classpath b/eclipse/plugins/com.android.ide.eclipse.gldebugger/.classpath
index 3a632ee..ab76b33 100755
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/.classpath
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/.classpath
@@ -1,9 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="test"/>
<classpathentry kind="lib" path="libs/host-libprotobuf-java-2.3.0-lite.jar"/>
<classpathentry kind="lib" path="libs/liblzf.jar"/>
<classpathentry kind="lib" path="libs/sdklib.jar"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
index 2476c8e..6e6f557 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/META-INF/MANIFEST.MF
@@ -1,15 +1,15 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
-Bundle-Name: GLESv2DebuggerClient
-Bundle-SymbolicName: GLESv2DebuggerClient; singleton:=true
-Bundle-Version: 1.0.0.qualifier
+Bundle-Name: GLESv2 Debugger Client
+Bundle-SymbolicName: com.android.ide.eclipse.gldebugger;singleton:=true
+Bundle-Version: 14.0.0.qualifier
Bundle-Activator: com.android.ide.eclipse.gldebugger.Activator
Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.junit
+ org.eclipse.core.runtime
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: libs/host-libprotobuf-java-2.3.0-lite.jar,
libs/liblzf.jar,
libs/sdklib.jar,
.
+Bundle-Vendor: The Android Open Source Project
+Export-Package: com.android.ide.eclipse.gldebugger;x-friends:="com.android.ide.eclipse.gldebugger.tests"
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/build.properties b/eclipse/plugins/com.android.ide.eclipse.gldebugger/build.properties
index 875dffe..ba8fe3a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/build.properties
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/build.properties
@@ -1,5 +1,4 @@
-source.. = src/,\
- test/
+source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageParserExTest.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageParserExTest.java
deleted file mode 100644
index 3ff3759..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageParserExTest.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- **
- ** http://www.apache.org/licenses/LICENSE-2.0
- **
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- */
-
-package com.android.ide.eclipse.gldebugger;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import com.android.ide.eclipse.gldebugger.GLEnum;
-import com.android.ide.eclipse.gldebugger.MessageFormatter;
-import com.android.ide.eclipse.gldebugger.MessageParserEx;
-import com.android.ide.eclipse.gldebugger.SampleView;
-import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message;
-import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Function;
-import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Type;
-import com.google.protobuf.ByteString;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.nio.ByteBuffer;
-
-public class MessageParserExTest {
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- }
-
- @Test
- public void testParseFloats() {
- final MessageParserEx parser = new MessageParserEx();
- final String args = "{0, 1 ,2,3 }";
- parser.args = args;
- final ByteBuffer data = parser.parseFloats(4).asReadOnlyByteBuffer();
- data.order(SampleView.targetByteOrder);
- for (int i = 0; i < 4; i++)
- assertEquals(i, data.getFloat(), 0);
- }
-
- @Test
- public void testParseArgument() {
- final MessageParserEx parser = new MessageParserEx();
- final String args = "sdfa = GL_VERTEX_SHADER , -5421 ,0x443=0x54f";
- parser.args = args;
- assertEquals(GLEnum.GL_VERTEX_SHADER.value, parser.parseArgument());
- assertEquals(-5421, parser.parseArgument());
- assertEquals(0x54f, parser.parseArgument());
- }
-
- /**
- * Test method for
- * {@link com.android.ide.eclipse.gldebugger.MessageParserEx#parse_glShaderSource(com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Builder)}
- * .
- */
- @Test
- public void testParse_glShaderSource() {
- final Message.Builder builder = Message.newBuilder();
- final MessageParserEx messageParserEx = new MessageParserEx();
- final String source = "dks \n jafhskjaho { urehg ; } hskjg";
- messageParserEx.parse(builder, "void glShaderSource ( shader=4, count= 1, "
- + "string =\"" + source + "\" , 0x0)");
- assertEquals(Function.glShaderSource, builder.getFunction());
- assertEquals(4, builder.getArg0());
- assertEquals(1, builder.getArg1());
- assertEquals(source, builder.getData().toStringUtf8());
- assertEquals(0, builder.getArg3());
- }
-
- @Test
- public void testParse_glBlendEquation() {
- assertNotNull(MessageParserEx.instance);
- final Message.Builder builder = Message.newBuilder();
- MessageParserEx.instance.parse(builder, "void glBlendEquation ( mode= GL_ADD ) ; ");
- assertEquals(Function.glBlendEquation, builder.getFunction());
- assertEquals(GLEnum.GL_ADD.value, builder.getArg0());
- }
-
- /** loopback testing of typical generated MessageFormatter and MessageParser */
- @Test
- public void testParseFormatterMessage() {
- final ByteBuffer srcData = ByteBuffer.allocate(4 * 2 * 4);
- srcData.order(SampleView.targetByteOrder);
- for (int i = 0; i < 4 * 2; i++)
- srcData.putFloat(i);
- srcData.rewind();
- Message.Builder builder = Message.newBuilder();
- builder.setContextId(3752).setExpectResponse(false).setType(Type.CompleteCall);
- builder.setFunction(Function.glUniformMatrix2fv);
- builder.setArg0(54).setArg1(2).setArg2(0).setData(ByteString.copyFrom(srcData));
- Message msg = builder.build();
- builder = msg.toBuilder();
- String formatted = MessageFormatter.format(msg, false);
- formatted = formatted.substring(0, formatted.indexOf('(')) + ' ' + builder.getFunction() +
- formatted.substring(formatted.indexOf('('));
- Message.Builder parsed = Message.newBuilder();
- MessageParserEx.instance.parse(parsed, formatted);
- assertEquals(builder.getFunction(), parsed.getFunction());
- assertEquals(builder.getArg0(), parsed.getArg0());
- assertEquals(builder.getArg1(), parsed.getArg1());
- assertEquals(builder.getArg2(), parsed.getArg2());
- assertEquals(builder.getData().toStringUtf8(), parsed.getData().toStringUtf8());
- }
-
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageQueueTest.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageQueueTest.java
deleted file mode 100644
index 360ebfc..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/test/com/android/ide/eclipse/gldebugger/MessageQueueTest.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- ** Copyright 2011, The Android Open Source Project
- **
- ** Licensed under the Apache License, Version 2.0 (the "License");
- ** you may not use this file except in compliance with the License.
- ** You may obtain a copy of the License at
- **
- ** http://www.apache.org/licenses/LICENSE-2.0
- **
- ** Unless required by applicable law or agreed to in writing, software
- ** distributed under the License is distributed on an "AS IS" BASIS,
- ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ** See the License for the specific language governing permissions and
- ** limitations under the License.
- */
-
-package com.android.ide.eclipse.gldebugger;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-import com.android.ide.eclipse.gldebugger.MessageQueue;
-import com.android.ide.eclipse.gldebugger.ProcessMessage;
-import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message;
-import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Function;
-import com.android.ide.eclipse.gldebugger.DebuggerMessage.Message.Type;
-
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.nio.ByteOrder;
-
-public class MessageQueueTest {
- private MessageQueue queue;
-
- /**
- * @throws java.lang.Exception
- */
- @Before
- public void setUp() throws Exception {
- queue = new MessageQueue(null, new ProcessMessage[0]);
- }
-
- /**
- * Test method for
- * {@link com.android.ide.eclipse.gldebugger.MessageQueue#defaultProcessMessage(com.android.ide.eclipse.gldebugger.DebuggerMessage.Message, boolean, boolean)}
- * .
- *
- * @throws IOException
- */
- @Test
- public void testDefaultProcessMessage() throws IOException {
- final int contextId = 8784;
- assertNull(queue.getPartialMessage(contextId));
- Message.Builder builder = Message.newBuilder();
- builder.setContextId(contextId);
- builder.setExpectResponse(false);
- builder.setFunction(Function.glFinish);
- builder.setType(Type.BeforeCall);
- Message msg = builder.build();
- queue.defaultProcessMessage(msg, false, false);
- assertNotNull(queue.getPartialMessage(contextId));
-
- builder = msg.toBuilder();
- builder.setType(Type.AfterCall);
- builder.setTime(5);
- msg = builder.build();
- queue.defaultProcessMessage(msg, false, false);
- assertNull(queue.getPartialMessage(contextId));
- Message complete = queue.removeCompleteMessage(contextId);
- assertNotNull(complete);
- assertEquals(contextId, complete.getContextId());
- assertEquals(msg.getFunction(), complete.getFunction());
- assertEquals(msg.getTime(), complete.getTime(), 0);
- assertEquals(Type.CompleteCall, complete.getType());
-
- // an already complete message should just be added to complete queue
- queue.defaultProcessMessage(complete, false, false);
- assertNull(queue.getPartialMessage(contextId));
- complete = queue.removeCompleteMessage(contextId);
- assertNotNull(complete);
- assertEquals(contextId, complete.getContextId());
- assertEquals(msg.getFunction(), complete.getFunction());
- assertEquals(msg.getTime(), complete.getTime(), 0);
- assertEquals(Type.CompleteCall, complete.getType());
- }
-
- @Test
- public void testCompletePartialMessage() throws IOException {
- final int contextId = 8784;
- assertNull(queue.getPartialMessage(contextId));
- Message.Builder builder = Message.newBuilder();
- builder.setContextId(contextId);
- builder.setExpectResponse(false);
- builder.setFunction(Function.glFinish);
- builder.setType(Type.BeforeCall);
- Message msg = builder.build();
- queue.defaultProcessMessage(msg, false, false);
- assertNotNull(queue.getPartialMessage(contextId));
- queue.completePartialMessage(contextId);
-
- final Message complete = queue.removeCompleteMessage(contextId);
- assertNotNull(complete);
- assertEquals(contextId, complete.getContextId());
- assertEquals(msg.getFunction(), complete.getFunction());
- assertEquals(msg.getTime(), complete.getTime(), 0);
- assertEquals(Type.BeforeCall, complete.getType());
- }
-
- /** Write two messages from two contexts to file and test handling them */
- @Test
- public void testRunWithFile() throws FileNotFoundException, IOException, InterruptedException {
- final File filePath = File.createTempFile("test", ".gles2dbg");
- DataOutputStream file = new DataOutputStream(new FileOutputStream(filePath));
- Message.Builder builder = Message.newBuilder();
- final int contextId0 = 521643, contextId1 = 87634;
- assertNull(queue.removeCompleteMessage(contextId0));
- assertNull(queue.removeCompleteMessage(contextId1));
-
- builder.setContextId(contextId0).setExpectResponse(false).setType(Type.BeforeCall);
- builder.setFunction(Function.glClear).setArg0(contextId0);
- Message msg0 = builder.build();
- byte[] data = msg0.toByteArray();
- file.writeInt(data.length);
- file.write(data);
-
- builder = Message.newBuilder();
- builder.setContextId(contextId1).setExpectResponse(false).setType(Type.BeforeCall);
- builder.setFunction(Function.glDisable).setArg0(contextId1);
- Message msg1 = builder.build();
- data = msg1.toByteArray();
- file.writeInt(data.length);
- file.write(data);
-
- builder = Message.newBuilder();
- msg0 = builder.setContextId(msg0.getContextId()).setExpectResponse(false)
- .setType(Type.AfterCall).setFunction(msg0.getFunction()).setTime(2).build();
- data = msg0.toByteArray();
- file.writeInt(data.length);
- file.write(data);
-
- builder = Message.newBuilder();
- msg1 = builder.setContextId(msg1.getContextId()).setExpectResponse(false)
- .setType(Type.AfterCall).setFunction(msg1.getFunction()).setTime(465).build();
- data = msg1.toByteArray();
- file.writeInt(data.length);
- file.write(data);
-
- file.close();
-
- FileInputStream fis = new FileInputStream(filePath);
- // Java VM uses big endian, so the file was written in big endian
- queue.start(ByteOrder.BIG_ENDIAN, fis);
- queue.thread.join();
-
- Message complete0 = queue.removeCompleteMessage(msg0.getContextId());
- assertNotNull(complete0);
- assertNull(queue.removeCompleteMessage(contextId0));
- assertEquals(contextId0, complete0.getContextId());
- assertEquals(false, complete0.getExpectResponse());
- assertEquals(Type.CompleteCall, complete0.getType());
- assertEquals(msg0.getFunction(), complete0.getFunction());
- assertEquals(contextId0, complete0.getArg0());
- assertEquals(msg0.getTime(), complete0.getTime(), 0);
-
- Message complete1 = queue.removeCompleteMessage(msg1.getContextId());
- assertNotNull(complete1);
- assertNull(queue.removeCompleteMessage(contextId1));
- assertEquals(contextId1, complete1.getContextId());
- assertEquals(false, complete1.getExpectResponse());
- assertEquals(Type.CompleteCall, complete1.getType());
- assertEquals(msg1.getFunction(), complete1.getFunction());
- assertEquals(contextId1, complete1.getArg0());
- assertEquals(msg1.getTime(), complete1.getTime(), 0);
-
- filePath.delete();
- }
-}