diff options
Diffstat (limited to 'tests/java_api/RSUnitTests/RSUnitTests.py')
-rw-r--r-- | tests/java_api/RSUnitTests/RSUnitTests.py | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/tests/java_api/RSUnitTests/RSUnitTests.py b/tests/java_api/RSUnitTests/RSUnitTests.py index 9a974c2a..e47a60f8 100644 --- a/tests/java_api/RSUnitTests/RSUnitTests.py +++ b/tests/java_api/RSUnitTests/RSUnitTests.py @@ -380,12 +380,10 @@ def WriteSupportLib19Makefile(gen_file): 'my_rs_unit_tests_path := ../RSUnitTests/supportlibsrc_gen/com/android/rs/unittest\n' ) WriteMakeSrcFiles(gen_file, 19) - # With dist-for-goals, copy the target to DIST_DIR with 'make dist' gen_file.write( '\n' 'include $(BUILD_PACKAGE)\n\n' 'my_rs_unit_tests_path :=\n\n' - '$(call dist-for-goals,$(LOCAL_PACKAGE_NAME),$(LOCAL_BUILT_MODULE):$(LOCAL_PACKAGE_NAME).apk)\n' ) @@ -395,6 +393,7 @@ def SupportLib19MakefileLocation(): def GenerateSupportLib19(): + """Generates the necessary file for Support Library tests (19).""" with open(SupportLib19MakefileLocation(), 'w') as gen_file: WriteSupportLib19Makefile(gen_file) print ('Generated support lib (19) Makefile at {}' @@ -404,6 +403,13 @@ def GenerateSupportLib19(): # ---------- RSTestForward ---------- +def ForwardTargetName(build_tool_version_name): + """Returns the target name for a forward compatibility build tool name.""" + make_target_name = 'RSTestForward_{}'.format(build_tool_version_name) + make_target_name = make_target_name.replace('.', '_') + return make_target_name + + def ForwardMakefileLocation(): """Returns the location of the Makefile for forward compatibility testing.""" return os.path.join(ThisScriptDir(), '..', 'RSTestForward', 'Android.mk') @@ -419,16 +425,14 @@ def WriteForwardMakefile(gen_file): gen_file.write( '# This file is auto-generated by frameworks/rs/tests/java_api/RSUnitTests/RSUnitTests.py.\n' '# To change unit tests version, please run the Python script above.\n\n' - 'ifneq ($(ENABLE_RSTESTFORWARD),)\n\n' + 'ifneq ($(ENABLE_RSTESTS),)\n\n' 'LOCAL_PATH := $(call my-dir)\n' - 'my_rs_test_forward_targets :=\n' 'my_rs_unit_tests_path := ../RSUnitTests/src/com/android/rs/unittest\n' ) all_make_target_names = [] for build_tool_version in sorted(BUILD_TOOL_VERSIONS.keys()): build_tool_version_name = BUILD_TOOL_VERSIONS[build_tool_version] - make_target_name = 'RSTestForward_{}'.format(build_tool_version_name) - make_target_name = make_target_name.replace('.', '_') + make_target_name = ForwardTargetName(build_tool_version_name) all_make_target_names.append(make_target_name) gen_file.write( '\n' @@ -447,30 +451,41 @@ def WriteForwardMakefile(gen_file): ) ) WriteMakeSrcFiles(gen_file, build_tool_version) - # With dist-for-goals, copy the target to DIST_DIR with 'make dist' gen_file.write( '\n' 'include $(BUILD_PACKAGE)\n' - '$(call dist-for-goals,RSTestForward,$(LOCAL_BUILT_MODULE):$(LOCAL_PACKAGE_NAME).apk)\n' - 'my_rs_test_forward_targets += $(LOCAL_BUILT_MODULE)\n' ) # Create RSTestForward phony target which builds all above targets gen_file.write( '\n' - '.PHONY: RSTestForward\n' - 'RSTestForward: $(my_rs_test_forward_targets)\n' - 'my_rs_unit_tests_path :=\n' - 'my_rs_test_forward_targets :=\n\n' + 'my_rs_unit_tests_path :=\n\n' 'endif\n'.format(' '.join(all_make_target_names)) ) +def ForwardMakeTargetsLocation(): + """Returns the location of the file with all forward compatibility targets.""" + return os.path.join(ThisScriptDir(), '..', 'RSTestForward', 'Targets.mk') + + +def WriteForwardMakeTargets(gen_file): + """Writes forward compatibility make target names to gen_file.""" + gen_file.write('RSTESTFORWARD_TARGETS := \\\n') + for build_tool_version_name in sorted(BUILD_TOOL_VERSIONS.values()): + make_target_name = ForwardTargetName(build_tool_version_name) + gen_file.write(' {} \\\n'.format(make_target_name)) + + def GenerateForward(): """Generates the necessary file for forward compatibility testing.""" with open(ForwardMakefileLocation(), 'w') as gen_file: WriteForwardMakefile(gen_file) print ('Generated forward compatibility Makefile at {}' .format(ForwardMakefileLocation())) + with open(ForwardMakeTargetsLocation(), 'w') as gen_file: + WriteForwardMakeTargets(gen_file) + print ('Generated forward compatibility targets at {}' + .format(ForwardMakeTargetsLocation())) # ---------- RSTestBackward ---------- @@ -549,12 +564,10 @@ def WriteBackward19Makefile(gen_file): 'my_rs_unit_tests_path := ../RSUnitTests/src/com/android/rs/unittest\n' ) WriteMakeSrcFiles(gen_file, 19) - # With dist-for-goals, copy the target to DIST_DIR with 'make dist' gen_file.write( '\n' 'include $(BUILD_PACKAGE)\n\n' 'my_rs_unit_tests_path :=\n\n' - '$(call dist-for-goals,$(LOCAL_PACKAGE_NAME),$(LOCAL_BUILT_MODULE):$(LOCAL_PACKAGE_NAME).apk)\n' ) |