From: Marc-Andre Laperle Date: Thu, 17 Dec 2015 19:12:44 +0000 (-0500) Subject: analysis: Make SystemCallLatencyTableAnalysisTest more stable X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;ds=sidebyside;h=e92fbda63513f42dde37913b282a9accbcb32a3f;p=deliverable%2Ftracecompass.git analysis: Make SystemCallLatencyTableAnalysisTest more stable 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 Reviewed-on: https://git.eclipse.org/r/62959 Reviewed-by: Hudson CI Reviewed-by: Patrick Tasse Tested-by: Patrick Tasse --- diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/META-INF/MANIFEST.MF b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/META-INF/MANIFEST.MF index a36039cb4c..9975fa8072 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/META-INF/MANIFEST.MF +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/META-INF/MANIFEST.MF @@ -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, diff --git a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyTableAnalysisTest.java b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyTableAnalysisTest.java index 2ebc595fb4..534086c502 100644 --- a/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyTableAnalysisTest.java +++ b/analysis/org.eclipse.tracecompass.analysis.os.linux.ui.swtbot.tests/src/org/eclipse/tracecompass/analysis/os/linux/ui/swtbot/tests/latency/SystemCallLatencyTableAnalysisTest.java @@ -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); } diff --git a/releng/org.eclipse.tracecompass.alltests/META-INF/MANIFEST.MF b/releng/org.eclipse.tracecompass.alltests/META-INF/MANIFEST.MF index 9396cb8638..ee3bd6fb43 100644 --- a/releng/org.eclipse.tracecompass.alltests/META-INF/MANIFEST.MF +++ b/releng/org.eclipse.tracecompass.alltests/META-INF/MANIFEST.MF @@ -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,