test for reading java 8

This commit is contained in:
Julian Dolby 2015-06-04 13:53:25 -04:00
parent b34fe4d21f
commit 58b7c7324c
16 changed files with 105 additions and 53 deletions

View File

@ -1,4 +1,5 @@
language: android
jdk: oraclejdk8
before_install:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"

View File

@ -117,49 +117,57 @@
<mkdir dir="${temp.folder}"/>
<antcall target="build.jars"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
<param name="destination.temp.folder" value="${temp.folder}/jdk"/>
</antcall>
<zip destfile="${plugin.destination}/bin/com.ibm.wala.core.testdata_1.0.0a.jar" basedir="${temp.folder}/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false" excludes="**/CodeDeleted.class"/>
<zip destfile="${plugin.destination}/com.ibm.wala.core.testdata_1.0.0a.jar" basedir="${temp.folder}/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false" excludes="**/CodeDeleted.class"/>
<zip destfile="${plugin.destination}/bin/com.ibm.wala.core.testdata_1.0.0.jar" basedir="${temp.folder}/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false"/>
<zip destfile="${plugin.destination}/com.ibm.wala.core.testdata_1.0.0.jar" basedir="${temp.folder}/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/dalvik/"/>
</antcall>
<zip destfile="${plugin.destination}/bin/com.ibm.wala.core.testdata_1.0.0a.jar" basedir="${temp.folder}/dalvik/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false" excludes="**/CodeDeleted.class"/>
<zip destfile="${plugin.destination}/com.ibm.wala.core.testdata_1.0.0a.jar" basedir="${temp.folder}/dalvik/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false" excludes="**/CodeDeleted.class"/>
<zip destfile="${plugin.destination}/bin/com.ibm.wala.core.testdata_1.0.0.jar" basedir="${temp.folder}/jdk/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false"/>
<zip destfile="${plugin.destination}/com.ibm.wala.core.testdata_1.0.0.jar" basedir="${temp.folder}/jdk/com.ibm.wala.core.testdata_1.0.0" filesonly="false" whenempty="skip" update="false"/>
<delete dir="${temp.folder}"/>
</target>
<target name="@dot" depends="init" description="Create jar: com.ibm.wala.core.testdata @dot.">
<delete dir="${temp.folder}/@dot.bin"/>
<mkdir dir="${temp.folder}/@dot.bin"/>
<path id="@dot.classpath">
</path>
<!-- compile the source code -->
<javac destdir="${temp.folder}/@dot.bin" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${bundleJavacSource}" target="${bundleJavacTarget}">
<compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
<classpath refid="@dot.classpath" />
<src path="src/" />
<exclude name="**/bak/"/>
<compilerarg line="-log '${temp.folder}/@dot.bin${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</javac>
<!-- Copy necessary resources -->
<copy todir="${temp.folder}/@dot.bin" failonerror="true" overwrite="false">
<fileset dir="src/" excludes="**/*.java, **/package.htm*" />
</copy>
<mkdir dir="${build.result.folder}"/>
<copy todir="${build.result.folder}/@dot" failonerror="true" overwrite="false">
<fileset dir="${temp.folder}/@dot.bin" />
</copy>
<delete dir="${temp.folder}/@dot.bin"/>
<delete dir="${destdir}"/>
<mkdir dir="${destdir}"/>
<path id="@dot.classpath">
</path>
<!-- compile the source code -->
<javac destdir="${destdir}" failonerror="${javacFailOnError}" verbose="${javacVerbose}" debug="${javacDebugInfo}" includeAntRuntime="no" bootclasspath="${bundleBootClasspath}" source="${jsv}" target="${jtv}" excludes="${excludes}">
<compilerarg line="${compilerArg}" compiler="${build.compiler}"/>
<classpath refid="@dot.classpath" />
<src path="src/"/>
<compilerarg line="-log '${destdir}${logExtension}'" compiler="org.eclipse.jdt.core.JDTCompilerAdapter"/>
</javac>
<!-- Copy necessary resources -->
<copy todir="${destdir}" failonerror="true" overwrite="false">
<fileset dir="src/" excludes="**/*.java, **/package.htm*"/>
</copy>
</target>
<target name="src.zip" depends="init" unless="src.zip">
<mkdir dir="${build.result.folder}"/>
<zip destfile="${build.result.folder}/src.zip" filesonly="false" whenempty="skip" update="false">
<fileset dir="src/" includes="**/*.java" />
<fileset dir="src/" includes="**/*.java"/>
</zip>
</target>
<target name="build.jars" depends="init" description="Build all the jars for the plug-in: com.ibm.wala.core.testdata.">
<available property="@dot" file="${build.result.folder}/@dot"/>
<antcall target="@dot"/>
<antcall target="@dot">
<param name="destdir" value="${temp.folder}/jdk/@dot"/>
<param name="jsv" value="${bundleJavacSource}"/>
<param name="jtv" value="${bundleJavacTarget}"/>
<param name="excludes" value="**/bak/"/>
</antcall>
<antcall target="@dot">
<param name="destdir" value="${temp.folder}/dalvik/@dot"/>
<param name="jsv" value="1.6"/>
<param name="jtv" value="1.6"/>
<param name="excludes" value="**/bak/,**/SortingExample.java"/>
</antcall>
</target>
<target name="build.sources" depends="init">
@ -170,13 +178,13 @@
<target name="gather.bin.parts" depends="init" if="destination.temp.folder">
<mkdir dir="${destination.temp.folder}/com.ibm.wala.core.testdata_1.0.0"/>
<copy todir="${destination.temp.folder}/com.ibm.wala.core.testdata_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${build.result.folder}/@dot" includes="**" />
<fileset dir="${destination.temp.folder}/@dot" includes="**"/>
</copy>
<copy todir="${destination.temp.folder}/com.ibm.wala.core.testdata_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${basedir}" includes="META-INF/" />
<fileset dir="${basedir}" includes="META-INF/"/>
</copy>
<copy todir="${destination.temp.folder}/com.ibm.wala.core.testdata_1.0.0" failonerror="true" overwrite="false">
<fileset dir="${basedir}/classes" includes="**" />
<fileset dir="${basedir}/classes" includes="**"/>
</copy>
</target>
@ -211,14 +219,22 @@
<mkdir dir="${temp.folder}"/>
<antcall target="build.jars"/>
<antcall target="build.sources"/>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/"/>
<param name="destination.temp.folder" value="${temp.folder}/jdk"/>
</antcall>
<antcall target="gather.sources">
<param name="destination.temp.folder" value="${temp.folder}/"/>
<param name="destination.temp.folder" value="${temp.folder}/jdk"/>
</antcall>
<antcall target="gather.bin.parts">
<param name="destination.temp.folder" value="${temp.folder}/dalvik"/>
</antcall>
<antcall target="gather.sources">
<param name="destination.temp.folder" value="${temp.folder}/dalvik"/>
</antcall>
<delete>
<fileset dir="${temp.folder}" includes="**/*.bin${logExtension}" />
<fileset dir="${temp.folder}" includes="**/*.bin${logExtension}"/>
</delete>
<zip destfile="${plugin.destination}/com.ibm.wala.core.testdata_1.0.0.zip" basedir="${temp.folder}" filesonly="true" whenempty="skip" update="false"/>
<delete dir="${temp.folder}"/>

