Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

rfe9758: automated tests for client distro's tar.gz

Test that eclipse will build/compile the distributed
project.  Eclipse is not easily scriptable from the
command line, so an eclipse workspace was manually
created and the minimal files included with this commit
(instructions to repeat in build.xml).

New target 'ant test-dist' uses that workspace to build the
dist project.  This target requires the eclipse-jdt package
is installed (and eclipse is on PATH), minimum version 3.3.
Because of this dependency, test-dist is run with
test-bigger, not prepush.

Note: started using a target dir that can be used for
all build operations.

Incidentally, removed useless execute mode from some files.

tests-added:  test-dist to test-bigger
tests-run:    lisp-bigger-test
performance:  no impact, test only
release-note: no impact, test only

Change-Id: I3f95c4cf66fb9105b2edf721ae3f2c53c9cc1146
Reviewed-on: https://gerrit.franz.com:9080/1194
Reviewed-by: John O'Rourke <john.orourke@franz.com>
Reviewed-by: Ahmon Dancy <dancy@franz.com>
Tested-by: Kevin Layer <layer@franz.com>
  • Loading branch information...
commit e19a180aa256f820d7f5d369f50765771de36981 1 parent 0995a5b
@mikehinchey mikehinchey authored dklayer committed
View
1  .gitignore
@@ -11,3 +11,4 @@ DIST
/doc
temp.*
tmp
+/target/
View
71 build.xml
@@ -7,6 +7,8 @@
<property name="env.AGRAPH_PORT" value=""/>
<property name="env.root" value=""/>
+ <property name="DIST" value="DIST"/>
+
<!-- Version is parameterized instead of hard-coded in multiple places. -->
<!-- This same algorithm is in clojure/project.clj -->
<!-- VERSION and env.version are set in makefile. -->
@@ -55,6 +57,7 @@
<target name="init">
<tstamp/>
<mkdir dir="${build}"/>
+ <mkdir dir="target"/>
</target>
<target name="clean"
@@ -63,6 +66,7 @@
<delete file="${jarfile}"/>
<delete file="${srcjarfile}"/>
<delete dir="doc"/>
+ <delete dir="target"/>
<delete file="agraph-java-client-test.jar"/>
<ant dir="clojure" target="clean" inheritall="false"/>
</target>
@@ -105,7 +109,7 @@
<target name="srcjar"
description="Build agraph-src.jar file."
depends="compile">
- <manifestclasspath property="mf.path" jarfile="${srcjarfile}">
+ <manifestclasspath property="mf.path.src" jarfile="${srcjarfile}">
<classpath refid="classpath"/>
</manifestclasspath>
<tstamp prefix="srcjar">
@@ -122,7 +126,7 @@
<attribute name="Implementation-Vendor" value="Franz, Inc."/>
<attribute name="Implementation-URL" value="http://www.franz.com/agraph/"/>
<attribute name="Built-At" value="${srcjar.datestamp}"/>
- <attribute name="Class-Path" value="${mf.path}"/>
+ <attribute name="Class-Path" value="${mf.path.src}"/>
</manifest>
</jar>
</target>
@@ -185,6 +189,14 @@
depends="build, test-prepush">
<ant dir="clojure" target="prepush" inheritall="false"/>
</target>
+
+ <target name="dist-init"
+ description="Creates the DIST dir, runs dependencies"
+ depends="clean, build, javadoc, srcjar">
+ <delete dir="${DIST}"/>
+ <mkdir dir="${DIST}"/>
+ <copy file="LICENSE" todir="${DIST}"/>
+ </target>
<macrodef name="run-java"
description="Run java class">
@@ -258,7 +270,7 @@
</target>
<target name="test-bigger"
- depends="clean, test-prepush, test-stress-events, test-stress"
+ depends="clean, test-dist, test-prepush, test-stress-events, test-stress"
description="run bigger tests, takes about 10 minutes">
</target>
@@ -271,6 +283,7 @@
<target name="test-stress"
depends="compile"
description="long-running stress tests">
+ <!-- Depends on scripts installed by agraph 'make install-test-scripts' -->
<run-java tasknamex="test" classname="test.TestRunner" arg="test.TestSuites$Stress"/>
</target>
@@ -300,6 +313,58 @@
<arg value="100000"/>
</exec>
</target>
+
+ <!-- The testing/test-eclipse-workspace was created manually -->
+ <!-- because there is no easy way to create a workspace and import -->
+ <!-- a project using the eclipse command line. -->
+ <!-- Instructions to create manually: -->
+ <!-- 1. Run: ant test-dist-manual-step1 -->
+ <!-- 2. Run: eclipse -data target/manual-ws -->
+ <!-- 3. In the eclipse UI, import existing project, choose target/manual-ws/acjproject, Finish. -->
+ <!-- 4. Exit eclipse. -->
+ <!-- 5. Run: ant test-dist-manual-step2 -->
+ <!-- 6. Run: ant test-dist -->
+ <!-- 7. Run: git add testing/test-eclipse-workspace -->
+ <target name="test-dist-manual-step1">
+ <exec executable="make" taskname="make"
+ failonerror="true" timeout="20000">
+ <arg value="dist"/>
+ </exec>
+ <mkdir dir="target/manual-ws"/>
+ <untar src="agraph-${env.version}-client-java.tar.gz" compression="gzip" dest="target/manual-ws/acjproject"/>
+ </target>
+ <target name="test-dist-manual-step2">
+ <delete dir="testing/test-eclipse-workspace"/>
+ <copy todir="testing/test-eclipse-workspace">
+ <fileset dir="target/manual-ws">
+ <include name=".metadata/version.ini"/>
+ <include name=".metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version"/>
+ <include name=".metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index"/>
+ <include name=".metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version"/>
+ <include name=".metadata/.plugins/org.eclipse.core.resources/.root/1.tree"/>
+ <include name=".metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources"/>
+ </fileset>
+ </copy>
+ </target>
+
+ <target name="test-dist"
+ description="Tests distribution agraph*.tar.gz">
+ <exec executable="make" taskname="make"
+ failonerror="true" timeout="20000">
+ <env key="VERSION" value="${env.version}"/>
+ <arg value="dist"/>
+ </exec>
+ <copy todir="target/test-ws">
+ <fileset dir="testing/test-eclipse-workspace"/>
+ </copy>
+ <mkdir dir="target/test-ws/acjproject"/>
+ <untar src="agraph-${env.version}-client-java.tar.gz" compression="gzip" dest="target/test-ws/acjproject"/>
+ <exec executable="./eclipse-build.sh" taskname="eclipse-build.sh"
+ failonerror="true" timeout="20000">
+ <arg value="target/test-ws/"/>
+ <arg value="target/test-ws/acjproject/bin/tutorial/TutorialExamples.class"/>
+ </exec>
+ </target>
<target name="tutorial"
depends="compile"
View
27 eclipse-build.sh
@@ -0,0 +1,27 @@
+#!/bin/bash -eEu
+
+# Requires eclipse executable on PATH
+# with the eclipse-jdt package
+# minimum version 3.3.
+
+ECLIPSE_WORKSPACE=$1
+EXPECTED_FILE=$2
+
+ECLIPSE_BUILD="eclipse -nosplash -data $ECLIPSE_WORKSPACE -application org.eclipse.jdt.apt.core.aptBuild"
+
+# exec eclipse multiple times until it builds the expected file.
+# Usually 2 or 3 times is sufficient.
+# Eclipse doesn't error if the build fails, so manually check for output.
+
+for I in 1 2 3 4
+do
+ echo EXEC: $ECLIPSE_BUILD
+ OUTPUT=$($ECLIPSE_BUILD)
+ echo OUTPUT: $OUTPUT
+ if [ -f $EXPECTED_FILE ] ; then
+ exit 0
+ fi
+done
+
+echo "Expected output file not found: " $EXPECTED_FILE >&2
+exit 1
View
6 makefile
@@ -56,14 +56,12 @@ TARNAME = agraph-$(VERSION)-client-java.tar.gz
TAROPTS =
endif
-dist: clean build javadoc srcjar
+dist: FORCE
ifndef VERSION
@echo VERSION is not defined.
@exit 1
endif
- rm -fr DIST
- mkdir -p $(DIST)
- cp LICENSE $(DIST)
+ ant -Denv.version=$(VERSION) -DDIST=$(DIST) dist-init
sed 's|SERVER_VERSION|$(VERSION)|g' templates/.project > $(DIST)/.project
sed 's|agraph-VERSION|agraph-$(VERSION)|g' templates/.classpath > $(DIST)/.classpath
mkdir -p $(DIST)/src/tutorial
View
0  src/test/AGRepositoryConnectionTest.java 100755 → 100644
File mode changed
View
0  src/test/RepositoryConnectionTest.java 100755 → 100644
File mode changed
View
0  src/test/default-graph.nt 100755 → 100644
File mode changed
View
0  src/test/graph1.nt 100755 → 100644
File mode changed
View
0  src/test/graph2.nt 100755 → 100644
File mode changed
View
0  src/tutorial/TutorialExamples.java 100755 → 100644
File mode changed
View
0  src/tutorial/java-rules.txt 100755 → 100644
File mode changed
View
0  src/tutorial/java-tutorial-40.html 100755 → 100644
File mode changed
View
0  src/tutorial/jena-tutorial-40.html 100755 → 100644
File mode changed
View
1  ...se-workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/history.version
@@ -0,0 +1 @@
+
View
BIN  ...e-workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.index
Binary file not shown
View
1  ...workspace/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
@@ -0,0 +1 @@
+
View
BIN  testing/test-eclipse-workspace/.metadata/.plugins/org.eclipse.core.resources/.root/1.tree
Binary file not shown
View
BIN  ...space/.metadata/.plugins/org.eclipse.core.resources/.safetable/org.eclipse.core.resources
Binary file not shown
View
1  testing/test-eclipse-workspace/.metadata/version.ini
@@ -0,0 +1 @@
+org.eclipse.core.runtime=1
Please sign in to comment.
Something went wrong with that request. Please try again.