Merge "Add API version to forward compatibility test name"
diff --git a/tests/java_api/RSTestBackward19/Android.mk b/tests/java_api/RSTestBackward19/Android.mk
index 4351487..25e4ddf 100644
--- a/tests/java_api/RSTestBackward19/Android.mk
+++ b/tests/java_api/RSTestBackward19/Android.mk
@@ -27,7 +27,8 @@
LOCAL_MIN_SDK_VERSION := 17
LOCAL_PACKAGE_NAME := RSTestBackward19
my_rs_unit_tests_path := ../RSUnitTests/src/com/android/rs/unittest
-LOCAL_SRC_FILES := $(call all-java-files-under,src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSTestForward/21.1.2/Android.mk b/tests/java_api/RSTestForward/21.1.2/Android.mk
index 3eae46f..390650e 100644
--- a/tests/java_api/RSTestForward/21.1.2/Android.mk
+++ b/tests/java_api/RSTestForward/21.1.2/Android.mk
@@ -35,7 +35,9 @@
LOCAL_RENDERSCRIPT_CC := $(my_rs_path)/bin/llvm-rs-cc
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := $(my_rs_path)/include $(my_rs_path)/clang-include
my_rs_path :=
-LOCAL_SRC_FILES := $(call all-java-files-under,../src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,../src)\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSTestForward/21.1.2/src/RSForwardVersion.java b/tests/java_api/RSTestForward/21.1.2/src/RSForwardVersion.java
new file mode 100644
index 0000000..ed8b126
--- /dev/null
+++ b/tests/java_api/RSTestForward/21.1.2/src/RSForwardVersion.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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 com.android.rs.testforward;
+
+public class RSForwardVersion {
+ public static final String VERSION = "21";
+}
diff --git a/tests/java_api/RSTestForward/22.0.1/Android.mk b/tests/java_api/RSTestForward/22.0.1/Android.mk
index 1426561..93dbfa2 100644
--- a/tests/java_api/RSTestForward/22.0.1/Android.mk
+++ b/tests/java_api/RSTestForward/22.0.1/Android.mk
@@ -35,7 +35,9 @@
LOCAL_RENDERSCRIPT_CC := $(my_rs_path)/bin/llvm-rs-cc
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := $(my_rs_path)/include $(my_rs_path)/clang-include
my_rs_path :=
-LOCAL_SRC_FILES := $(call all-java-files-under,../src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,../src)\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSTestForward/22.0.1/src/RSForwardVersion.java b/tests/java_api/RSTestForward/22.0.1/src/RSForwardVersion.java
new file mode 100644
index 0000000..7b2b662
--- /dev/null
+++ b/tests/java_api/RSTestForward/22.0.1/src/RSForwardVersion.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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 com.android.rs.testforward;
+
+public class RSForwardVersion {
+ public static final String VERSION = "22";
+}
diff --git a/tests/java_api/RSTestForward/23.0.3/Android.mk b/tests/java_api/RSTestForward/23.0.3/Android.mk
index c59780c..43b60cd 100644
--- a/tests/java_api/RSTestForward/23.0.3/Android.mk
+++ b/tests/java_api/RSTestForward/23.0.3/Android.mk
@@ -35,7 +35,9 @@
LOCAL_RENDERSCRIPT_CC := $(my_rs_path)/bin/llvm-rs-cc
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := $(my_rs_path)/include $(my_rs_path)/clang-include
my_rs_path :=
-LOCAL_SRC_FILES := $(call all-java-files-under,../src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,../src)\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSTestForward/23.0.3/src/RSForwardVersion.java b/tests/java_api/RSTestForward/23.0.3/src/RSForwardVersion.java
new file mode 100644
index 0000000..3961e15
--- /dev/null
+++ b/tests/java_api/RSTestForward/23.0.3/src/RSForwardVersion.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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 com.android.rs.testforward;
+
+public class RSForwardVersion {
+ public static final String VERSION = "23";
+}
diff --git a/tests/java_api/RSTestForward/24.0.3/Android.mk b/tests/java_api/RSTestForward/24.0.3/Android.mk
index c63c69b..828c44f 100644
--- a/tests/java_api/RSTestForward/24.0.3/Android.mk
+++ b/tests/java_api/RSTestForward/24.0.3/Android.mk
@@ -35,7 +35,9 @@
LOCAL_RENDERSCRIPT_CC := $(my_rs_path)/bin/llvm-rs-cc
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := $(my_rs_path)/include $(my_rs_path)/clang-include
my_rs_path :=
-LOCAL_SRC_FILES := $(call all-java-files-under,../src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,../src)\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSTestForward/24.0.3/src/RSForwardVersion.java b/tests/java_api/RSTestForward/24.0.3/src/RSForwardVersion.java
new file mode 100644
index 0000000..10ab197
--- /dev/null
+++ b/tests/java_api/RSTestForward/24.0.3/src/RSForwardVersion.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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 com.android.rs.testforward;
+
+public class RSForwardVersion {
+ public static final String VERSION = "24";
+}
diff --git a/tests/java_api/RSTestForward/25.0.2/Android.mk b/tests/java_api/RSTestForward/25.0.2/Android.mk
index 1a30f73..1fde2cd 100644
--- a/tests/java_api/RSTestForward/25.0.2/Android.mk
+++ b/tests/java_api/RSTestForward/25.0.2/Android.mk
@@ -35,7 +35,9 @@
LOCAL_RENDERSCRIPT_CC := $(my_rs_path)/bin/llvm-rs-cc
LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE := $(my_rs_path)/include $(my_rs_path)/clang-include
my_rs_path :=
-LOCAL_SRC_FILES := $(call all-java-files-under,../src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,../src)\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSTestForward/25.0.2/src/RSForwardVersion.java b/tests/java_api/RSTestForward/25.0.2/src/RSForwardVersion.java
new file mode 100644
index 0000000..e9e05b7
--- /dev/null
+++ b/tests/java_api/RSTestForward/25.0.2/src/RSForwardVersion.java
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2017 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 com.android.rs.testforward;
+
+public class RSForwardVersion {
+ public static final String VERSION = "25";
+}
diff --git a/tests/java_api/RSTestForward/src/com/android/rs/testforward/RSForwardCompatibilityTests.java b/tests/java_api/RSTestForward/src/com/android/rs/testforward/RSForwardCompatibilityTests.java
index 61f084f..f403018 100644
--- a/tests/java_api/RSTestForward/src/com/android/rs/testforward/RSForwardCompatibilityTests.java
+++ b/tests/java_api/RSTestForward/src/com/android/rs/testforward/RSForwardCompatibilityTests.java
@@ -46,7 +46,7 @@
/**
* Returns the list of subclasses of UnitTest to run.
*/
- @Parameters(name = "{0}")
+ @Parameters(name = "ForwardVersion" + RSForwardVersion.VERSION + ":{0}")
public static Iterable<?> getParams() throws Exception {
Context ctx = InstrumentationRegistry.getTargetContext();
diff --git a/tests/java_api/RSTest_CompatLib19/Android.mk b/tests/java_api/RSTest_CompatLib19/Android.mk
index 9f28cd9..8c78825 100644
--- a/tests/java_api/RSTest_CompatLib19/Android.mk
+++ b/tests/java_api/RSTest_CompatLib19/Android.mk
@@ -33,7 +33,8 @@
LOCAL_MIN_SDK_VERSION := 8
my_rs_unit_tests_path := ../RSUnitTests/supportlibsrc_gen/com/android/rs/unittest
-LOCAL_SRC_FILES := $(call all-java-files-under,src)\
+LOCAL_SRC_FILES :=\
+ $(call all-java-files-under,src)\
$(my_rs_unit_tests_path)/UnitTest.java\
$(my_rs_unit_tests_path)/UT_alloc.java\
$(my_rs_unit_tests_path)/alloc.rs\
diff --git a/tests/java_api/RSUnitTests/RSUnitTests.py b/tests/java_api/RSUnitTests/RSUnitTests.py
index feba45a..e63afb1 100644
--- a/tests/java_api/RSUnitTests/RSUnitTests.py
+++ b/tests/java_api/RSUnitTests/RSUnitTests.py
@@ -198,7 +198,7 @@
)
-def WriteMakeSrcFiles(gen_file, api_version, src_dir='src',
+def WriteMakeSrcFiles(gen_file, api_version, src_dirs=['src'],
use_build_tools_version=False):
"""Writes applicable LOCAL_SRC_FILES to gen_file.
@@ -217,23 +217,21 @@
test_version >= UNIT_TEST_TOOLS_VERSIONS[x])]
tests = sorted(tests)
gen_file.write(
- 'LOCAL_SRC_FILES := $(call all-java-files-under,{})\\\n'
- ' $(my_rs_unit_tests_path)/UnitTest.java\\\n'.format(
- src_dir
- )
+ 'LOCAL_SRC_FILES :=\\\n'
+ )
+ for src_dir in src_dirs:
+ gen_file.write(' $(call all-java-files-under,{})\\\n'.format(src_dir))
+
+ gen_file.write(
+ ' $(my_rs_unit_tests_path)/UnitTest.java\\\n'.format(src_dir)
)
for test in tests:
# Add the Java and corresponding rs files to LOCAL_SRC_FILES
gen_file.write(
- ' $(my_rs_unit_tests_path)/{}\\\n'
- .format(JavaFileForUnitTest(test))
+ ' $(my_rs_unit_tests_path)/{}\\\n'.format(JavaFileForUnitTest(test))
)
for rs_file in RSFilesForUnitTest(test):
- gen_file.write(
- ' $(my_rs_unit_tests_path)/{}\\\n'.format(
- rs_file
- )
- )
+ gen_file.write(' $(my_rs_unit_tests_path)/{}\\\n'.format(rs_file))
# ---------- Java file generation ----------
@@ -440,6 +438,11 @@
build_tool_version_name)
+def ForwardJavaSrcLocation(build_tool_version_name):
+ """Returns location of src directory for forward compatibility testing."""
+ return os.path.join(ForwardDirLocation(build_tool_version_name), 'src')
+
+
def ForwardMakefileLocation(build_tool_version_name):
"""Returns the location of the Makefile for forward compatibility testing."""
return os.path.join(ForwardDirLocation(build_tool_version_name),
@@ -452,7 +455,14 @@
'AndroidManifest.xml')
+def ForwardJavaApiVersionLocation(build_tool_version_name):
+ """Returns Java version file location for forward compatibility testing."""
+ return os.path.join(ForwardJavaSrcLocation(build_tool_version_name),
+ 'RSForwardVersion.java')
+
+
def WriteForwardAndroidManifest(gen_file, package):
+ """Writes forward compatibility AndroidManifest.xml to gen_file."""
gen_file.write(
'<?xml version="1.0" encoding="utf-8"?>\n'
'<!-- Copyright (C) 2017 The Android Open Source Project\n'
@@ -491,6 +501,17 @@
)
+def WriteForwardToolsVersion(gen_file, version):
+ """Writes forward compatibility Java class with tools version as String."""
+ WriteJavaCopyright(gen_file)
+ gen_file.write(
+ 'package com.android.rs.testforward;\n\n'
+ 'public class RSForwardVersion {{\n'
+ ' public static final String VERSION = "{}";\n'
+ '}}\n'.format(version)
+ )
+
+
def WriteForwardMakefile(gen_file, build_tool_version, build_tool_version_name):
"""Writes the Makefile for forward compatibility testing.
@@ -522,7 +543,7 @@
build_tool_version_name, make_target_name, build_tool_version_name
)
)
- WriteMakeSrcFiles(gen_file, build_tool_version, '../src', True)
+ WriteMakeSrcFiles(gen_file, build_tool_version, ['../src', 'src'], True)
gen_file.write(
'\n'
'include $(BUILD_PACKAGE)\n\n'
@@ -550,6 +571,7 @@
build_tool_version_name = BUILD_TOOL_VERSIONS[build_tool_version]
if not os.path.exists(ForwardDirLocation(build_tool_version_name)):
os.mkdir(ForwardDirLocation(build_tool_version_name))
+ os.mkdir(ForwardJavaSrcLocation(build_tool_version_name))
with open(ForwardMakefileLocation(build_tool_version_name), 'w') as gen_file:
WriteForwardMakefile(gen_file, build_tool_version, build_tool_version_name)
print ('Generated forward compatibility Makefile at {}'
@@ -559,6 +581,10 @@
WriteForwardAndroidManifest(gen_file, package)
print ('Generated forward compatibility AndroidManifest.xml at {}'
.format(ForwardAndroidManifestLocation(build_tool_version_name)))
+ with open(ForwardJavaApiVersionLocation(build_tool_version_name), 'w') as gen_file:
+ WriteForwardToolsVersion(gen_file, build_tool_version)
+ print ('Generated forward compatibility RSForwardVersion.java at {}'
+ .format(ForwardJavaApiVersionLocation(build_tool_version_name)))
with open(ForwardMakeTargetsLocation(), 'w') as gen_file:
WriteForwardMakeTargets(gen_file)
print ('Generated forward compatibility targets at {}'