analysis: Make SystemCallLatencyTableAnalysisTest more stable
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 17 Dec 2015 19:12:44 +0000 (14:12 -0500)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 17 Dec 2015 23:09:03 +0000 (18:09 -0500)
Even if the jobs are finished, the table is not necessarily filled yet.
The update could be pending as a event in the UI thread queue, etc. We
can wait until cells are filled instead.

Also export the package so that it can be used elsewhere, (alltests
stress test for example).

Change-Id: I8177c7e6b7e487d59b248e0279c6bcd8da43b515
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/62959
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/META-INF/MANIFEST.MF
analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyTableAnalysisTest.java
releng/org.eclipse.tracecompass.alltests/META-INF/MANIFEST.MF

index a36039cb4c619b2a3c0e9743b5119183126b73ab..9975fa80726f02798ae34b65facb46b57a8bf190 100644 (file)
@@ -7,7 +7,8 @@ Bundle-Localization: plugin
 Bundle-SymbolicName: org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests;singleton:=true
 Bundle-ActivationPolicy: lazy
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
-Export-Package: org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests
+Export-Package: org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests,
+ org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.latency
 Require-Bundle: org.apache.log4j,
  org.eclipse.core.resources,
  org.eclipse.core.runtime,
index 2ebc595fb4bcb4a9bc934998ebf5a9fefc3a9eb6..534086c5024b892865be03d6435b8d0846960dcd 100644 (file)
@@ -12,7 +12,6 @@
 
 package org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests.latency;
 
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.fail;
 
@@ -29,6 +28,7 @@ import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
 import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
 import org.eclipse.swtbot.swt.finder.results.BoolResult;
@@ -168,11 +168,12 @@ public class SystemCallLatencyTableAnalysisTest {
         assertNotNull(fTable);
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("0", tableBot.cell(0, 2));
+        SWTBot bot = new SWTBot();
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("0", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("99", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "99", 0, 2));
     }
 
     /**
@@ -187,11 +188,12 @@ public class SystemCallLatencyTableAnalysisTest {
         assertNotNull(fTable);
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("100", tableBot.cell(0, 2));
+        SWTBot bot = new SWTBot();
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "100", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("0", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("100", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "100", 0, 2));
     }
 
     /**
@@ -206,11 +208,12 @@ public class SystemCallLatencyTableAnalysisTest {
         assertNotNull(fTable);
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("1", tableBot.cell(0, 2));
+        SWTBot bot = new SWTBot();
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("0", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("1", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1", 0, 2));
     }
 
     /**
@@ -226,11 +229,12 @@ public class SystemCallLatencyTableAnalysisTest {
         assertNotNull(fTable);
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("0", tableBot.cell(0, 2));
+        SWTBot bot = new SWTBot();
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("0", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("999999", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999999", 0, 2));
     }
 
     /**
@@ -250,11 +254,12 @@ public class SystemCallLatencyTableAnalysisTest {
         assertNotNull(fTable);
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("894633", tableBot.cell(0, 2));
+        SWTBot bot = new SWTBot();
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "894633", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("0", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("999999", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "999999", 0, 2));
     }
 
     /**
@@ -274,11 +279,12 @@ public class SystemCallLatencyTableAnalysisTest {
         assertNotNull(fTable);
         fTable.updateModel(fixture);
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("400689", tableBot.cell(0, 2));
+        SWTBot bot = new SWTBot();
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "400689", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("0", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "0", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("998001", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "998001", 0, 2));
     }
 
     /**
@@ -304,11 +310,11 @@ public class SystemCallLatencyTableAnalysisTest {
         createTable();
         SWTBotUtils.waitForJobs();
         SWTBotTable tableBot = new SWTBotTable(fTable.getTableViewer().getTable());
-        assertEquals("24100", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "24100", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("1000", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "1000", 0, 2));
         tableBot.header("Duration").click();
-        assertEquals("5904091700", tableBot.cell(0, 2));
+        bot.waitUntil(ConditionHelpers.isTableCellFilled(tableBot, "5904091700", 0, 2));
         bot.closeAllEditors();
         SWTBotUtils.deleteProject(PROJECT_NAME, bot);
     }
index 9396cb8638391f80cc7cc03947c167ec7a9b1fed..ee3bd6fb43588641a61957eb77f15b23d326fc6c 100644 (file)
@@ -15,6 +15,7 @@ Require-Bundle: org.junit;bundle-version="4.0.0",
  org.eclipse.tracecompass.gdbtrace.core.tests,
  org.eclipse.tracecompass.gdbtrace.ui.tests,
  org.eclipse.tracecompass.analysis.os.linux.core.tests,
+ org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests,
  org.eclipse.tracecompass.analysis.graph.core.tests,
  org.eclipse.tracecompass.lttng2.control.core.tests,
  org.eclipse.tracecompass.lttng2.control.ui.tests,
This page took 0.027785 seconds and 5 git commands to generate.