import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
+import java.io.File;
import java.util.Map;
import java.util.concurrent.BrokenBarrierException;
import java.util.concurrent.CyclicBarrier;
import org.eclipse.tracecompass.statesystem.core.ITmfStateSystem;
import org.eclipse.tracecompass.statesystem.core.statevalue.TmfStateValue;
+import org.eclipse.tracecompass.tmf.core.exceptions.TmfAnalysisException;
import org.eclipse.tracecompass.tmf.core.signal.TmfTraceOpenedSignal;
import org.eclipse.tracecompass.tmf.core.statesystem.Messages;
import org.eclipse.tracecompass.tmf.core.statesystem.TmfStateSystemAnalysisModule;
assertTrue(module.isQueryable(7));
assertTrue(module.isQueryable(10));
}
+
+ /**
+ * Test that an analysis with full backend is re-read correctly
+ * @throws TmfAnalysisException Propagates exceptions
+ */
+ @Test
+ public void testReReadFullAnalysis() throws TmfAnalysisException {
+ TestStateSystemModule module = new TestStateSystemModule(true);
+ TestStateSystemModule module2 = new TestStateSystemModule(true);
+ try {
+ ITmfTrace trace = fTrace;
+ assertNotNull(trace);
+ module.setTrace(trace);
+ module2.setTrace(trace);
+
+ // Execute the first module
+ module.schedule();
+ assertTrue(module.waitForCompletion());
+
+ // Execute the second module, it should read the state system file
+ File ssFile = module2.getSsFile();
+ assertNotNull(ssFile);
+ assertTrue(ssFile.exists());
+ module2.schedule();
+ assertTrue(module2.waitForCompletion());
+ } finally {
+ module.dispose();
+ module2.dispose();
+ }
+ }
}
import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+import java.io.File;
+
import org.eclipse.jdt.annotation.NonNullByDefault;
import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.tracecompass.tmf.core.statesystem.ITmfStateProvider;
private @Nullable TestStateSystemProvider fProvider = null;
private boolean fThrottleEvents = false;
+ private final boolean fOnDisk;
+
+ /**
+ * Constructor
+ */
+ public TestStateSystemModule() {
+ this(false);
+ }
+
+ /**
+ * Constructor specifying the backend type
+ *
+ * @param onDisk <code>true</code> if the state system should be built on disk
+ */
+ public TestStateSystemModule(boolean onDisk) {
+ super();
+ fOnDisk = onDisk;
+ }
@Override
protected ITmfStateProvider createStateProvider() {
@Override
protected StateSystemBackendType getBackendType() {
- return StateSystemBackendType.INMEM;
+ return fOnDisk ? StateSystemBackendType.FULL : StateSystemBackendType.INMEM;
}
/**
}
}
+ @Override
+ public @Nullable File getSsFile() {
+ return super.getSsFile();
+ }
+
}
org.eclipse.tracecompass.tmf.core.trace.text,
org.eclipse.tracecompass.tmf.core.uml2sd,
org.eclipse.tracecompass.tmf.core.util
-Import-Package: com.google.common.base,
+Import-Package: com.google.common.annotations,
+ com.google.common.base,
com.google.common.cache,
com.google.common.collect,
- com.google.common.hash;version="15.0.0",
+ com.google.common.hash,
org.apache.commons.io
import org.eclipse.tracecompass.tmf.core.trace.TmfTraceUtils;
import org.eclipse.tracecompass.tmf.core.trace.experiment.TmfExperiment;
+import com.google.common.annotations.VisibleForTesting;
+
/**
* Abstract analysis module to generate a state system. It is a base class that
* can be used as a shortcut by analysis who just need to build a single state
// TmfAbstractAnalysisModule
// ------------------------------------------------------------------------
- private @Nullable File getSsFile() {
+ /**
+ * Get the file where to save the results of the analysis
+ *
+ * @return The file to save the results in
+ * @since 2.2
+ */
+ @VisibleForTesting
+ protected @Nullable File getSsFile() {
ITmfTrace trace = getTrace();
if (trace == null) {
return null;