lttng2.ust.ui: add SWTBot test for BasicSymbolProviderPreferencePage
Change-Id: I5faa36873df518c21b82378f553de49c7e852902
Signed-off-by: Mikael Ferland <mikael.ferland@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/98840
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/build.properties b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/build.properties
index 90ecb23..fd231a0 100644
--- a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/build.properties
+++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/build.properties
@@ -19,7 +19,8 @@
.,\
plugin.properties,\
plugin.xml,\
- about.html
+ about.html,\
+ shared/
src.includes = about.html
additional.bundles = org.eclipse.jdt.annotation
jars.extra.classpath = platform:/plugin/org.eclipse.jdt.annotation
diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/dummy-mapping.txt b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/dummy-mapping.txt
new file mode 100644
index 0000000..90010cb
--- /dev/null
+++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/dummy-mapping.txt
@@ -0,0 +1,10 @@
+00000000006062cc b angle
+0000000000606248 d animate
+00000000006062e0 b asp
+0000000000606290 d blue.19445
+00000000006062b0 B __bss_start
+00000000006062b8 b completed.6718
+ U cos@@GLIBC_2.2.5
+0000000000401aac t current_time
+ U __cyg_profile_func_enter@@GLIBC_2.2.5
+ U __cyg_profile_func_exit@@GLIBC_2.2.5
diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/invalid-cyg-profile-mapping.txt b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/invalid-cyg-profile-mapping.txt
new file mode 100644
index 0000000..c835a29
--- /dev/null
+++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/invalid-cyg-profile-mapping.txt
@@ -0,0 +1,7 @@
+This is an invalid mapping file.
+
+000000000000001a
+000000000000002b D
+000000000000003. U test3
+000000000000004d @ test4
+
diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/random.out b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/random.out
new file mode 100755
index 0000000..e28d3f5
--- /dev/null
+++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/random.out
Binary files differ
diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/win32Random.exe b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/win32Random.exe
new file mode 100755
index 0000000..1864ab3
--- /dev/null
+++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/shared/org/eclipse/tracecompass/tmf/ctf/core/tests/shared/win32Random.exe
Binary files differ
diff --git a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java
index 0079dfe..7c9d61e 100644
--- a/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java
+++ b/lttng/org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/ust/ui/swtbot/tests/CallStackViewTest.java
@@ -8,6 +8,7 @@
*
* Contributors:
* Matthew Khouzam - Initial API and implementation
+ * Mikael Ferland - Add test for BasicSymbolProvider dialog
*******************************************************************************/
package org.eclipse.tracecompass.lttng2.ust.ui.swtbot.tests;
@@ -297,6 +298,81 @@
}
/**
+ * Test manipulating valid and invalid mapping files (add, remove and change
+ * priority of files)
+ *
+ * @throws IOException
+ * Missing file
+ *
+ * @author Mikael Ferland
+ */
+ @Test
+ public void testManipulatingMappingFiles() throws IOException {
+ // 1- Open symbol provider dialog
+ final SWTBotView viewBot = fBot.viewById(CallStackView.ID);
+ viewBot.setFocus();
+ viewBot.toolbarButton(CONFIGURE_SYMBOL_PROVIDERS).click();
+ String shellTitle = "Symbol mapping";
+ fBot.waitUntil(Conditions.shellIsActive(shellTitle));
+
+ // 2- Open valid mapping files and invalid mapping file
+ Object mapObjA = CtfTmfTestTraceUtils.class.getResource("cyg-profile-mapping.txt");
+ Object mapObjB = CtfTmfTestTraceUtils.class.getResource("dummy-mapping.txt");
+ Object mapObjC = CtfTmfTestTraceUtils.class.getResource("invalid-cyg-profile-mapping.txt");
+ Object mapObjD = CtfTmfTestTraceUtils.class.getResource("random.out");
+ Object mapObjE = CtfTmfTestTraceUtils.class.getResource("win32Random.exe");
+ assertTrue(mapObjA instanceof URL);
+ assertTrue(mapObjB instanceof URL);
+ assertTrue(mapObjC instanceof URL);
+ assertTrue(mapObjD instanceof URL);
+ assertTrue(mapObjE instanceof URL);
+ URL mapUrlA = (URL) mapObjA;
+ URL mapUrlB = (URL) mapObjB;
+ URL mapUrlC = (URL) mapObjC;
+ URL mapUrlD = (URL) mapObjD;
+ URL mapUrlE = (URL) mapObjE;
+ String absoluteFileA = FileLocator.toFileURL(mapUrlA).getFile();
+ String absoluteFileB = FileLocator.toFileURL(mapUrlB).getFile();
+ String absoluteFileC = FileLocator.toFileURL(mapUrlC).getFile();
+ String absoluteFileD = FileLocator.toFileURL(mapUrlD).getFile();
+ String absoluteFileE = FileLocator.toFileURL(mapUrlE).getFile();
+ String[] overrideFiles = { absoluteFileA, absoluteFileA, absoluteFileB, absoluteFileC, absoluteFileD, absoluteFileE };
+ TmfFileDialogFactory.setOverrideFiles(overrideFiles);
+
+ final SWTBot symbolDialog = fBot.shell(shellTitle).bot();
+ symbolDialog.button("Add...").click();
+ final SWTBot errorDialog = fBot.shell("Import failure").bot();
+ errorDialog.button("OK").click();
+ final SWTBotTable table = symbolDialog.table();
+ assertEquals(table.rowCount(), 4);
+ assertEquals(table.getTableItem(0).getText(), absoluteFileA);
+ assertEquals(table.getTableItem(1).getText(), absoluteFileB);
+ assertEquals(table.getTableItem(2).getText(), absoluteFileD);
+ assertEquals(table.getTableItem(3).getText(), absoluteFileE);
+
+ // 3- Change priority of mapping files
+ table.select(0);
+ symbolDialog.button("Down").click().click().click();
+ assertEquals(table.getTableItem(0).getText(), absoluteFileB);
+ assertEquals(table.getTableItem(1).getText(), absoluteFileD);
+ assertEquals(table.getTableItem(2).getText(), absoluteFileE);
+ assertEquals(table.getTableItem(3).getText(), absoluteFileA);
+ symbolDialog.button("Up").click().click().click();
+ assertEquals(table.getTableItem(0).getText(), absoluteFileA);
+ assertEquals(table.getTableItem(1).getText(), absoluteFileB);
+ assertEquals(table.getTableItem(2).getText(), absoluteFileD);
+ assertEquals(table.getTableItem(3).getText(), absoluteFileE);
+
+ // 4- Remove multiple mapping files
+ table.select(0, 1);
+ symbolDialog.button("Remove").click();
+ assertEquals(table.rowCount(), 2);
+
+ // 5- Close symbol provider dialog
+ symbolDialog.button("Cancel").click();
+ }
+
+ /**
* Test check callstack at a time with function map
*
* @throws IOException