summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-04-25 17:52:03 (EDT)
committer Matthew Khouzam2013-04-29 17:51:34 (EDT)
commite94a7679dd349254b7f78aaaffe7fd08528a6f8d (patch)
treee54bbada5a8d4074917facbde60725844ca8cb05
parentea6f8a00af336f671bd84d1bb44ee143797db810 (diff)
downloadorg.eclipse.linuxtools-e94a7679dd349254b7f78aaaffe7fd08528a6f8d.zip
org.eclipse.linuxtools-e94a7679dd349254b7f78aaaffe7fd08528a6f8d.tar.gz
org.eclipse.linuxtools-e94a7679dd349254b7f78aaaffe7fd08528a6f8d.tar.bz2
Integrate Babeltrace CTF tests and fix parsing problemsrefs/changes/60/12160/8
Change-Id: I1bde488b99a6e29cfc5bcf4191e00b317d8c737f Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com> Reviewed-on: https://git.eclipse.org/r/12160 Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com> IP-Clean: Matthew Khouzam <matthew.khouzam@ericsson.com> Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/META-INF/MANIFEST.MF1
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/pom.xml37
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/CtfCorePluginTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/event/CTFEventFieldTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java72
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDeclarationTest.java4
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDefinitionTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDeclarationTest.java95
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDefinitionTest.java4
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/VariantDefinitionTest.java2
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore1
-rwxr-xr-xlttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh4
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml16
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java41
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFReaderException.java13
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java13
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java7
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java8
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/Activator.java19
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java56
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/Messages.java32
-rw-r--r--lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/messages.properties15
22 files changed, 393 insertions, 53 deletions
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/META-INF/MANIFEST.MF b/lttng/org.eclipse.linuxtools.ctf.core.tests/META-INF/MANIFEST.MF
index 13a0b86..a3e6547 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/META-INF/MANIFEST.MF
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/META-INF/MANIFEST.MF
@@ -12,3 +12,4 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
org.eclipse.core.runtime;bundle-version="3.8.0",
org.eclipse.linuxtools.ctf.core;bundle-version="2.0.0"
Export-Package: org.eclipse.linuxtools.ctf.core.tests.shared
+Import-Package: org.antlr.runtime;version="3.2.0"
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/pom.xml b/lttng/org.eclipse.linuxtools.ctf.core.tests/pom.xml
index b810e1f..b7c2e94 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/pom.xml
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/pom.xml
@@ -67,6 +67,43 @@
<product>org.eclipse.sdk.ide</product>
</configuration>
</plugin>
+ <!-- We don't use the ant file to clean because of http://jira.codehaus.org/browse/MANTRUN-78 -->
+ <plugin>
+ <artifactId>maven-clean-plugin</artifactId>
+ <version>2.5</version>
+ <executions>
+ <execution>
+ <id>clean-traces</id>
+ <phase>clean</phase>
+ <configuration>
+ <filesets>
+ <fileset>
+ <directory>traces</directory>
+ <includes>
+ <include>*.tar*</include>
+ </includes>
+ <excludes>
+ <exclude>*.xml</exclude>
+ <exclude>*.sh</exclude>
+ </excludes>
+ </fileset>
+ <fileset>
+ <directory>traces/kernel</directory>
+ </fileset>
+ <fileset>
+ <directory>traces/trace2</directory>
+ </fileset>
+ <fileset>
+ <directory>traces/ctf-testsuite</directory>
+ </fileset>
+ </filesets>
+ </configuration>
+ <goals>
+ <goal>clean</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/CtfCorePluginTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/CtfCorePluginTest.java
index 2988773..ba6841d 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/CtfCorePluginTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/CtfCorePluginTest.java
@@ -53,7 +53,7 @@ public class CtfCorePluginTest {
@Test
public void testLog() {
try {
- Activator.getDefault().log("Some message");
+ Activator.log("Some message");
} catch (Exception e) {
fail();
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/event/CTFEventFieldTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/event/CTFEventFieldTest.java
index c084338..aebbc4d 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/event/CTFEventFieldTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/event/CTFEventFieldTest.java
@@ -91,7 +91,7 @@ public class CTFEventFieldTest {
@Test
public void testParseField_simple2() {
IntegerDefinition fieldDef = new IntegerDefinition(
- new IntegerDeclaration(1, true, 1, ByteOrder.BIG_ENDIAN,
+ new IntegerDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
Encoding.ASCII, null, 8), null, fieldName);
fieldDef.setValue(1L);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java
index 3eb133d..fcf44a4 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/trace/CTFTraceTest.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Matthew Khouzam - Initial API and implementation
+ * Marc-Andre Laperle - Test in traces directory recursively
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.tests.trace;
@@ -43,8 +44,15 @@ import org.junit.Test;
*/
public class CTFTraceTest {
+ private static final String TRACES_DIRECTORY = "../org.eclipse.linuxtools.ctf.core.tests/traces";
+
+ private static final String METADATA_FILENAME = "metadata";
+
private static final int TRACE_INDEX = 0;
+ private static final String CTF_VERSION_NUMBER = "1.8";
+ private static final String CTF_SUITE_TEST_DIRECTORY = "ctf-testsuite/tests/" + CTF_VERSION_NUMBER;
+
private CTFTrace fixture;
/**
@@ -379,4 +387,68 @@ public class CTFTraceTest {
assertNotNull(result);
}
+ /**
+ * Open traces in specified directories and expect them to fail
+ *
+ * @throws CTFReaderException not expected
+ */
+ @Test
+ public void testFailedParse() throws CTFReaderException {
+ parseTracesInDirectory(getTestTracesSubDirectory(CTF_SUITE_TEST_DIRECTORY + "/fail"), true);
+ }
+
+ /**
+ * Open traces in specified directories and expect them to succeed
+ *
+ * @throws CTFReaderException not expected
+ */
+ @Test
+ public void testSuccessfulParse() throws CTFReaderException {
+ parseTracesInDirectory(getTestTracesSubDirectory("kernel"), false);
+ parseTracesInDirectory(getTestTracesSubDirectory("trace2"), false);
+ parseTracesInDirectory(getTestTracesSubDirectory(CTF_SUITE_TEST_DIRECTORY + "/pass"), false);
+ }
+
+ /**
+ * Get the File object for the subDir in the traces directory. If the sub directory doesn't exist, the test is skipped.
+ */
+ private static File getTestTracesSubDirectory(String subDir) {
+ File file = new File(TRACES_DIRECTORY + "/" + subDir);
+ assumeTrue(file.isDirectory());
+ return file;
+ }
+
+ /**
+ * Parse the traces in given directory recursively
+ *
+ * @param directory The directory to search in
+ * @param expectException Whether or not traces in this directory are expected to throw an exception when parsed
+ * @throws CTFReaderException
+ */
+ void parseTracesInDirectory(File directory, boolean expectException) throws CTFReaderException {
+ for (File file : directory.listFiles()) {
+ if (file.getName().equals(METADATA_FILENAME)) {
+ try {
+ new CTFTrace(directory);
+ if (expectException) {
+ fail("Trace was expected to fail parsing: " + directory);
+ }
+ } catch (RuntimeException e) {
+ if (!expectException) {
+ throw new CTFReaderException("Failed parsing " + directory, e);
+ }
+ } catch (CTFReaderException e) {
+ if (!expectException) {
+ throw new CTFReaderException("Failed parsing " + directory, e);
+ }
+ }
+ return;
+ }
+
+ if (file.isDirectory()) {
+ parseTracesInDirectory(file, expectException);
+ }
+ }
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDeclarationTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDeclarationTest.java
index e43eda8..9c8528c 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDeclarationTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDeclarationTest.java
@@ -42,7 +42,7 @@ public class EnumDeclarationTest {
*/
@Before
public void setUp() {
- fixture = new EnumDeclaration(new IntegerDeclaration(1, true, 1,
+ fixture = new EnumDeclaration(new IntegerDeclaration(1, false, 1,
ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8));
}
@@ -51,7 +51,7 @@ public class EnumDeclarationTest {
*/
@Test
public void testEnumDeclaration() {
- IntegerDeclaration containerType = new IntegerDeclaration(1, true, 1,
+ IntegerDeclaration containerType = new IntegerDeclaration(1, false, 1,
ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
EnumDeclaration result = new EnumDeclaration(containerType);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDefinitionTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDefinitionTest.java
index 7dbbc7c..20511a5 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDefinitionTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/EnumDefinitionTest.java
@@ -43,7 +43,7 @@ public class EnumDefinitionTest {
@Before
public void setUp() {
EnumDeclaration declaration = new EnumDeclaration(
- new IntegerDeclaration(1, true, 1, ByteOrder.BIG_ENDIAN,
+ new IntegerDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
Encoding.ASCII, null, 8));
declaration.add(0, 10, "a");
declaration.add(11, 20, "b");
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDeclarationTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDeclarationTest.java
index 9c2a471..06e5836 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDeclarationTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDeclarationTest.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Matthew Khouzam - Initial API and implementation
+ * Marc-Andre Laperle - Add min/maximum for validation
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.tests.types;
@@ -14,6 +15,7 @@ package org.eclipse.linuxtools.ctf.core.tests.types;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
+import java.math.BigInteger;
import java.nio.ByteOrder;
import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
@@ -37,7 +39,7 @@ public class IntegerDeclarationTest {
*/
@Before
public void setUp() {
- fixture = new IntegerDeclaration(1, true, 1, ByteOrder.BIG_ENDIAN,
+ fixture = new IntegerDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
Encoding.ASCII, null, 32);
}
@@ -48,7 +50,7 @@ public class IntegerDeclarationTest {
@Test
public void testIntegerDeclaration() {
int len = 1;
- boolean signed = true;
+ boolean signed = false;
int base = 1;
ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
Encoding encoding = Encoding.ASCII;
@@ -63,7 +65,33 @@ public class IntegerDeclarationTest {
assertEquals(outputValue,
result.toString().substring(0, outputValue.length()));
assertEquals(1, result.getLength());
- assertEquals(true, result.isSigned());
+ assertEquals(false, result.isSigned());
+ }
+
+ /**
+ * Test that IntegerDeclaration throws when constructing a signed 1 bit declaration
+ */
+ @Test(expected = java.lang.IllegalArgumentException.class)
+ public void testIntegerDeclarationIllegalArgSignedBit() {
+ int len = 1;
+ boolean signed = true;
+ int base = 1;
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+ Encoding encoding = Encoding.ASCII;
+ new IntegerDeclaration(len, signed, base, byteOrder, encoding, null, 16);
+ }
+
+ /**
+ * Test that IntegerDeclaration throws when constructing a invalid length declaration
+ */
+ @Test(expected = java.lang.IllegalArgumentException.class)
+ public void testIntegerDeclarationIllegalArgBadLenght() {
+ int len = 0;
+ boolean signed = false;
+ int base = 1;
+ ByteOrder byteOrder = ByteOrder.BIG_ENDIAN;
+ Encoding encoding = Encoding.ASCII;
+ new IntegerDeclaration(len, signed, base, byteOrder, encoding, null, 16);
}
/**
@@ -132,7 +160,9 @@ public class IntegerDeclarationTest {
*/
@Test
public void testIsSigned_signed() {
- boolean result = fixture.isSigned();
+ IntegerDeclaration fixtureSigned = new IntegerDeclaration(2, true,
+ 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
+ boolean result = fixtureSigned.isSigned();
assertEquals(true, result);
}
@@ -141,10 +171,7 @@ public class IntegerDeclarationTest {
*/
@Test
public void testIsSigned_unsigned() {
- IntegerDeclaration fixture_unsigned = new IntegerDeclaration(1, false,
- 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
-
- boolean result = fixture_unsigned.isSigned();
+ boolean result = fixture.isSigned();
assertEquals(false, result);
}
@@ -158,4 +185,56 @@ public class IntegerDeclarationTest {
String trunc = result.substring(0, 22);
assertEquals("[declaration] integer[", trunc);
}
+
+ /**
+ * Run the long getMaxValue() method test.
+ */
+ @Test
+ public void testMaxValue() {
+ assertEquals(BigInteger.ONE, fixture.getMaxValue());
+
+ IntegerDeclaration signed8bit = new IntegerDeclaration(8, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(127), signed8bit.getMaxValue());
+
+ IntegerDeclaration unsigned8bit = new IntegerDeclaration(8, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(255), unsigned8bit.getMaxValue());
+
+ IntegerDeclaration signed32bit = new IntegerDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(2147483647), signed32bit.getMaxValue());
+
+ IntegerDeclaration unsigned32bit = new IntegerDeclaration(32, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(4294967295l), unsigned32bit.getMaxValue());
+
+ IntegerDeclaration signed64bit = new IntegerDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(9223372036854775807L), signed64bit.getMaxValue());
+
+ IntegerDeclaration unsigned64bit = new IntegerDeclaration(64, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(2).pow(64).subtract(BigInteger.ONE), unsigned64bit.getMaxValue());
+ }
+
+ /**
+ * Run the long getMinValue() method test.
+ */
+ @Test
+ public void testMinValue() {
+ assertEquals(BigInteger.ZERO, fixture.getMinValue());
+
+ IntegerDeclaration signed8bit = new IntegerDeclaration(8, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(-128), signed8bit.getMinValue());
+
+ IntegerDeclaration unsigned8bit = new IntegerDeclaration(8, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.ZERO, unsigned8bit.getMinValue());
+
+ IntegerDeclaration signed32bit = new IntegerDeclaration(32, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(-2147483648), signed32bit.getMinValue());
+
+ IntegerDeclaration unsigned32bit = new IntegerDeclaration(32, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.ZERO, unsigned32bit.getMinValue());
+
+ IntegerDeclaration signed64bit = new IntegerDeclaration(64, true, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.valueOf(-9223372036854775808L), signed64bit.getMinValue());
+
+ IntegerDeclaration unsigned64bit = new IntegerDeclaration(64, false, 1, ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 32);
+ assertEquals(BigInteger.ZERO, unsigned64bit.getMinValue());
+ }
} \ No newline at end of file
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDefinitionTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDefinitionTest.java
index 07f02d1..1ce81fd 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDefinitionTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/IntegerDefinitionTest.java
@@ -42,7 +42,7 @@ public class IntegerDefinitionTest {
*/
@Before
public void setUp() {
- IntegerDeclaration id = new IntegerDeclaration( 1, true, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
+ IntegerDeclaration id = new IntegerDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN, Encoding.NONE, clockName, 8);
fixture = id.createDefinition(null, name);
}
@@ -52,7 +52,7 @@ public class IntegerDefinitionTest {
*/
@Test
public void testIntegerDefinition() {
- IntegerDeclaration declaration = new IntegerDeclaration(1, true, 1,
+ IntegerDeclaration declaration = new IntegerDeclaration(1, false, 1,
ByteOrder.BIG_ENDIAN, Encoding.ASCII, null, 8);
IDefinitionScope definitionScope = null;
String fieldName = "";
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/VariantDefinitionTest.java b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/VariantDefinitionTest.java
index 3e289d7..1393403 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/VariantDefinitionTest.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/src/org/eclipse/linuxtools/ctf/core/tests/types/VariantDefinitionTest.java
@@ -308,7 +308,7 @@ public class VariantDefinitionTest {
vDef = new VariantDefinition(vDecl, structDefinition, fName);
structDef = new StructDefinition(new StructDeclaration(1L), vDef, fName);
tagDefinition = new EnumDefinition(new EnumDeclaration(
- new IntegerDeclaration(1, true, 1, ByteOrder.BIG_ENDIAN,
+ new IntegerDeclaration(1, false, 1, ByteOrder.BIG_ENDIAN,
Encoding.ASCII, fName, 8)), structDef, fName);
fixture.setTagDefinition(tagDefinition);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore b/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore
index d26f46e..80b28af 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/.gitignore
@@ -1,5 +1,6 @@
*.bz2
*.tar
+/ctf-testsuite
/kernel
/trace2
*.ht
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh b/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh
index 2ee8f08..45efb97 100755
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.sh
@@ -17,4 +17,6 @@
wget http://lttng.org/files/samples/sample-ctf-trace-20120412.tar.bz2 -O- | tar xvjf - &&
# Trace used by the lttng2 kernel state provider tests
-wget http://www.dorsal.polymtl.ca/~alexmont/data/trace2.tar.bz2 -O- | tar xvjf -
+wget http://www.dorsal.polymtl.ca/~alexmont/data/trace2.tar.bz2 -O- | tar xvjf - &&
+
+git clone https://github.com/efficios/ctf-testsuite.git
diff --git a/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml b/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml
index 67b01b9..e208b37 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml
+++ b/lttng/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml
@@ -13,6 +13,16 @@
<echo message="Attempting to download test traces"/>
<get ignoreerrors="true" dest="sample-ctf-trace-20120412.tar.bz2" skipexisting="true" src="http://lttng.org/files/samples/sample-ctf-trace-20120412.tar.bz2"/>
<get ignoreerrors="true" dest="trace2.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/trace2.tar.bz2"/>
+ <exec executable = "git" failifexecutionfails="false">
+ <arg value = "clone"/>
+ <arg value = "https://github.com/efficios/ctf-testsuite.git"/>
+ </exec>
+ <condition property="testSuiteExists">
+ <and>
+ <available file="ctf-testsuite" type="dir"/>
+ </and>
+ </condition>
+ <antcall target="pullTestSuite"/>
<condition property="tracesExist">
<and>
<available file="sample-ctf-trace-20120412.tar.bz2"/>
@@ -22,6 +32,12 @@
<antcall target="extractTraces"/>
</target>
+<target name="pullTestSuite" if="testSuiteExists">
+ <exec executable = "git" failifexecutionfails="false" dir="ctf-testsuite">
+ <arg value = "pull"/>
+ </exec>
+</target>
+
<target name="extractTraces" if="tracesExist">
<bunzip2 src="sample-ctf-trace-20120412.tar.bz2"/>
<bunzip2 src="trace2.tar.bz2"/>
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java
index 26a8976..5481e7f 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/event/types/IntegerDeclaration.java
@@ -1,22 +1,25 @@
/*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
+ * Marc-Andre Laperle - Add min/maximum for validation
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.event.types;
+import java.math.BigInteger;
import java.nio.ByteOrder;
/**
* A CTF integer declaration.
- *
+ *
* The declaration of a integer basic data type.
*
* @version 1.0
@@ -53,6 +56,9 @@ public class IntegerDeclaration implements IDeclaration {
*/
public IntegerDeclaration(int len, boolean signed, int base,
ByteOrder byteOrder, Encoding encoding, String clock, long alignment) {
+ if (len <= 0 || len == 1 && signed) {
+ throw new IllegalArgumentException();
+ }
this.length = len;
this.signed = signed;
this.base = base;
@@ -142,4 +148,31 @@ public class IntegerDeclaration implements IDeclaration {
return "[declaration] integer[" + Integer.toHexString(hashCode()) + ']'; //$NON-NLS-1$
}
+ /**
+ * Get the maximum value for this integer declaration
+ *
+ * @return The maximum value for this integer declaration
+ * @since 2.0
+ */
+ public BigInteger getMaxValue() {
+ BigInteger capacity = BigInteger.ONE.shiftLeft(length);
+ BigInteger max = signed ? capacity.divide(BigInteger.valueOf(2)) : capacity;
+ return max.subtract(BigInteger.ONE);
+ }
+
+ /**
+ * Get the minimum value for this integer declaration
+ *
+ * @return The minimum value for this integer declaration
+ * @since 2.0
+ */
+ public BigInteger getMinValue() {
+ if (!signed) {
+ return BigInteger.ZERO;
+ }
+
+ BigInteger capacity = BigInteger.ONE.shiftLeft(length);
+ return capacity.divide(BigInteger.valueOf(2)).negate();
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFReaderException.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFReaderException.java
index 430c5b9..c124a87 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFReaderException.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFReaderException.java
@@ -50,4 +50,17 @@ public class CTFReaderException extends Exception {
super(e);
}
+ /**
+ * Constructor with an attached message and re-throw an exception into this type.
+ *
+ * @param message
+ * The message attached to this exception
+ * @param exception
+ * The previous Exception caught
+ * @since 2.0
+ */
+ public CTFReaderException(String message, Throwable exception) {
+ super(message, exception);
+ }
+
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
index 3573733..9150617 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTrace.java
@@ -1,13 +1,14 @@
/*******************************************************************************
- * Copyright (c) 2011-2013 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Alexandre Montplaisir - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.trace;
@@ -529,7 +530,7 @@ public class CTFTrace implements IDefinitionScope {
fc = fis.getChannel();
/* Map one memory page of 4 kiB */
- byteBuffer = fc.map(MapMode.READ_ONLY, 0, 4096);
+ byteBuffer = fc.map(MapMode.READ_ONLY, 0, Math.min((int)fc.size(), 4096));
} catch (IOException e) {
/* Shouldn't happen at this stage if every other check passed */
throw new CTFReaderException();
@@ -585,6 +586,10 @@ public class CTFTrace implements IDefinitionScope {
stream = streams.get(null);
}
+ if (stream == null) {
+ throw new CTFReaderException("Unexpected end of stream"); //$NON-NLS-1$
+ }
+
/* Create the stream input */
StreamInput streamInput = new StreamInput(stream, fc, streamFile);
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
index d18145a..615efdb 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/CTFTraceReader.java
@@ -6,8 +6,9 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Alexandre Montplaisir - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Alexandre Montplaisir - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.trace;
@@ -399,7 +400,7 @@ public class CTFTraceReader {
}
sb.append("]\t" + this.eventCountPerTraceFile[se.getName()] + " Events"); //$NON-NLS-1$//$NON-NLS-2$
- Activator.getDefault().log(sb.toString());
+ Activator.log(sb.toString());
}
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
index 5784780..2e75e6a 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/ctf/core/trace/Metadata.java
@@ -6,8 +6,9 @@
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.ctf.core.trace;
@@ -344,6 +345,9 @@ public class Metadata {
/* Extract the text from the packet */
int payloadSize = ((header.contentSize / 8) - METADATA_PACKET_HEADER_SIZE);
+ if (payloadSize < 0) {
+ throw new CTFReaderException("Invalid metadata packet payload size."); //$NON-NLS-1$
+ }
int skipSize = (header.packetSize - header.contentSize) / 8;
/* Read the payload + the padding in a ByteBuffer */
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/Activator.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/Activator.java
index 707529d..56c9acb 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/Activator.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/Activator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
@@ -94,7 +94,7 @@ public class Activator extends Plugin {
* Log a message
* @param msg the message to log
*/
- public void log(String msg) {
+ public static void log(String msg) {
log(msg, null);
}
@@ -103,8 +103,19 @@ public class Activator extends Plugin {
* @param msg the message
* @param e the exception
*/
- public void log(String msg, Exception e) {
- getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e));
+ public static void log(String msg, Exception e) {
+ getDefault().getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e));
}
+ /**
+ * Log a message
+ * @param severity desired severity of the message in the log,
+ * one of {@link IStatus#INFO}, {@link IStatus#WARNING} or {@link IStatus#ERROR}
+ * @param msg the message to log
+ */
+ public static void log(int severity, String msg) {
+ getDefault().getLog().log(new Status(severity, PLUGIN_ID, msg));
+ }
+
+
}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
index c6a1fb5..10e9282 100644
--- a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/IOStructGen.java
@@ -1,14 +1,15 @@
/*******************************************************************************
- * Copyright (c) 2011-2013 Ericsson, Ecole Polytechnique de Montreal and others
+ * Copyright (c) 2011, 2013 Ericsson, Ecole Polytechnique de Montreal and others
*
* All rights reserved. This program and the accompanying materials are made
* available under the terms of the Eclipse Public License v1.0 which
* accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
- * Contributors: Matthew Khouzam - Initial Design and Grammar
- * Contributors: Francis Giraldeau - Initial API and implementation
- * Contributors: Simon Marchi - Initial API and implementation
+ * Contributors:
+ * Matthew Khouzam - Initial Design and Grammar
+ * Francis Giraldeau - Initial API and implementation
+ * Simon Marchi - Initial API and implementation
*******************************************************************************/
package org.eclipse.linuxtools.internal.ctf.core.event.metadata;
@@ -16,6 +17,7 @@ package org.eclipse.linuxtools.internal.ctf.core.event.metadata;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
+import java.math.BigInteger;
import java.nio.ByteOrder;
import java.util.ArrayList;
import java.util.Collections;
@@ -24,6 +26,7 @@ import java.util.List;
import java.util.UUID;
import org.antlr.runtime.tree.CommonTree;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.linuxtools.ctf.core.event.CTFClock;
import org.eclipse.linuxtools.ctf.core.event.types.ArrayDeclaration;
import org.eclipse.linuxtools.ctf.core.event.types.Encoding;
@@ -39,6 +42,7 @@ import org.eclipse.linuxtools.ctf.core.trace.CTFReaderException;
import org.eclipse.linuxtools.ctf.core.trace.CTFTrace;
import org.eclipse.linuxtools.ctf.core.trace.Stream;
import org.eclipse.linuxtools.ctf.parser.CTFParser;
+import org.eclipse.linuxtools.internal.ctf.core.Activator;
import org.eclipse.linuxtools.internal.ctf.core.event.EventDeclaration;
import org.eclipse.linuxtools.internal.ctf.core.event.metadata.exceptions.ParseException;
@@ -369,7 +373,7 @@ public class IOStructGen {
List<CommonTree> leftStrings = leftNode.getChildren();
- if (!isUnaryString(leftStrings.get(0))) {
+ if (!isAnyUnaryString(leftStrings.get(0))) {
throw new ParseException(
"Left side of CTF assignment must be a string"); //$NON-NLS-1$
}
@@ -453,7 +457,7 @@ public class IOStructGen {
trace.setPacketHeader((StructDeclaration) packetHeaderDecl);
} else {
- throw new ParseException("Unknown trace attribute : " + left); //$NON-NLS-1$
+ Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownTraceAttributeWarning + " " + left); //$NON-NLS-1$
}
}
@@ -569,7 +573,7 @@ public class IOStructGen {
List<CommonTree> leftStrings = leftNode.getChildren();
- if (!isUnaryString(leftStrings.get(0))) {
+ if (!isAnyUnaryString(leftStrings.get(0))) {
throw new ParseException(
"Left side of CTF assignment must be a string"); //$NON-NLS-1$
}
@@ -645,7 +649,7 @@ public class IOStructGen {
stream.setPacketContext((StructDeclaration) packetContextDecl);
} else {
- throw new ParseException("Unknown stream attribute : " + left); //$NON-NLS-1$
+ Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownStreamAttributeWarning + " " + left); //$NON-NLS-1$
}
}
@@ -726,7 +730,7 @@ public class IOStructGen {
List<CommonTree> leftStrings = leftNode.getChildren();
- if (!isUnaryString(leftStrings.get(0))) {
+ if (!isAnyUnaryString(leftStrings.get(0))) {
throw new ParseException(
"Left side of CTF assignment must be a string"); //$NON-NLS-1$
}
@@ -1142,7 +1146,7 @@ public class IOStructGen {
/* Create the array declaration. */
declaration = new ArrayDeclaration(arrayLength, declaration);
- } else if (isUnaryString(first)) {
+ } else if (isAnyUnaryString(first)) {
/* Sequence */
String lengthName = concatenateUnaryStrings(lengthChildren);
@@ -1258,7 +1262,7 @@ public class IOStructGen {
List<CommonTree> leftStrings = leftNode.getChildren();
- if (!isUnaryString(leftStrings.get(0))) {
+ if (!isAnyUnaryString(leftStrings.get(0))) {
throw new ParseException(
"Left side of ctf expression must be a string"); //$NON-NLS-1$
}
@@ -1376,7 +1380,7 @@ public class IOStructGen {
List<CommonTree> leftStrings = leftNode.getChildren();
- if (!isUnaryString(leftStrings.get(0))) {
+ if (!isAnyUnaryString(leftStrings.get(0))) {
throw new ParseException(
"Left side of ctf expression must be a string"); //$NON-NLS-1$
}
@@ -1397,8 +1401,7 @@ public class IOStructGen {
} else if (left.equals("map")) { //$NON-NLS-1$
clock = getClock(rightNode);
} else {
- throw new ParseException(
- "Integer: unknown attribute " + left); //$NON-NLS-1$
+ Activator.log(IStatus.WARNING, Messages.IOStructGen_UnknownIntegerAttributeWarning + " " + left); //$NON-NLS-1$
}
break;
@@ -1453,7 +1456,7 @@ public class IOStructGen {
List<CommonTree> leftStrings = leftNode.getChildren();
- if (!isUnaryString(leftStrings.get(0))) {
+ if (!isAnyUnaryString(leftStrings.get(0))) {
throw new ParseException(
"Left side of ctf expression must be a string"); //$NON-NLS-1$
}
@@ -1880,7 +1883,7 @@ public class IOStructGen {
String label = null;
for (CommonTree child : children) {
- if (isUnaryString(child)) {
+ if (isAnyUnaryString(child)) {
label = parseUnaryString(child);
} else if (child.getType() == CTFParser.ENUM_VALUE) {
@@ -1912,6 +1915,11 @@ public class IOStructGen {
throw new ParseException("enum declarator values overlap."); //$NON-NLS-1$
}
+ if (valueSpecified && (BigInteger.valueOf(low).compareTo(enumDeclaration.getContainerType().getMinValue()) == -1 ||
+ BigInteger.valueOf(high).compareTo(enumDeclaration.getContainerType().getMaxValue()) == 1)) {
+ throw new ParseException("enum value is not in range"); //$NON-NLS-1$
+ }
+
return high;
}
@@ -2262,6 +2270,15 @@ public class IOStructGen {
* @return True if the given node is an unary string.
*/
private static boolean isUnaryString(CommonTree node) {
+ return ((node.getType() == CTFParser.UNARY_EXPRESSION_STRING));
+ }
+
+ /**
+ * @param node
+ * The node to check.
+ * @return True if the given node is any type of unary string (no quotes, quotes, etc).
+ */
+ private static boolean isAnyUnaryString(CommonTree node) {
return ((node.getType() == CTFParser.UNARY_EXPRESSION_STRING) ||
(node.getType() == CTFParser.UNARY_EXPRESSION_STRING_QUOTES));
}
@@ -2326,8 +2343,9 @@ public class IOStructGen {
intval = Long.parseLong(strval, 010); // 010 == 0x08 == 8
}
} catch (NumberFormatException e) {
- throw new ParseException(e);
+ throw new ParseException("Invalid integer format: " + strval); //$NON-NLS-1$
}
+
/* The rest of children are sign */
if ((children.size() % 2) == 0) {
return -intval;
@@ -2360,7 +2378,7 @@ public class IOStructGen {
CommonTree firstChild = (CommonTree) rightNode.getChild(0);
- if (isUnaryString(firstChild)) {
+ if (isAnyUnaryString(firstChild)) {
if (rightNode.getChildCount() > 1) {
throw new ParseException("Invalid value for UUID"); //$NON-NLS-1$
}
@@ -2631,7 +2649,7 @@ public class IOStructGen {
CommonTree firstChild = (CommonTree) rightNode.getChild(0);
- if (isUnaryString(firstChild)) {
+ if (isAnyUnaryString(firstChild)) {
String str = concatenateUnaryStrings(rightNode.getChildren());
return str;
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/Messages.java b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/Messages.java
new file mode 100644
index 0000000..b8ace5b
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/Messages.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Marc-Andre Laperle - Initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.internal.ctf.core.event.metadata;
+
+import org.eclipse.osgi.util.NLS;
+
+@SuppressWarnings("javadoc")
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.linuxtools.internal.ctf.core.event.metadata.messages"; //$NON-NLS-1$
+
+ public static String IOStructGen_UnknownTraceAttributeWarning;
+ public static String IOStructGen_UnknownStreamAttributeWarning;
+ public static String IOStructGen_UnknownIntegerAttributeWarning;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/messages.properties b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/messages.properties
new file mode 100644
index 0000000..e274854
--- /dev/null
+++ b/lttng/org.eclipse.linuxtools.ctf.core/src/org/eclipse/linuxtools/internal/ctf/core/event/metadata/messages.properties
@@ -0,0 +1,15 @@
+###############################################################################
+# Copyright (c) 2013 Ericsson
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Marc-Andre Laperle - Initial API and implementation
+###############################################################################
+
+IOStructGen_UnknownTraceAttributeWarning=Unknown trace attribute:
+IOStructGen_UnknownStreamAttributeWarning=Unknown stream attribute:
+IOStructGen_UnknownIntegerAttributeWarning=Unknown integer attribute: \ No newline at end of file