Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamilo Bernal2013-04-12 15:01:19 +0000
committerRoland Grunberg2013-04-24 13:45:27 +0000
commit0252e0d8dfcb40e1036c01bc0f5e6893ace40de4 (patch)
tree8737f1c7d890ab7ade4bb19a7c8a00c426960b74
parentc5322b3803694f2299e276609f7794701c4e753f (diff)
downloadorg.eclipse.linuxtools-0252e0d8dfcb40e1036c01bc0f5e6893ace40de4.tar.gz
org.eclipse.linuxtools-0252e0d8dfcb40e1036c01bc0f5e6893ace40de4.tar.xz
org.eclipse.linuxtools-0252e0d8dfcb40e1036c01bc0f5e6893ace40de4.zip
Test perf stat elapsed time entry separately.
Change-Id: I320c3bf0c9bf6c282d66d2c3b8a101a3cf76cf71 Reviewed-on: https://git.eclipse.org/r/11864 Tested-by: Hudson CI Reviewed-by: Roland Grunberg <rgrunber@redhat.com> IP-Clean: Roland Grunberg <rgrunber@redhat.com> Tested-by: Roland Grunberg <rgrunber@redhat.com>
-rw-r--r--perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java
index 49b84036d3..aca25491c3 100644
--- a/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java
+++ b/perf/org.eclipse.linuxtools.perf.tests/src/org/eclipse/linuxtools/internal/perf/tests/StatsComparisonTest.java
@@ -16,10 +16,8 @@ import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
-
import org.eclipse.linuxtools.internal.perf.StatComparisonData;
import org.eclipse.linuxtools.internal.perf.model.PMStatEntry;
-
import junit.framework.TestCase;
public class StatsComparisonTest extends TestCase {
@@ -165,12 +163,32 @@ public class StatsComparisonTest extends TestCase {
diffData.runComparison();
String actualResult = diffData.getResult();
- String[] actulResultLines = actualResult.split("\n");
+ String[] actualResultLines = actualResult.split("\n");
String curLine;
- for (int i = 0; i < actulResultLines.length; i++) {
+ for (int i = 0; i < actualResultLines.length; i++) {
curLine = diffDataReader.readLine();
- assertEquals(actulResultLines[i], curLine);
+
+ /**
+ * Elapsed seconds are usually very close to zero, and thus prone to
+ * some small formatting differences across systems. Total time
+ * entry items are checked more thoroughly to avoid test failures.
+ */
+ if (curLine.contains(PMStatEntry.TIME)) {
+ String expectedEntry = curLine.trim();
+ String actualEntry = actualResultLines[i].trim();
+
+ String expectedSamples = expectedEntry.substring(0, expectedEntry.indexOf(" "));
+ String expectedRest = expectedEntry.substring(expectedEntry.indexOf(" ") + 1);
+
+ String actualSamples = actualEntry.substring(0, actualEntry.indexOf(" "));
+ String actualRest = actualEntry.substring(actualEntry.indexOf(" ") + 1);
+
+ assertEquals(StatComparisonData.toFloat(actualSamples),
+ StatComparisonData.toFloat(expectedSamples));
+ assertEquals(actualRest, expectedRest);
+ }
+ assertEquals(actualResultLines[i], curLine);
}
diffDataReader.close();

Back to the top