abi/extract_symbols: add error handling for invalid args
The (first) positional argument should be a directory to search for
binaries. Diagnose that and fail if that can't be asserted.
Also, we require a file named 'vmlinux' to be found in the directory,
also diagnose this and possibly fail.
Change-Id: Ie55318fafa3d93031a52f8e6973d7275fb7766e1
Signed-off-by: Matthias Maennich <maennich@google.com>
diff --git a/abi/extract_symbols b/abi/extract_symbols
index 480e285..1676498 100755
--- a/abi/extract_symbols
+++ b/abi/extract_symbols
@@ -150,9 +150,18 @@
args = parser.parse_args()
+ if not os.path.isdir(args.directory):
+ print("Expected a directory to search for binaries, but got %s" %
+ args.directory)
+ return 1
+
# Locate the Kernel Binaries
vmlinux, modules = find_binaries(args.directory)
+ if vmlinux is None or not os.path.isfile(vmlinux):
+ print("Could not find a suitable vmlinux file.")
+ return 1
+
# Get required symbols of all modules
undefined_symbols = extract_undefined_symbols(modules)
all_undefined = symbol_sort(