View File

@ -7,7 +7,7 @@
<artifactId>WALA</artifactId>
<version>1.3.8-SNAPSHOT</version>
</parent>
<packaging>jar</packaging>
<packaging>eclipse-plugin</packaging>
<artifactId>com.ibm.wala.core.testdata</artifactId>
<build>
<plugins>

View File

@ -0,0 +1,35 @@
package lambda;
import java.util.Arrays;
import java.util.Comparator;
public class SortingExample {
private final String[] strings;
public SortingExample(int n) {
this.strings = new String[n];
for(int i = 0; i < n; i++) {
strings[i] = "str" + i;
}
}
private String[] sort(Comparator<String> c) {
String[] strs = strings.clone();
Arrays.sort(strs, c);
return strs;
}
public String[] sortForward() {
return sort( (String l, String r) -> l.compareTo(r));
}
public String[] sortBackward() {
return sort( (String l, String r) -> r.compareTo(l));
}
public static void main(String[] args) {
SortingExample x = new SortingExample(10);
System.err.println( Arrays.toString( x.sortForward() ));
System.err.println( Arrays.toString( x.sortBackward() ));
}
}

View File

@ -7,7 +7,7 @@ Bundle-Vendor: %providerName
Require-Bundle: com.ibm.wala.shrike,
com.ibm.wala.core,
org.eclipse.core.runtime,
com.ibm.wala.core.testdata;bundle-version="1.3.4",
com.ibm.wala.core.testdata,
org.junit;bundle-version="4.0.0",
org.apache.ant
Bundle-Localization: plugin

