summaryrefslogtreecommitdiffstats
path: root/luni/src/test/etc/loading-test2-jar
diff options
context:
space:
mode:
authorDan Bornstein <danfuzz@android.com>2011-01-16 11:28:47 -0800
committerDan Bornstein <danfuzz@android.com>2011-01-16 11:28:47 -0800
commit9725489fce7c1408e81b5a5b0c313e7a46b4fd37 (patch)
treecc77892433757f63132c0b6bc7d4bce4f99af8d5 /luni/src/test/etc/loading-test2-jar
parent6044fd95ef201bbdb11c5364581bc20436233321 (diff)
downloadlibcore-9725489fce7c1408e81b5a5b0c313e7a46b4fd37.zip
libcore-9725489fce7c1408e81b5a5b0c313e7a46b4fd37.tar.gz
libcore-9725489fce7c1408e81b5a5b0c313e7a46b4fd37.tar.bz2
Add a second jar/dex file for testing purposes.
Change-Id: Icc665b78ab5ecf9ae93cf9301ddc4e26e36b6558
Diffstat (limited to 'luni/src/test/etc/loading-test2-jar')
-rw-r--r--luni/src/test/etc/loading-test2-jar/README.txt8
-rw-r--r--luni/src/test/etc/loading-test2-jar/Target2.java45
-rwxr-xr-xluni/src/test/etc/loading-test2-jar/build.sh47
-rw-r--r--luni/src/test/etc/loading-test2-jar/resources/test2/Resource2.txt1
4 files changed, 101 insertions, 0 deletions
diff --git a/luni/src/test/etc/loading-test2-jar/README.txt b/luni/src/test/etc/loading-test2-jar/README.txt
new file mode 100644
index 0000000..e1d8bbb
--- /dev/null
+++ b/luni/src/test/etc/loading-test2-jar/README.txt
@@ -0,0 +1,8 @@
+This directory contains the source code for the loading-test2 jar and
+dex files, which are included as resources in the luni tests. These
+files are used for testing the various class loaders.
+
+The Android build system doesn't support dynamically producing
+resources in any sane way. To update the resource, use the script
+build.sh in this directory, which copies resulting files into the luni
+test resources directory.
diff --git a/luni/src/test/etc/loading-test2-jar/Target2.java b/luni/src/test/etc/loading-test2-jar/Target2.java
new file mode 100644
index 0000000..072a27e
--- /dev/null
+++ b/luni/src/test/etc/loading-test2-jar/Target2.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package test2;
+
+/**
+ * Class which is probed at by the class loading tests.
+ */
+public class Target2 {
+ public static int staticIgram = 0;
+ public int instanceMagri = 0;
+
+ public Target2() {
+ // This space intentionally left blank.
+ }
+
+ public static String frotz() {
+ return "frotz";
+ }
+
+ public static void setStaticIgram(int n) {
+ staticIgram = n;
+ }
+
+ public String fizmo() {
+ return "fizmo";
+ }
+
+ public void setInstanceMagri(int n) {
+ instanceMagri = n;
+ }
+}
diff --git a/luni/src/test/etc/loading-test2-jar/build.sh b/luni/src/test/etc/loading-test2-jar/build.sh
new file mode 100755
index 0000000..324b767
--- /dev/null
+++ b/luni/src/test/etc/loading-test2-jar/build.sh
@@ -0,0 +1,47 @@
+#!/bin/bash -e
+#
+# Copyright (C) 2011 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Set up prog to be the path of this script, including following
+# symlinks, and set up progdir to be the fully-qualified pathname of
+# its directory. Switch the current directory to progdir for the
+# remainder of the script.
+prog="$0"
+while [ -h "${prog}" ]; do
+ newProg=`/bin/ls -ld "${prog}"`
+ newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
+ if expr "x${newProg}" : 'x/' >/dev/null; then
+ prog="${newProg}"
+ else
+ progdir=`dirname "${prog}"`
+ prog="${progdir}/${newProg}"
+ fi
+done
+oldwd=`pwd`
+progdir=`dirname "${prog}"`
+cd "${progdir}"
+
+rm -rf classes
+rm -rf classes.dex
+rm -rf loading-test2.jar
+
+mkdir classes
+javac -d classes *.java
+dx --dex --output=classes.dex classes
+jar cf loading-test2.jar classes.dex -C resources .
+
+rm -rf classes
+mv classes.dex ../../resources/dalvik/system/loading-test2.dex
+mv loading-test2.jar ../../resources/dalvik/system/
diff --git a/luni/src/test/etc/loading-test2-jar/resources/test2/Resource2.txt b/luni/src/test/etc/loading-test2-jar/resources/test2/Resource2.txt
new file mode 100644
index 0000000..82f5c2d
--- /dev/null
+++ b/luni/src/test/etc/loading-test2-jar/resources/test2/Resource2.txt
@@ -0,0 +1 @@
+Who doesn't like a good biscuit?