unit_test: search line for AC macros
Allow AC macros in indented blocks to be found when
search for dependencies.
Add AC_PATH_PROG as possible dependency search macro.
Change-Id: I2539c0d895f39b1117827b975d56f9a16476a3ae
Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
diff --git a/scripts/unit-test.py b/scripts/unit-test.py
index f86e37d..2626bc0 100755
--- a/scripts/unit-test.py
+++ b/scripts/unit-test.py
@@ -51,7 +51,7 @@
configure_ac Opened 'configure.ac' file object
"""
line = ""
- dep_pkgs = []
+ dep_pkgs = set()
for cfg_line in configure_ac:
# Remove whitespace & newline
cfg_line = cfg_line.rstrip()
@@ -62,16 +62,16 @@
line = line+cfg_line
# Find any defined dependency
- for macro_key in DEPENDENCIES:
- if not line.startswith(macro_key):
- continue
- for dep_key in DEPENDENCIES[macro_key]:
- if line.find(dep_key) == -1:
- continue
- dep_pkgs += [DEPENDENCIES[macro_key][dep_key]]
+ line_has = lambda x: x if x in line else None
+ macros = set(filter(line_has, DEPENDENCIES.iterkeys()))
+ if len(macros) == 1:
+ macro = ''.join(macros)
+ deps = filter(line_has, DEPENDENCIES[macro].iterkeys())
+ dep_pkgs.update(map(lambda x: DEPENDENCIES[macro][x], deps))
+
line = ""
- return dep_pkgs
+ return list(dep_pkgs)
def build_depends(pkg, pkgdir, dep_installed):
@@ -140,12 +140,14 @@
'AC_CHECK_HEADER': {
'host-ipmid': 'phosphor-host-ipmid',
'sdbusplus': 'sdbusplus',
- 'log.hpp': 'phosphor-logging'
+ 'log.hpp': 'phosphor-logging',
},
+ 'AC_PATH_PROG': {'sdbus++': 'sdbusplus'},
'PKG_CHECK_MODULES': {
'phosphor-dbus-interfaces': 'phosphor-dbus-interfaces',
- 'sdbusplus': 'sdbusplus'
- }
+ 'sdbusplus': 'sdbusplus',
+ 'phosphor-logging': 'phosphor-logging',
+ },
}
# Set command line arguments