diff options
author | Leon Scroggins III <scroggo@google.com> | 2016-12-15 09:36:17 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-15 16:19:48 +0000 |
commit | 58c9b0481107e61ee5e47d79bccb3cd0977c166f (patch) | |
tree | 2109b656c47137806663a6531542721dbe22522a /platform_tools/android | |
parent | 625cd9e0c9379b45c7f3100677eefcf5e241d032 (diff) |
Another step to using gn_to_bp.py
Remove the tests for gyp_to_android.py, which is going away anyway.
With a .bp file in the Android source tree, the Android build system
attempts and fails to build them.
Do not attempt to run the deleted tests.
Change-Id: Idfecd79917bf6e6d70b601bf36b0f1bdf69c90b6
Reviewed-on: https://skia-review.googlesource.com/6112
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'platform_tools/android')
23 files changed, 0 insertions, 1322 deletions
diff --git a/platform_tools/android/tests/android_framework_gyp_tests.py b/platform_tools/android/tests/android_framework_gyp_tests.py deleted file mode 100644 index 085123f4b9..0000000000 --- a/platform_tools/android/tests/android_framework_gyp_tests.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Test gyp_to_android.py -""" - -import os -import shutil -import sys -import tempfile -import test_variables -import unittest - -sys.path.append(test_variables.ANDROID_DIR) - -import gyp_gen.android_framework_gyp - -GYPD_SUFFIX = ".gypd" -GYP_SUFFIX = ".gyp" -GYPI_SUFFIX = ".gypi" -OTHER_SUFFIX = ".txt" - -class CleanGypdTest(unittest.TestCase): - - def setUp(self): - self.__tmp_dir = tempfile.mkdtemp() - self.__num_files = 10 - # Fill the dir with four types of files. .gypd files should be deleted by - # clean_gypd_files(), while the rest should be left alone. - for i in range(self.__num_files): - self.create_file('%s%s' % (str(i), GYPD_SUFFIX)) - self.create_file('%s%s' % (str(i), GYPI_SUFFIX)) - self.create_file('%s%s' % (str(i), GYP_SUFFIX)) - self.create_file('%s%s' % (str(i), OTHER_SUFFIX)) - - def create_file(self, basename): - """Create a file named 'basename' in self.__tmp_dir. - """ - f = tempfile.mkstemp(dir=self.__tmp_dir) - os.rename(f[1], os.path.join(self.__tmp_dir, basename)) - self.assert_file_exists(basename) - - def assert_file_exists(self, basename): - """Assert that 'basename' exists in self.__tmp_dir. - """ - full_name = os.path.join(self.__tmp_dir, basename) - self.assertTrue(os.path.exists(full_name)) - - def assert_file_does_not_exist(self, basename): - """Assert that 'basename' does not exist in self.__tmp_dir. - """ - full_name = os.path.join(self.__tmp_dir, basename) - self.assertFalse(os.path.exists(full_name)) - - def test_clean(self): - """Test that clean_gypd_files() deletes .gypd files, and leaves others. - """ - gyp_gen.android_framework_gyp.clean_gypd_files(self.__tmp_dir) - for i in range(self.__num_files): - self.assert_file_exists('%s%s' % (str(i), GYPI_SUFFIX)) - self.assert_file_exists('%s%s' % (str(i), GYP_SUFFIX)) - self.assert_file_exists('%s%s' % (str(i), OTHER_SUFFIX)) - # Only the GYPD files should have been deleted. - self.assert_file_does_not_exist('%s%s' % (str(i), GYPD_SUFFIX)) - - def tearDown(self): - shutil.rmtree(self.__tmp_dir) - - -def main(): - loader = unittest.TestLoader() - suite = loader.loadTestsFromTestCase(CleanGypdTest) - unittest.TextTestRunner(verbosity=2).run(suite) - -if __name__ == "__main__": - main() diff --git a/platform_tools/android/tests/expectations/Android.mk b/platform_tools/android/tests/expectations/Android.mk deleted file mode 100644 index 4586a6adc8..0000000000 --- a/platform_tools/android/tests/expectations/Android.mk +++ /dev/null @@ -1,178 +0,0 @@ - -############################################################################### -# -# THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT. -# -# For bugs, please contact scroggo@google.com or djsollen@google.com -# -############################################################################### - -BASE_PATH := $(call my-dir) -LOCAL_PATH:= $(call my-dir) - -############################################################################### -# -# PROBLEMS WITH SKIA DEBUGGING?? READ THIS... -# -# The debug build results in changes to the Skia headers. This means that those -# using libskia must also be built with the debug version of the Skia headers. -# There are a few scenarios where this comes into play: -# -# (1) You're building debug code that depends on libskia. -# (a) If libskia is built in release, then define SK_RELEASE when building -# your sources. -# (b) If libskia is built with debugging (see step 2), then no changes are -# needed since your sources and libskia have been built with SK_DEBUG. -# (2) You're building libskia in debug mode. -# (a) RECOMMENDED: You can build the entire system in debug mode. Do this by -# updating your build/core/config.mk to include -DSK_DEBUG on the line -# that defines COMMON_GLOBAL_CFLAGS -# (b) You can update all the users of libskia to define SK_DEBUG when they are -# building their sources. -# -# NOTE: If neither SK_DEBUG or SK_RELEASE are defined then Skia checks NDEBUG to -# determine which build type to use. -############################################################################### - -############################################################################### -# STATIC LIBRARY -# -# This target is only to be used internally for only one of two purposes... -# (1) statically linking into testing frameworks -# (2) as an inclusion target for the libskia.so shared library -############################################################################### - -include $(CLEAR_VARS) -LOCAL_FDO_SUPPORT := true -ifneq ($(strip $(TARGET_FDO_CFLAGS)),) - # This should be the last -Oxxx specified in LOCAL_CFLAGS - LOCAL_CFLAGS += -O2 -endif - -LOCAL_ARM_MODE := thumb -# used for testing -#LOCAL_CFLAGS += -g -O0 - -LOCAL_CFLAGS += \ - local_cflags - -LOCAL_CPPFLAGS := \ - local_cppflags - -LOCAL_SRC_FILES := \ - local_src_files - -LOCAL_SHARED_LIBRARIES := \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES := \ - local_static_libraries - -LOCAL_C_INCLUDES := \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - local_export_c_include_dirs - -LOCAL_CFLAGS += \ - -Ddefines - -LOCAL_MODULE_TAGS := \ - local_module_tags - -LOCAL_MODULE := \ - local_module_static - -ifeq ($(COND), true) -LOCAL_CFLAGS_foo += \ - local_cflags_foo - -LOCAL_CPPFLAGS_foo += \ - local_cppflags_foo - -LOCAL_SRC_FILES_foo += \ - local_src_files_foo - -LOCAL_SHARED_LIBRARIES_foo += \ - local_shared_libraries_foo - -LOCAL_STATIC_LIBRARIES_foo += \ - local_static_libraries_foo - -LOCAL_C_INCLUDES_foo += \ - local_c_includes_foo - -LOCAL_EXPORT_C_INCLUDE_DIRS_foo += \ - local_export_c_include_dirs_foo - -LOCAL_CFLAGS_foo += \ - -Ddefines_foo - -LOCAL_MODULE_TAGS_foo += \ - local_module_tags_foo - -LOCAL_MODULE_foo += \ - local_module_foo - -endif - -LOCAL_CFLAGS_bar += \ - local_cflags_bar - -LOCAL_CPPFLAGS_bar += \ - local_cppflags_bar - -LOCAL_SRC_FILES_bar += \ - local_src_files_bar - -LOCAL_SHARED_LIBRARIES_bar += \ - local_shared_libraries_bar - -LOCAL_STATIC_LIBRARIES_bar += \ - local_static_libraries_bar - -LOCAL_C_INCLUDES_bar += \ - local_c_includes_bar - -LOCAL_EXPORT_C_INCLUDE_DIRS_bar += \ - local_export_c_include_dirs_bar - -LOCAL_CFLAGS_bar += \ - -Ddefines_bar - -LOCAL_MODULE_TAGS_bar += \ - local_module_tags_bar - -LOCAL_MODULE_bar += \ - local_module_bar - -LOCAL_MODULE_CLASS := STATIC_LIBRARIES -include $(BUILD_STATIC_LIBRARY) - - -############################################################################### -# SHARED LIBRARY -############################################################################### - -include $(CLEAR_VARS) -LOCAL_MODULE_CLASS := SHARED_LIBRARIES -LOCAL_MODULE := local_module -LOCAL_WHOLE_STATIC_LIBRARIES := local_module_static -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - local_export_c_include_dirs - -include $(BASE_PATH)/skia_static_deps.mk -include $(BUILD_SHARED_LIBRARY) - -############################################################# -# Build the skia tools (except in the PDK build) -# -ifneq ($(TARGET_BUILD_PDK),true) - -# benchmark (timings) -include $(BASE_PATH)/bench/Android.mk - -# diamond-master (one test to rule them all) -include $(BASE_PATH)/dm/Android.mk - -endif # disable for PDK diff --git a/platform_tools/android/tests/expectations/SkUserConfig-h.txt b/platform_tools/android/tests/expectations/SkUserConfig-h.txt deleted file mode 100644 index a9f6a0c0fa..0000000000 --- a/platform_tools/android/tests/expectations/SkUserConfig-h.txt +++ /dev/null @@ -1,43 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////// -// -// THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT. -// -// This file contains Skia's upstream include/config/SkUserConfig.h as a -// reference, followed by the actual defines set for Android. -// -/////////////////////////////////////////////////////////////////////////////// - -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* - * Unchanging SkUserConfig.h for testing generate_user_config. - */ - -// Android defines: -#ifndef SkUserConfig_Android_DEFINED -#define SkUserConfig_Android_DEFINED -#ifdef ANDROID - #include <utils/misc.h> -#endif - -#if __BYTE_ORDER == __BIG_ENDIAN - #define SK_CPU_BENDIAN - #undef SK_CPU_LENDIAN -#else - #define SK_CPU_LENDIAN - #undef SK_CPU_BENDIAN -#endif - -#define SK_BUILD_FOR_ANDROID -#define SK_BUILD_FOR_ANDROID_FRAMEWORK -#define SK_SCALAR_IS_FLOAT -#define bar -#define foo - -#endif // SkUserConfig_Android_DEFINED diff --git a/platform_tools/android/tests/expectations/animals.txt b/platform_tools/android/tests/expectations/animals.txt deleted file mode 100644 index 6685dd3e90..0000000000 --- a/platform_tools/android/tests/expectations/animals.txt +++ /dev/null @@ -1,6 +0,0 @@ -animals := \ - dog \ - cat \ - mouse \ - elephant - diff --git a/platform_tools/android/tests/expectations/animals_append.txt b/platform_tools/android/tests/expectations/animals_append.txt deleted file mode 100644 index 96b6b99790..0000000000 --- a/platform_tools/android/tests/expectations/animals_append.txt +++ /dev/null @@ -1,6 +0,0 @@ -animals_append += \ - dog \ - cat \ - mouse \ - elephant - diff --git a/platform_tools/android/tests/expectations/missing-filename.xxx b/platform_tools/android/tests/expectations/missing-filename.xxx deleted file mode 100644 index 7c5319cb94..0000000000 --- a/platform_tools/android/tests/expectations/missing-filename.xxx +++ /dev/null @@ -1,33 +0,0 @@ - -/////////////////////////////////////////////////////////////////////////////// -// -// THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT. -// -// This file contains Skia's upstream include/config/SkUserConfig.h as a -// reference, followed by the actual defines set for Android. -// -/////////////////////////////////////////////////////////////////////////////// - - -// Android defines: -#ifndef SkUserConfig_Android_DEFINED -#define SkUserConfig_Android_DEFINED -#ifdef ANDROID - #include <utils/misc.h> -#endif - -#if __BYTE_ORDER == __BIG_ENDIAN - #define SK_CPU_BENDIAN - #undef SK_CPU_LENDIAN -#else - #define SK_CPU_LENDIAN - #undef SK_CPU_BENDIAN -#endif - -#define SK_BUILD_FOR_ANDROID -#define SK_BUILD_FOR_ANDROID_FRAMEWORK -#define SK_SCALAR_IS_FLOAT -#define bar -#define foo - -#endif // SkUserConfig_Android_DEFINED diff --git a/platform_tools/android/tests/expectations/skia_static_deps.mk b/platform_tools/android/tests/expectations/skia_static_deps.mk deleted file mode 100644 index e7cd24672b..0000000000 --- a/platform_tools/android/tests/expectations/skia_static_deps.mk +++ /dev/null @@ -1,41 +0,0 @@ - -############################################################################### -# -# THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT. -# -# For bugs, please contact scroggo@google.com or djsollen@google.com -# -############################################################################### - - -############################################################################### -# -# This file contains the shared and static dependencies needed by any target -# that attempts to statically link Skia (i.e. libskia_static build target). -# -# This is a workaround for the fact that the build system does not add these -# transitive dependencies when it attempts to link libskia_static into another -# library. -# -############################################################################### -ifeq ($(COND), true) -LOCAL_SHARED_LIBRARIES += \ - local_shared_libraries_foo - -LOCAL_STATIC_LIBRARIES += \ - local_static_libraries_foo - -endif - -LOCAL_SHARED_LIBRARIES += \ - local_shared_libraries_bar - -LOCAL_STATIC_LIBRARIES += \ - local_static_libraries_bar - -LOCAL_SHARED_LIBRARIES += \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES += \ - local_static_libraries - diff --git a/platform_tools/android/tests/expectations/tool/Android.mk b/platform_tools/android/tests/expectations/tool/Android.mk deleted file mode 100644 index bd13b71d3b..0000000000 --- a/platform_tools/android/tests/expectations/tool/Android.mk +++ /dev/null @@ -1,49 +0,0 @@ - -############################################################################### -# -# THIS FILE IS AUTOGENERATED BY GYP_TO_ANDROID.PY. DO NOT EDIT. -# -# For bugs, please contact scroggo@google.com or djsollen@google.com -# -############################################################################### - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) -LOCAL_CFLAGS += \ - local_cflags - -LOCAL_CPPFLAGS := \ - local_cppflags - -LOCAL_SRC_FILES := \ - local_src_files - -LOCAL_SHARED_LIBRARIES := \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES := \ - local_static_libraries - -LOCAL_C_INCLUDES := \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - local_export_c_include_dirs - -LOCAL_CFLAGS += \ - -Ddefines - -LOCAL_MODULE_TAGS := \ - local_module_tags - -LOCAL_MODULE := \ - local_module - - -# Store skia's resources in the directory structure that the Android testing -# infrastructure expects. This requires that Skia maintain a symlinked -# subdirectory in the DATA folder that points to the top level skia resources... -# i.e. external/skia/DATA/skia_resources --> ../resources -LOCAL_PICKUP_FILES := $(LOCAL_PATH)/../DATA -include $(LOCAL_PATH)/../skia_static_deps.mk -include $(BUILD_NATIVE_TEST) diff --git a/platform_tools/android/tests/expectations/write_local_vars_append_arm b/platform_tools/android/tests/expectations/write_local_vars_append_arm deleted file mode 100644 index 60c2bce5a2..0000000000 --- a/platform_tools/android/tests/expectations/write_local_vars_append_arm +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_CFLAGS_arm += \ - local_cflags - -LOCAL_CPPFLAGS_arm += \ - local_cppflags - -LOCAL_SRC_FILES_arm += \ - local_src_files - -LOCAL_SHARED_LIBRARIES_arm += \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES_arm += \ - local_static_libraries - -LOCAL_C_INCLUDES_arm += \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS_arm += \ - local_export_c_include_dirs - -LOCAL_CFLAGS_arm += \ - -Ddefines - -LOCAL_MODULE_TAGS_arm += \ - local_module_tags - -LOCAL_MODULE_arm += \ - local_module - diff --git a/platform_tools/android/tests/expectations/write_local_vars_append_foo b/platform_tools/android/tests/expectations/write_local_vars_append_foo deleted file mode 100644 index eef5a6e48e..0000000000 --- a/platform_tools/android/tests/expectations/write_local_vars_append_foo +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_CFLAGS_foo += \ - local_cflags - -LOCAL_CPPFLAGS_foo += \ - local_cppflags - -LOCAL_SRC_FILES_foo += \ - local_src_files - -LOCAL_SHARED_LIBRARIES_foo += \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES_foo += \ - local_static_libraries - -LOCAL_C_INCLUDES_foo += \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS_foo += \ - local_export_c_include_dirs - -LOCAL_CFLAGS_foo += \ - -Ddefines - -LOCAL_MODULE_TAGS_foo += \ - local_module_tags - -LOCAL_MODULE_foo += \ - local_module - diff --git a/platform_tools/android/tests/expectations/write_local_vars_append_no_name b/platform_tools/android/tests/expectations/write_local_vars_append_no_name deleted file mode 100644 index e51ede9ed6..0000000000 --- a/platform_tools/android/tests/expectations/write_local_vars_append_no_name +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_CFLAGS += \ - local_cflags - -LOCAL_CPPFLAGS += \ - local_cppflags - -LOCAL_SRC_FILES += \ - local_src_files - -LOCAL_SHARED_LIBRARIES += \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES += \ - local_static_libraries - -LOCAL_C_INCLUDES += \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS += \ - local_export_c_include_dirs - -LOCAL_CFLAGS += \ - -Ddefines - -LOCAL_MODULE_TAGS += \ - local_module_tags - -LOCAL_MODULE += \ - local_module - diff --git a/platform_tools/android/tests/expectations/write_local_vars_no_append_arm b/platform_tools/android/tests/expectations/write_local_vars_no_append_arm deleted file mode 100644 index 79a5d09472..0000000000 --- a/platform_tools/android/tests/expectations/write_local_vars_no_append_arm +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_CFLAGS_arm += \ - local_cflags - -LOCAL_CPPFLAGS_arm := \ - local_cppflags - -LOCAL_SRC_FILES_arm := \ - local_src_files - -LOCAL_SHARED_LIBRARIES_arm := \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES_arm := \ - local_static_libraries - -LOCAL_C_INCLUDES_arm := \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS_arm := \ - local_export_c_include_dirs - -LOCAL_CFLAGS_arm += \ - -Ddefines - -LOCAL_MODULE_TAGS_arm := \ - local_module_tags - -LOCAL_MODULE_arm := \ - local_module - diff --git a/platform_tools/android/tests/expectations/write_local_vars_no_append_foo b/platform_tools/android/tests/expectations/write_local_vars_no_append_foo deleted file mode 100644 index cef7b8d18f..0000000000 --- a/platform_tools/android/tests/expectations/write_local_vars_no_append_foo +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_CFLAGS_foo += \ - local_cflags - -LOCAL_CPPFLAGS_foo := \ - local_cppflags - -LOCAL_SRC_FILES_foo := \ - local_src_files - -LOCAL_SHARED_LIBRARIES_foo := \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES_foo := \ - local_static_libraries - -LOCAL_C_INCLUDES_foo := \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS_foo := \ - local_export_c_include_dirs - -LOCAL_CFLAGS_foo += \ - -Ddefines - -LOCAL_MODULE_TAGS_foo := \ - local_module_tags - -LOCAL_MODULE_foo := \ - local_module - diff --git a/platform_tools/android/tests/expectations/write_local_vars_no_append_no_name b/platform_tools/android/tests/expectations/write_local_vars_no_append_no_name deleted file mode 100644 index 59cd2e0376..0000000000 --- a/platform_tools/android/tests/expectations/write_local_vars_no_append_no_name +++ /dev/null @@ -1,30 +0,0 @@ -LOCAL_CFLAGS += \ - local_cflags - -LOCAL_CPPFLAGS := \ - local_cppflags - -LOCAL_SRC_FILES := \ - local_src_files - -LOCAL_SHARED_LIBRARIES := \ - local_shared_libraries - -LOCAL_STATIC_LIBRARIES := \ - local_static_libraries - -LOCAL_C_INCLUDES := \ - local_c_includes - -LOCAL_EXPORT_C_INCLUDE_DIRS := \ - local_export_c_include_dirs - -LOCAL_CFLAGS += \ - -Ddefines - -LOCAL_MODULE_TAGS := \ - local_module_tags - -LOCAL_MODULE := \ - local_module - diff --git a/platform_tools/android/tests/generate_user_config_tests.py b/platform_tools/android/tests/generate_user_config_tests.py deleted file mode 100644 index 90689a6238..0000000000 --- a/platform_tools/android/tests/generate_user_config_tests.py +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Test generate_user_config.py. -""" - -import argparse -import os -import shutil -import sys -import tempfile -import test_variables -import unittest -import utils - -sys.path.append(test_variables.GYP_GEN_DIR) - -from generate_user_config import generate_user_config as gen_config - -# Name of SkUserConfig file. -USER_CONFIG_NAME = 'SkUserConfig-h.txt' -MISSING_FILENAME = 'missing-filename.xxx' -# Path to unchanging Dummy SkUserConfig file. -FULL_DUMMY_PATH = os.path.join(os.path.dirname(__file__), 'inputs', - USER_CONFIG_NAME) -REBASELINE_MSG = ('If you\'ve modified generate_user_config.py, run ' - '"generate_user_config_tests.py --rebaseline" to rebaseline') - -def generate_dummy_user_config(original_sk_user_config, - require_sk_user_config, target_dir): - # Add an arbitrary set of defines - defines = [ 'SK_BUILD_FOR_ANDROID', - 'SK_BUILD_FOR_ANDROID_FRAMEWORK', - 'SK_SCALAR_IS_FLOAT', - 'foo', - 'bar' ] - gen_config(original_sk_user_config=original_sk_user_config, - require_sk_user_config=require_sk_user_config, - target_dir=target_dir, defines=defines) - - -class GenUserConfigTest(unittest.TestCase): - - def test_missing_sk_user_config(self): - tmp = tempfile.mkdtemp() - original = os.path.join(tmp, MISSING_FILENAME) - assert not os.path.exists(original) - - - # With require_sk_user_config set to True, an AssertionError will be - # thrown when original_sk_user_config is missing. - with self.assertRaises(AssertionError): - defines = [ 'define' ] - gen_config(original_sk_user_config=original, - require_sk_user_config=True, - target_dir=tmp, defines=defines) - - # With require_sk_user_config set to False, it is okay for - # original_sk_user_config to be missing. - generate_dummy_user_config(original_sk_user_config=original, - require_sk_user_config=False, target_dir=tmp) - actual_name = os.path.join(tmp, MISSING_FILENAME) - utils.compare_to_expectation(actual_name=actual_name, - expectation_name=MISSING_FILENAME, - assert_true=self.assertTrue, - msg=REBASELINE_MSG) - - shutil.rmtree(tmp) - - def test_gen_config(self): - tmp = tempfile.mkdtemp() - generate_dummy_user_config(FULL_DUMMY_PATH, True, tmp) - actual_name = os.path.join(tmp, USER_CONFIG_NAME) - utils.compare_to_expectation(actual_name=actual_name, - expectation_name=USER_CONFIG_NAME, - assert_true=self.assertTrue, msg=REBASELINE_MSG) - shutil.rmtree(tmp) - - -def main(): - loader = unittest.TestLoader() - suite = loader.loadTestsFromTestCase(GenUserConfigTest) - results = unittest.TextTestRunner(verbosity=2).run(suite) - print repr(results) - if not results.wasSuccessful(): - raise Exception('failed one or more unittests') - - -def rebaseline(): - generate_dummy_user_config(FULL_DUMMY_PATH, True, utils.EXPECTATIONS_DIR) - generate_dummy_user_config(MISSING_FILENAME, False, utils.EXPECTATIONS_DIR) - -if __name__ == "__main__": - parser = argparse.ArgumentParser() - parser.add_argument('-r', '--rebaseline', help='Rebaseline expectations.', - action='store_true') - args = parser.parse_args() - - if args.rebaseline: - rebaseline() - else: - main() - diff --git a/platform_tools/android/tests/gyp_to_android_tests.py b/platform_tools/android/tests/gyp_to_android_tests.py deleted file mode 100644 index 434afd11ce..0000000000 --- a/platform_tools/android/tests/gyp_to_android_tests.py +++ /dev/null @@ -1,51 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Test gyp_to_android.py -""" - -import os -import shutil -import sys -import tempfile -import test_variables -import unittest - -# Path to gyp_to_android -sys.path.append(test_variables.BIN_DIR) - -import gyp_to_android - - - -class AndroidMkCreationTest(unittest.TestCase): - - def setUp(self): - # Create a temporary directory for storing the output (Android.mk) - self.__tmp_dir = tempfile.mkdtemp() - - def test_create(self): - gyp_to_android.main(self.__tmp_dir) - - # Now there should be a file named 'Android.mk' inside __tmp_dir - path_to_android_mk = os.path.join(self.__tmp_dir, - test_variables.ANDROID_MK) - self.assertTrue(os.path.exists(path_to_android_mk)) - - def tearDown(self): - # Remove self.__tmp_dir, which is no longer needed. - shutil.rmtree(self.__tmp_dir) - - -def main(): - loader = unittest.TestLoader() - suite = loader.loadTestsFromTestCase(AndroidMkCreationTest) - unittest.TextTestRunner(verbosity=2).run(suite) - -if __name__ == "__main__": - main() diff --git a/platform_tools/android/tests/inputs/SkUserConfig-h.txt b/platform_tools/android/tests/inputs/SkUserConfig-h.txt deleted file mode 100644 index a8f97ebe1f..0000000000 --- a/platform_tools/android/tests/inputs/SkUserConfig-h.txt +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -/* - * Unchanging SkUserConfig.h for testing generate_user_config. - */ diff --git a/platform_tools/android/tests/makefile_writer_tests.py b/platform_tools/android/tests/makefile_writer_tests.py deleted file mode 100644 index 42ab4bd8dc..0000000000 --- a/platform_tools/android/tests/makefile_writer_tests.py +++ /dev/null @@ -1,252 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Test makefile_writer.py -""" - -import argparse -import os -import shutil -import sys -import tempfile -import test_variables -import unittest -import utils - -sys.path.append(test_variables.GYP_GEN_DIR) - -import makefile_writer -import tool_makefile_writer -import vars_dict_lib - -MAKEFILE_NAME = test_variables.ANDROID_MK -REBASELINE_MSG = ('If you\'ve modified makefile_writer.py, run ' - '"makefile_writer_tests.py --rebaseline" to rebaseline') -TOOL_DIR = 'tool' - -def generate_dummy_vars_dict(name): - """Create a VarsDict and fill it with dummy entries. - - Args: - name: string to be appended to each entry, if not None. - - Returns: - A VarsDict with dummy entries. - """ - vars_dict = vars_dict_lib.VarsDict() - for key in vars_dict.keys(): - entry = key.lower() - if name: - entry += '_' + name - vars_dict[key].add(entry) - return vars_dict - -def generate_write_local_vars_params(): - """Generator to compute params for write_local_vars tests. - - Each iteration yields a new tuple: (filename, append, name), specific to a - way to call write_local_vars for the tests. - - Yields: - filename: filename corresponding to the expectation file for this - combination of params to write_local_vars. - append: boolean to pass as append parameter to write_local_vars. - name: string to pass as name parameter to write_local_vars. - """ - for append in [ True, False ]: - for name in [ None, 'arm', 'foo' ]: - filename = 'write_local_vars' - if append: - filename += '_append' - else: - filename += '_no_append' - if name: - filename += '_' + name - else: - filename += '_no_name' - - yield (filename, append, name) - -def generate_dummy_vars_dict_data(name, condition): - """Create a dummy VarsDictData. - - Create a dummy VarsDictData, using the name for both the contained - VarsDict and the VarsDictData - - Args: - name: name used by both the returned VarsDictData and its contained - VarsDict. - condition: condition used by the returned VarsDictData. - - Returns: - A VarsDictData with dummy values, using the passed in info. - """ - vars_dict = generate_dummy_vars_dict(name) - - return makefile_writer.VarsDictData(vars_dict=vars_dict, name=name, - condition=condition) - - -def generate_dummy_makefile(target_dir): - """Create a dummy makefile to demonstrate how it works. - - Use dummy values unrelated to any gyp files. Its output should remain the - same unless/until makefile_writer.write_android_mk changes. - - Args: - target_dir: directory in which to write the resulting Android.mk - """ - common_vars_dict = generate_dummy_vars_dict(None) - - deviation_params = [('foo', 'COND'), ('bar', None)] - deviations = [generate_dummy_vars_dict_data(name, condition) - for (name, condition) in deviation_params] - - makefile_writer.write_android_mk(target_dir=target_dir, - common=common_vars_dict, - deviations_from_common=deviations) - -def generate_dummy_static_deps_makefile(target_dir): - """Create a dummy makefile that prints out the static dependencies. - - Use dummy values unrelated to any gyp files. Its output should remain the - same unless/until makefile_writer.write_static_deps_mk changes. - - Args: - target_dir: directory in which to write the resulting file - """ - common_vars_dict = generate_dummy_vars_dict(None) - - deviation_params = [('foo', 'COND'), ('bar', None)] - deviations = [generate_dummy_vars_dict_data(name, condition) - for (name, condition) in deviation_params] - - makefile_writer.write_static_deps_mk(target_dir=target_dir, - common=common_vars_dict, - deviations_from_common=deviations) - -def generate_dummy_tool_makefile(target_dir): - """Create a dummy makefile for a tool. - - Args: - target_dir: directory in which to write the resulting Android.mk - """ - vars_dict = generate_dummy_vars_dict(None) - tool_makefile_writer.write_tool_android_mk(target_dir=target_dir, - var_dict=vars_dict) - - -class MakefileWriterTest(unittest.TestCase): - - def test_write_group_empty(self): - f = tempfile.TemporaryFile() - assert f.tell() == 0 - for empty in (None, []): - for truth in (True, False): - makefile_writer.write_group(f, 'name', empty, truth) - self.assertEqual(f.tell(), 0) - f.close() - - def test_write_group(self): - animals = ('dog', 'cat', 'mouse', 'elephant') - fd, filename = tempfile.mkstemp() - with open(filename, 'w') as f: - makefile_writer.write_group(f, 'animals', animals, False) - os.close(fd) - # Now confirm that it matches expectations - utils.compare_to_expectation(filename, 'animals.txt', self.assertTrue) - - with open(filename, 'w') as f: - makefile_writer.write_group(f, 'animals_append', animals, True) - # Now confirm that it matches expectations - utils.compare_to_expectation(filename, 'animals_append.txt', - self.assertTrue) - os.remove(filename) - - def test_write_local_vars(self): - vars_dict = generate_dummy_vars_dict(None) - # Compare various ways of calling write_local_vars to expectations. - for (filename, append, name) in generate_write_local_vars_params(): - fd, outfile = tempfile.mkstemp() - with open(outfile, 'w') as f: - makefile_writer.write_local_vars(f, vars_dict, append, name) - os.close(fd) - - # Compare to the expected file. - utils.compare_to_expectation(outfile, filename, self.assertTrue, - REBASELINE_MSG) - - # KNOWN_TARGETS is always a key in the input VarsDict, but it should not - # be written to the resulting file. - # Note that this assumes none of our dummy entries is 'KNOWN_TARGETS'. - known_targets_name = 'KNOWN_TARGETS' - self.assertEqual(len(vars_dict[known_targets_name]), 1) - - with open(outfile, 'r') as f: - self.assertNotIn(known_targets_name, f.read()) - os.remove(outfile) - - def test_write_android_mk(self): - outdir = tempfile.mkdtemp() - generate_dummy_makefile(outdir) - - utils.compare_to_expectation(os.path.join(outdir, MAKEFILE_NAME), - MAKEFILE_NAME, self.assertTrue, REBASELINE_MSG) - - shutil.rmtree(outdir) - - def test_include_static_deps_writer(self): - outdir = tempfile.mkdtemp() - generate_dummy_static_deps_makefile(outdir) - - filename = test_variables.STATIC_DEPS_MK - utils.compare_to_expectation(os.path.join(outdir, filename), - filename, self.assertTrue, REBASELINE_MSG) - - def test_tool_writer(self): - outdir = tempfile.mkdtemp() - tool_dir = os.path.join(outdir, TOOL_DIR) - os.mkdir(tool_dir) - generate_dummy_tool_makefile(tool_dir) - - utils.compare_to_expectation(os.path.join(tool_dir, MAKEFILE_NAME), - os.path.join(TOOL_DIR, MAKEFILE_NAME), - self.assertTrue, REBASELINE_MSG) - -def main(): - loader = unittest.TestLoader() - suite = loader.loadTestsFromTestCase(MakefileWriterTest) - results = unittest.TextTestRunner(verbosity=2).run(suite) - print repr(results) - if not results.wasSuccessful(): - raise Exception('failed one or more unittests') - - -def rebaseline(): - generate_dummy_makefile(utils.EXPECTATIONS_DIR) - - vars_dict = generate_dummy_vars_dict(None) - for (filename, append, name) in generate_write_local_vars_params(): - with open(os.path.join(utils.EXPECTATIONS_DIR, filename), 'w') as f: - makefile_writer.write_local_vars(f, vars_dict, append, name) - - generate_dummy_static_deps_makefile(utils.EXPECTATIONS_DIR) - generate_dummy_tool_makefile(os.path.join(utils.EXPECTATIONS_DIR, TOOL_DIR)) - - -if __name__ == '__main__': - parser = argparse.ArgumentParser() - parser.add_argument('-r', '--rebaseline', help='Rebaseline expectations.', - action='store_true') - args = parser.parse_args() - - if args.rebaseline: - rebaseline() - else: - main() - diff --git a/platform_tools/android/tests/ordered_set_tests.py b/platform_tools/android/tests/ordered_set_tests.py deleted file mode 100644 index 5ec4597e73..0000000000 --- a/platform_tools/android/tests/ordered_set_tests.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Test OrderedSet. -""" - -import sys -import test_variables -import unittest - -sys.path.append(test_variables.GYP_GEN_DIR) - -from vars_dict_lib import OrderedSet - - -def create_dummy_var(i): - return 'dummy_var' + str(i) - - -class OrderedSetTest(unittest.TestCase): - - def setUp(self): - self.__set = OrderedSet() - - def test_methods(self): - """Test methods on OrderedSet. - """ - RANGE = 10 - for i in range(RANGE): - dummy_var = create_dummy_var(i) - # Add to the list. This should succeed. - self.__set.add(dummy_var) - self.assertEqual(len(self.__set), i+1) - self.assertTrue(dummy_var in self.__set) - self.assertEqual(self.__set[i], dummy_var) - - # Now attempt to add it again. This should fail. - self.__set.add(dummy_var) - self.assertEqual(len(self.__set), i+1) - self.assertEqual(self.__set[i], dummy_var) - - # Test iterator. - counter = 0 - for set_member in self.__set: - self.assertEqual(create_dummy_var(counter), set_member) - counter += 1 - self.assertEqual(counter, len(self.__set)) - - # Now test removal. - for i in range(RANGE): - dummy_var = create_dummy_var(i) - self.__set.remove(dummy_var) - self.assertEqual(len(self.__set), RANGE-i-1) - self.assertFalse(dummy_var in self.__set) - - # Test reset(), for a range of ranges. - for subrange in range(RANGE): - for i in range(subrange): - self.__set.add(create_dummy_var(i)) - self.assertEqual(len(self.__set), subrange) - self.__set.reset() - self.assertEqual(len(self.__set), 0) - - def test_set(self): - """Test OrderedSet.set(). - """ - # Create a set with dummy values. - my_set = OrderedSet() - RANGE = 10 - for i in range(RANGE): - my_set.add(create_dummy_var(i)) - my_len = len(my_set) - self.assertEqual(my_len, RANGE) - - # Copy it to another set. - other_set = OrderedSet() - self.assertEqual(len(other_set), 0) - other_set.set(my_set) - - # Both sets should contain the same values, in the same order. - iterator = iter(my_set) - for item in other_set: - self.assertTrue(item == iterator.next()) - with self.assertRaises(StopIteration): - iterator.next() - self.assertEqual(my_len, len(other_set)) - - # But the sets are different. Changing one will not affect the other. - self.assertFalse(other_set is my_set) - other_var = 'something_else' - other_set.add(other_var) - self.assertEqual(my_len + 1, len(other_set)) - self.assertEqual(my_len, len(my_set)) - self.assertNotIn(other_var, my_set) - - -def main(): - loader = unittest.TestLoader() - suite = loader.loadTestsFromTestCase(OrderedSetTest) - unittest.TextTestRunner(verbosity=2).run(suite) - -if __name__ == "__main__": - main() - diff --git a/platform_tools/android/tests/run_all.py b/platform_tools/android/tests/run_all.py deleted file mode 100644 index 317ee759db..0000000000 --- a/platform_tools/android/tests/run_all.py +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Run all the tests in platform_tools/android/tests. -""" - -import os -import unittest - -def main(): - suite = unittest.TestLoader().discover(os.path.dirname(__file__), - pattern='*_tests.py') - results = unittest.TextTestRunner(verbosity=2).run(suite) - print repr(results) - if not results.wasSuccessful(): - raise Exception('failed one or more unittests') - -if __name__ == '__main__': - main() diff --git a/platform_tools/android/tests/test_variables.py b/platform_tools/android/tests/test_variables.py deleted file mode 100644 index 05e61eebdb..0000000000 --- a/platform_tools/android/tests/test_variables.py +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Common variables for tests. -""" - -import os - -# Find this file so we can find the python files to test. -SCRIPT_DIR = os.path.dirname(__file__) -ANDROID_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir)) - -# Path to gyp_to_android. -BIN_DIR = os.path.join(ANDROID_DIR, 'bin') - -# Path to generator files. -GYP_GEN_DIR = os.path.join(ANDROID_DIR, 'gyp_gen') - -ANDROID_MK = 'Android.mk' -STATIC_DEPS_MK = 'skia_static_deps.mk' diff --git a/platform_tools/android/tests/utils.py b/platform_tools/android/tests/utils.py deleted file mode 100644 index 0a969964b5..0000000000 --- a/platform_tools/android/tests/utils.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Common code for tests. -""" -import filecmp -import os - -EXPECTATIONS_DIR = os.path.join(os.path.dirname(__file__), 'expectations') - -def compare_to_expectation(actual_name, expectation_name, assert_true, - msg=None): - """Check that a generated file matches its expectation in EXPECTATIONS_DIR. - - Assert that the generated file and expectation file are identical. - - Args: - actual_name: Full path to the test file. - expectation_name: Basename of the expectations file within which - to compare. The file is expected to be in - platform_tools/android/tests/expectations. - assert_true: function for asserting a statement is True - - Args: - condition: statement to check for True. - msg: message to print if the files are not equal. - - msg: Message to pass to assert_true. - """ - full_expectations_path = os.path.join(EXPECTATIONS_DIR, expectation_name) - assert_true(filecmp.cmp(actual_name, full_expectations_path), msg) diff --git a/platform_tools/android/tests/var_dict_tests.py b/platform_tools/android/tests/var_dict_tests.py deleted file mode 100644 index 94f0492b6f..0000000000 --- a/platform_tools/android/tests/var_dict_tests.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/python - -# Copyright 2014 Google Inc. -# -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -""" -Test the VarsDict. -""" - -import sys -import test_variables -import unittest - -sys.path.append(test_variables.GYP_GEN_DIR) - -import vars_dict_lib -from vars_dict_lib import OrderedSet -from vars_dict_lib import VarsDict -from vars_dict_lib import VAR_NAMES - -class VarsDictTest(unittest.TestCase): - """ - Tests for the VarsDict class. - """ - - # May not be needed. - def setUp(self): - self.__vars_dict = VarsDict() - - def assert_consistency(self, v_dict): - self.assertIs(v_dict.LOCAL_CFLAGS, v_dict['LOCAL_CFLAGS']) - self.assertIs(v_dict.LOCAL_CPPFLAGS, v_dict['LOCAL_CPPFLAGS']) - self.assertIs(v_dict.LOCAL_SRC_FILES, v_dict['LOCAL_SRC_FILES']) - self.assertIs(v_dict.LOCAL_SHARED_LIBRARIES, - v_dict['LOCAL_SHARED_LIBRARIES']) - self.assertIs(v_dict.LOCAL_STATIC_LIBRARIES, - v_dict['LOCAL_STATIC_LIBRARIES']) - self.assertIs(v_dict.LOCAL_C_INCLUDES, v_dict['LOCAL_C_INCLUDES']) - self.assertIs(v_dict.LOCAL_EXPORT_C_INCLUDE_DIRS, - v_dict['LOCAL_EXPORT_C_INCLUDE_DIRS']) - self.assertIs(v_dict.KNOWN_TARGETS, v_dict['KNOWN_TARGETS']) - - def test_creation(self): - v_dict = VarsDict() - # VarsDict has one entry for each label in VAR_NAMES - self.assertEqual(len(v_dict.keys()), len(VAR_NAMES)) - for key in v_dict.keys(): - self.assertIn(key, VAR_NAMES) - # Each entry is an empty OrderedSet - self.assertIsNotNone(v_dict[key]) - self.assertIsInstance(v_dict[key], OrderedSet) - self.assertEqual(len(v_dict[key]), 0) - self.assert_consistency(v_dict) - - def test_intersection(self): - v_dict_list = [] - RANGE = 10 - for i in range(RANGE): - v_dict = VarsDict() - # Add something common to each field, as well as a unique entry - for key in v_dict.keys(): - v_dict[key].add(key.lower()) - v_dict[key].add(str(i)) - - self.assert_consistency(v_dict) - - v_dict_list.append(v_dict) - - intersection = vars_dict_lib.intersect(v_dict_list) - - self.assert_consistency(intersection) - - for key in intersection.keys(): - # Each field had one common item - self.assertEqual(len(intersection[key]), 1) - for item in intersection[key]: - for other_v_dict in v_dict_list: - self.assertNotIn(item, other_v_dict[key]) - - -def main(): - loader = unittest.TestLoader() - suite = loader.loadTestsFromTestCase(VarsDictTest) - unittest.TextTestRunner(verbosity=2).run(suite) - -if __name__ == "__main__": - main() - |