Merge "Add error messages for wrong library names"
diff --git a/vndk/tools/header-checker/utils/create_reference_dumps.py b/vndk/tools/header-checker/utils/create_reference_dumps.py
index 3b9c0d5..5db48c5 100755
--- a/vndk/tools/header-checker/utils/create_reference_dumps.py
+++ b/vndk/tools/header-checker/utils/create_reference_dumps.py
@@ -187,6 +187,12 @@
 
     args = parser.parse_args()
 
+    if args.libs:
+        if any(lib_name.endswith(SOURCE_ABI_DUMP_EXT_END) or
+               lib_name.endswith(SO_EXT) for lib_name in args.libs):
+            parser.error('-libs should be followed by a base name without '
+                         'file extension.')
+
     if args.products is None:
         # If `args.products` is unspecified, generate reference ABI dumps for
         # all products.
diff --git a/vndk/tools/header-checker/utils/utils.py b/vndk/tools/header-checker/utils/utils.py
index c48c77e..fd945ec 100644
--- a/vndk/tools/header-checker/utils/utils.py
+++ b/vndk/tools/header-checker/utils/utils.py
@@ -176,6 +176,8 @@
                                      build=True)
     make_target_paths = []
     for name in libs:
+        if not (name in lsdump_paths and lsdump_paths[name]):
+            raise KeyError('Cannot find lsdump for %s.' % name)
         make_target_paths.extend(path for tag, path in
                                  lsdump_paths[name].values())
     make_targets(product, variant, make_target_paths)
@@ -281,6 +283,10 @@
     result = []
     if libs:
         for lib_name in libs:
+            if not (lib_name in lsdump_paths and
+                    arch_cpu in lsdump_paths[lib_name]):
+                raise KeyError('Cannot find lsdump for %s, %s.' %
+                               (lib_name, arch_cpu))
             result.append(lsdump_paths[lib_name][arch_cpu])
     else:
         result.extend(paths[arch_cpu] for paths in lsdump_paths.values())