[csw-devel] proposed checkpkg test
Ben Walton
bwalton at opencsw.org
Sat Jun 18 21:14:52 CEST 2011
Excerpts from Maciej Bliziński's message of Sat Jun 18 02:43:33 -0400 2011:
> The code looks good. A unit test would be a good thing to have. I
> can think of three test cases:
How about this then?
Index: package_checks_test.py
===================================================================
--- package_checks_test.py (revision 14836)
+++ package_checks_test.py (working copy)
@@ -950,6 +950,39 @@
'This path is already provided by CSWcommon '
'or is not allowed for other reasons.')
+
+class TestCheckGzippedManpages(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = "CheckGzippedManpages"
+ def CheckpkgTest(self):
+ self.pkg_data["pkgmap"].append({
+ "class": "none",
+ "group": "bin",
+ "line": "",
+ "mode": '0755',
+ "path": "/opt/csw/share/man/man5/puppet.conf.5.gz",
+ "type": "f",
+ "user": "root"
+ })
+ self.error_mgr_mock.ReportError(
+ 'gzipped-manpage-in-pkgmap', 'opt/csw/share/man/man5/puppet.conf.5.gz',
+ "Solaris' man cannot automatically inflate man pages."
+ "Solution: man page should be gunzipped.")
+
+
+class TestCheckGzippedManpages_good(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = "CheckGzippedManpages"
+ def CheckpkgTest(self):
+ self.pkg_data["pkgmap"].append({
+ "class": "none",
+ "group": "bin",
+ "line": "",
+ "mode": '0755',
+ "path": "/opt/csw/share/man/man5/puppet.conf.5",
+ "type": "f",
+ "user": "root"
+ })
+
+
class TestCheckArchitecture_sparcv8plus(CheckpkgUnitTestHelper,
unittest.TestCase):
FUNCTION_NAME = "CheckArchitecture"
Index: package_checks.py
===================================================================
--- package_checks.py (revision 14836)
+++ package_checks.py (working copy)
@@ -220,6 +220,15 @@
if re.search(perllocal_re, entry["path"]):
error_mgr.ReportError("perllocal-pod-in-pkgmap", entry["path"])
+def CheckGzippedManpages(pkg_data, error_mgr, logger, messenger):
+ gzipman_re = re.compile(r'share/man/man.*/.*\.gz$')
+ for entry in pkg_data["pkgmap"]:
+ if entry["path"]:
+ if re.search(gzipman_re, entry["path"]):
+ error_mgr.ReportError(
+ 'gzipped-manpage-in-pkgmap', entry["path"],
+ "Solaris' man cannot automatically inflate man pages."
+ "Solution: man page should be gunzipped.")
def CheckMultipleDepends(pkg_data, error_mgr, logger, messenger):
new_depends = set()
--
Ben Walton
Systems Programmer - CHASS
University of Toronto
C:416.407.5610 | W:416.978.4302
More information about the devel
mailing list