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>
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index d46db9f..8609657 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -158,6 +158,12 @@
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 @@
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.