ctf: Avoid re-downloading the test traces
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Mon, 11 Feb 2013 18:59:31 +0000 (13:59 -0500)
committerAlexander Kurtakov <akurtako@redhat.com>
Tue, 12 Feb 2013 16:40:32 +0000 (11:40 -0500)
Do not download the test traces if they are already present
on the file system (skipexisting="true").

The extraction was also moved to a conditional task, so that if
the traces cannot be downloaded for some reason, at least it
doesn't fail the complete build. Some unit tests will probably fail,
but that's the lesser of the two evils.

References bug 400459.

Change-Id: I69d7cb1525005cf6426f7aa42c45ecbb4c92cdff
Reviewed-on: https://git.eclipse.org/r/10286
Tested-by: Hudson CI
Reviewed-by: Alexander Kurtakov <akurtako@redhat.com>
IP-Clean: Alexander Kurtakov <akurtako@redhat.com>
Tested-by: Alexander Kurtakov <akurtako@redhat.com>
org.eclipse.linuxtools.ctf.core.tests/pom.xml
org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml [new file with mode: 0644]

index a67ccc5fd26594e369d5e537abc205cd39282380..914a1c65a0ac2ef719e040b53efbbfe3967984fc 100644 (file)
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-antrun-plugin</artifactId>
-          <version>1.2</version>
           <executions>
             <execution>
               <id>prepare</id>
               <phase>validate</phase>
               <configuration>
-                <tasks>
-                  <echo message="prepare phase" />
-                  <!-- Download traces -->
-                  <get src="http://lttng.org/files/samples/sample-ctf-trace-20120412.tar.bz2" dest="traces/sample-ctf-trace-20120412.tar.bz2"/>
-                  <get src="http://www.dorsal.polymtl.ca/~alexmont/data/trace2.tar.bz2" dest="traces/trace2.tar.bz2"/>
-
-                  <!-- Unzip Traces -->
-                  <bunzip2 src="traces/sample-ctf-trace-20120412.tar.bz2" dest="traces/" />
-                  <bunzip2 src="traces/trace2.tar.bz2" dest="traces/" />
-
-                  <!-- Extract traces -->
-                  <untar src="traces/sample-ctf-trace-20120412.tar" dest="traces/" />
-                  <untar src="traces/trace2.tar" dest="traces/" />
-
-                  <!-- Delete unnecessary files -->
-                  <delete>
-                    <fileset dir="traces" includes="**/*.tar.bz2"/>
-                    <fileset dir="traces" includes="**/*.tar"/>
-                  </delete>
-                </tasks>
+                <target>
+                 <ant antfile="get-traces.xml" dir="traces" />
+                </target>
               </configuration>
               <goals>
                 <goal>run</goal>
diff --git a/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml b/org.eclipse.linuxtools.ctf.core.tests/traces/get-traces.xml
new file mode 100644 (file)
index 0000000..ed5e56b
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<project name="Extract Traces" default="main" >
+<target name="main">
+  <echo message="Attempting to download test traces"/>
+  <get ignoreerrors="true" dest="sample-ctf-trace-20120412.tar.bz2" skipexisting="true" src="http://lttng.org/files/samples/sample-ctf-trace-20120412.tar.bz2"/>
+  <get ignoreerrors="true" dest="trace2.tar.bz2" skipexisting="true" src="http://www.dorsal.polymtl.ca/~alexmont/data/trace2.tar.bz2"/>
+  <condition property="tracesExist">
+    <and>
+      <available file="sample-ctf-trace-20120412.tar.bz2"/>
+      <available file="trace2.tar.bz2"/>
+    </and>
+  </condition>
+  <antcall target="extractTraces"/>
+</target>
+
+<target name="extractTraces" if="tracesExist">
+    <bunzip2 src="sample-ctf-trace-20120412.tar.bz2"/>
+    <bunzip2 src="trace2.tar.bz2"/>
+    <untar src="sample-ctf-trace-20120412.tar" dest="." />
+    <untar src="trace2.tar" dest="." />
+    <echo message="Traces extracted successfully"/>
+</target>
+</project>
This page took 0.073873 seconds and 5 git commands to generate.