summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCamilo Bernal2013-04-12 11:01:19 (EDT)
committer Roland Grunberg2013-04-24 09:45:27 (EDT)
commit0252e0d8dfcb40e1036c01bc0f5e6893ace40de4 (patch)
tree8737f1c7d890ab7ade4bb19a7c8a00c426960b74
parentc5322b3803694f2299e276609f7794701c4e753f (diff)
downloadorg.eclipse.linuxtools-0252e0d8dfcb40e1036c01bc0f5e6893ace40de4.zip
org.eclipse.linuxtools-0252e0d8dfcb40e1036c01bc0f5e6893ace40de4.tar.gz
org.eclipse.linuxtools-0252e0d8dfcb40e1036c01bc0f5e6893ace40de4.tar.bz2
Test perf stat elapsed time entry separately.refs/changes/64/11864/3
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 49b8403..aca2549 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();