scripts/unit-test: Allow for dependencies to be built without tests

This preserves the current behavior but will allow us to disable
unneeded components for all of the dependencies we are not testing.

Change-Id: I94df56aea4987a6a698361b76874e08ade287fd6
Signed-off-by: William A. Kennington III <wak@google.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index 9313e5e..fcb44e0 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -286,21 +286,32 @@
     '-O',
 ]
 
-def build_and_install(pkg):
+def enFlag(flag, enabled):
+    """
+    Returns an configure flag as a string
+
+    Parameters:
+    flag                The name of the flag
+    enabled             Whether the flag is enabled or disabled
+    """
+    return '--' + ('enable' if enabled else 'disable') + '-' + flag
+
+def build_and_install(pkg, build_for_testing=False):
     """
     Builds and installs the package in the environment. Optionally
     builds the examples and test cases for package.
 
     Parameter description:
     pkg                 The package we are building
+    build_for_testing   Enable options related to testing on the package?
     """
     pkgdir = os.path.join(WORKSPACE, pkg)
     # Build & install this package
     conf_flags = [
-        '--disable-silent-rules',
-        '--enable-tests',
-        '--enable-code-coverage',
-        '--enable-valgrind'
+        enFlag('silent-rules', False),
+        enFlag('tests', build_for_testing),
+        enFlag('code-coverage', build_for_testing),
+        enFlag('valgrind', build_for_testing),
     ]
     os.chdir(pkgdir)
     # Add any necessary configure flags for package
@@ -322,7 +333,7 @@
     dep_list            Ordered list of dependencies
     """
     for pkg in dep_list:
-        build_and_install(pkg)
+        build_and_install(pkg, True)
 
 def build_dep_tree(pkg, pkgdir, dep_added, head, dep_tree=None):
     """