fs_config: add unit tests

Add some initial unit tests.

The unit tests themselves are inlined into the tool and
can be executed by running the "test" commandlet.

Example:
$ python -m unittest test_fs_config_generator.Tests
.............
----------------------------------------------------------------------
Ran 13 tests in 0.004s

OK

Test: run the test commandlet and observe for failures.

Change-Id: I1bada385fa841fd50fa958997d440f1198e15198
Signed-off-by: William Roberts <william.c.roberts@intel.com>
This commit is contained in:
William Roberts
2016-11-18 16:12:41 -08:00
committed by Dan Albert
parent 7fe8b6d817
commit 92ec0ab5e8
3 changed files with 285 additions and 0 deletions

View File

@@ -158,6 +158,12 @@ class AID(object):
friendly = identifier[len(AID.PREFIX):].lower()
self.friendly = AID._fixup_friendly(friendly)
def __eq__(self, other):
return self.identifier == other.identifier \
and self.value == other.value and self.found == other.found \
and self.normalized_value == other.normalized_value
@staticmethod
def is_friendly(name):
"""Determines if an AID is a freindly name or C define.
@@ -218,6 +224,12 @@ class FSConfig(object):
self.path = path
self.filename = filename
def __eq__(self, other):
return self.mode == other.mode and self.user == other.user \
and self.group == other.group and self.caps == other.caps \
and self.path == other.path and self.filename == other.filename
class AIDHeaderParser(object):
"""Parses an android_filesystem_config.h file.