ctf: Update ctf-testsuite test for the new stream stress tests
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Sun, 16 Nov 2014 19:54:58 +0000 (14:54 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 17 Nov 2014 18:07:16 +0000 (13:07 -0500)
Won't run anything yet, because the test traces need to be generated
with a Python script. The temerary ones may generate them manually,
then the test suite will run them.

Change-Id: I9db27da958d803eb8b4530ec6fc528d55af85631
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/36546
Tested-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
org.eclipse.tracecompass.ctf.core.tests/src/org/eclipse/tracecompass/ctf/core/tests/ctftestsuite/CtfTestSuiteTests.java

index e911effe871aba1e002ba6c1b079435cc49589be..d7d2ddd511c113820de99ba200dc49a27ccc8b7f 100644 (file)
@@ -90,9 +90,7 @@ public class CtfTestSuiteTests {
         addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "metadata", "fail")), false);
         addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "metadata", "pass")), true);
         addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "fail")), false);
-
-        //FIXME Layout of the following directory is now different
-        //addDirsFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "pass")), true);
+        addDirsOneLevelDeepFrom(dirs, BASE_PATH.resolve(Paths.get("stress", "stream", "pass")), true);
 
         return dirs;
     }
@@ -114,6 +112,27 @@ public class CtfTestSuiteTests {
         }
     }
 
+    /**
+     * Some test traces are not in pass/trace1, pass/trace2, etc. but rather
+     * pass/test1/trace1, pass/test1/trace2, etc.
+     *
+     * This methods adds the directories one level "down" instead of the very
+     * next level.
+     */
+    private static void addDirsOneLevelDeepFrom(List<Object[]> dirs, Path path,
+            boolean expectSuccess) {
+        if (!Files.exists(path)) {
+            return;
+        }
+        try (DirectoryStream<Path> ds = Files.newDirectoryStream(path, DIR_FILTER);) {
+            for (Path p : ds) {
+                addDirsFrom(dirs, p, expectSuccess);
+            }
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
     private static final DirectoryStream.Filter<Path> DIR_FILTER =
             new DirectoryStream.Filter<Path>() {
                 @Override
This page took 0.026234 seconds and 5 git commands to generate.