Bug 1416465 - Regression tests for process_install_manifest.py. r=mshal
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Sat, 18 Nov 2017 11:31:04 +0900
changeset 393076 366c4c091bb3dba617776f06a03ac63875fa6081
parent 393075 257de1de1304548c1dcb2c7d8c66a20d26c021e6
child 393077 b2998f106294f4e76467382dfa796f3dfafab46c
push id55834
push userVYV03354@nifty.ne.jp
push dateWed, 22 Nov 2017 14:10:23 +0000
treeherderautoland@366c4c091bb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1416465
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1416465 - Regression tests for process_install_manifest.py. r=mshal MozReview-Commit-ID: LTqTddybtrr
python/mozbuild/mozbuild/test/action/test_process_install_manifest.py
python/mozbuild/mozbuild/test/python.ini
new file mode 100644
--- /dev/null
+++ b/python/mozbuild/mozbuild/test/action/test_process_install_manifest.py
@@ -0,0 +1,81 @@
+# -*- coding: utf-8 -*-
+
+# Any copyright is dedicated to the Public Domain.
+# http://creativecommons.org/publicdomain/zero/1.0/
+
+import os
+
+import mozunit
+
+from unittest import expectedFailure
+
+from mozpack.copier import (
+    FileCopier,
+    FileRegistry,
+)
+from mozpack.manifests import (
+    InstallManifest,
+    UnreadableInstallManifest,
+)
+from mozpack.test.test_files import TestWithTmpDir
+
+import mozbuild.action.process_install_manifest as process_install_manifest
+
+
+class TestGenerateManifest(TestWithTmpDir):
+    """
+    Unit tests for process_install_manifest.py.
+    """
+
+    def test_process_manifest(self):
+        source = self.tmppath('source')
+        os.mkdir(source)
+        os.mkdir('%s/base' % source)
+        os.mkdir('%s/base/foo' % source)
+        os.mkdir('%s/base2' % source)
+
+        with open('%s/base/foo/file1' % source, 'a'):
+            pass
+
+        with open('%s/base/foo/file2' % source, 'a'):
+            pass
+
+        with open('%s/base2/file3' % source, 'a'):
+            pass
+
+        m = InstallManifest()
+        m.add_pattern_link('%s/base' % source, '**', '')
+        m.add_link('%s/base2/file3' % source, 'foo/file3')
+
+        p = self.tmppath('m')
+        m.write(path=p)
+
+        dest = self.tmppath('dest')
+        track = self.tmppath('track')
+
+        for i in range(2):
+            process_install_manifest.process_manifest(dest, [p], track)
+
+            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file1')))
+            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file2')))
+            self.assertTrue(os.path.exists(self.tmppath('dest/foo/file3')))
+
+    @expectedFailure
+    def test_process_manifest2(self):
+        self.test_process_manifest()
+        m = InstallManifest()
+        p = self.tmppath('m')
+        m.write(path=p)
+
+        dest = self.tmppath('dest')
+        track = self.tmppath('track')
+
+        for i in range(2):
+            process_install_manifest.process_manifest(dest, [p], track)
+
+            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file1')))
+            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file2')))
+            self.assertFalse(os.path.exists(self.tmppath('dest/foo/file3')))
+
+if __name__ == '__main__':
+    mozunit.main()
--- a/python/mozbuild/mozbuild/test/python.ini
+++ b/python/mozbuild/mozbuild/test/python.ini
@@ -1,11 +1,12 @@
 [action/test_buildlist.py]
 [action/test_generate_browsersearch.py]
 [action/test_langpack_manifest.py]
+[action/test_process_install_manifest.py]
 [action/test_package_fennec_apk.py]
 [backend/test_build.py]
 [backend/test_configenvironment.py]
 [backend/test_fastermake.py]
 [backend/test_partialconfigenvironment.py]
 [backend/test_recursivemake.py]
 [backend/test_test_manifest.py]
 [backend/test_visualstudio.py]