From: Patrick Tasse Date: Tue, 21 Feb 2017 20:45:06 +0000 (-0500) Subject: tmf: Fix deletion of supplementary files in unit tests X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=f60e2b07cf590f6cbca960c9af446b05e2182ee5;p=deliverable%2Ftracecompass.git tmf: Fix deletion of supplementary files in unit tests The trace should be disposed before attempting to delete supplementary files, otherwise the checkpoint indexer could still be holding a file handle to the index, and file deletion fails in Windows. Change-Id: I81f04dfd198c9a49f1dfdce36673e532bdf8b54d Signed-off-by: Patrick Tasse Reviewed-on: https://git.eclipse.org/r/91576 Reviewed-by: Hudson CI Reviewed-by: Marc-André Laperle Tested-by: Marc-André Laperle --- diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/statistics/TmfStateStatisticsTest.java b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/statistics/TmfStateStatisticsTest.java index 39d04cf9aa..54d0061540 100644 --- a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/statistics/TmfStateStatisticsTest.java +++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/statistics/TmfStateStatisticsTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2012, 2014 Ericsson + * Copyright (c) 2012, 2017 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -78,7 +78,7 @@ public class TmfStateStatisticsTest extends TmfStatisticsTest { public void tearDown() { fTotalsMod.dispose(); fEventTypesMod.dispose(); - TmfTraceManager.deleteSupplementaryFiles(NonNullUtils.checkNotNull(fTrace)); fTrace.dispose(); + TmfTraceManager.deleteSupplementaryFiles(NonNullUtils.checkNotNull(fTrace)); } } diff --git a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/tracemanager/TmfTraceManagerUtilityTest.java b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/tracemanager/TmfTraceManagerUtilityTest.java index 37b3a61cd7..177c6ef146 100644 --- a/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/tracemanager/TmfTraceManagerUtilityTest.java +++ b/ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/temp/tracemanager/TmfTraceManagerUtilityTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2016 EfficiOS Inc., Alexandre Montplaisir + * Copyright (c) 2016, 2017 EfficiOS Inc., Alexandre Montplaisir * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -85,7 +85,7 @@ public class TmfTraceManagerUtilityTest { * supplementary files already. */ assertFalse(isDirectoryEmpty(suppFilesPath)); - + trace.dispose(); TmfTraceManager.deleteSupplementaryFiles(trace); assertTrue(isDirectoryEmpty(suppFilesPath));