Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: platform_tools/android/tests/gyp_to_android_tests.py

Issue 235883015: Generate tests/Android.mk from gyp (Closed) Base URL: https://skia.googlesource.com/skia.git@generate
Patch Set: Remove Android.mk/SkUserConfig.h Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: platform_tools/android/tests/gyp_to_android_tests.py
diff --git a/platform_tools/android/tests/gyp_to_android_tests.py b/platform_tools/android/tests/gyp_to_android_tests.py
index cb2a3e0c8ce44125d43022af2ac382c355ae513f..512ce36548de53106c0b9837b07b0fb65e5d82de 100644
--- a/platform_tools/android/tests/gyp_to_android_tests.py
+++ b/platform_tools/android/tests/gyp_to_android_tests.py
@@ -21,6 +21,8 @@ sys.path.append(test_variables.BIN_DIR)
import gyp_to_android
+
+
class AndroidMkCreationTest(unittest.TestCase):
def setUp(self):
@@ -31,74 +33,23 @@ class AndroidMkCreationTest(unittest.TestCase):
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, 'Android.mk')
+ 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)
-
-
-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_to_android.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))
+ # In addition, there should be an 'Android.mk' inside /tests/
+ path_to_tests_android_mk = os.path.join(self.__tmp_dir, 'tests',
+ test_variables.ANDROID_MK)
+ self.assertTrue(os.path.exists(path_to_tests_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)
- suite.addTest(loader.loadTestsFromTestCase(CleanGypdTest))
unittest.TextTestRunner(verbosity=2).run(suite)
if __name__ == "__main__":

Powered by Google App Engine
This is Rietveld 408576698