View File

@ -11,8 +11,7 @@
package com.ibm.wala.core.tests.basic;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.ibm.wala.util.collections.IteratorUtil;

View File

@ -16,8 +16,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.ibm.wala.util.graph.INodeWithNumberedEdges;

View File

@ -12,8 +12,7 @@ package com.ibm.wala.core.tests.basic;
import java.util.List;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.ibm.wala.util.Predicate;

View File

@ -891,7 +891,6 @@ public class PrimitivesTest extends WalaTestCase {
testSingleBitVector(new OffsetBitVector(100, 10));
}
@SuppressWarnings("unchecked")
private void testSingleBitVector(BitVectorBase bv) {
// does the following not automatically scale the bitvector to
// a reasonable size?

View File

@ -13,8 +13,7 @@ package com.ibm.wala.core.tests.basic;
import java.util.Iterator;
import java.util.Map;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.ibm.wala.util.collections.HashMapFactory;

View File

@ -158,7 +158,14 @@ public class CallGraphTest extends WalaTestCase {
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha,
"Llambda/SortingExample");
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
CallGraph cg = CallGraphTestUtil.buildZeroCFA(options, new AnalysisCache(), cha, scope, false);
boolean foundSortForward = false;
for (CGNode n : cg) {
if (n.toString().contains("sortForward")) {
foundSortForward = true;
}
}
Assert.assertTrue("expected for sortForward", foundSortForward);
}
@Test public void testSystemProperties() throws ClassHierarchyException, IllegalArgumentException, CancelException, IOException {

View File

@ -13,8 +13,7 @@ package com.ibm.wala.core.tests.callGraph;
import java.io.IOException;
import java.util.Set;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.ibm.wala.core.tests.util.TestConstants;

View File

@ -12,8 +12,7 @@ package com.ibm.wala.core.tests.cha;
import java.io.IOException;
import junit.framework.Assert;
import org.junit.Assert;
import org.junit.Test;
import com.ibm.wala.classLoader.IClass;

View File

@ -11,7 +11,7 @@
<project-version>1.3.8-SNAPSHOT</project-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<build-alias>b000</build-alias>
<tycho-version>0.19.0</tycho-version>
<tycho-version>0.21.0</tycho-version>
<tycho.scmUrl>scm:git:ssh://github.com:wala/WALA.git</tycho.scmUrl>
</properties>

View File

@ -14,5 +14,5 @@
<repository location="http://download.eclipse.org/releases/luna"/>
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
</target>

View File

@ -11,7 +11,7 @@
<artifactId>targets</artifactId>
<packaging>pom</packaging>
<modules>
<module>e42</module>
<!-- module>e42</module -->
<module>e44</module>
</modules>
</project>