sanitycheck: fix issues if alternate binary name is used

Fixes an issue if CONFIG_KERNEL_BIN_NAME is customized.
There isn't a mechanism to parse the project defconfig, but
as there should be exactly one .elf artifact in the outdir
just glob it.

Change-Id: Ib3d517006dd13ef6e3e10ea3a8e975c287344d56
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/scripts/sanitycheck b/scripts/sanitycheck
index 5bc90fb..aab96eb 100755
--- a/scripts/sanitycheck
+++ b/scripts/sanitycheck
@@ -92,6 +92,7 @@
 import threading
 import time
 import csv
+import glob
 
 if "ZEPHYR_BASE" not in os.environ:
     sys.stderr.write("$ZEPHYR_BASE environment variable undefined.\n")
@@ -958,12 +959,11 @@
 
         @return A SizeCalculator object
         """
-        if self.test.ktype == "micro":
-            fn = os.path.join(self.outdir, "microkernel.elf")
-        else:
-            fn = os.path.join(self.outdir, "nanokernel.elf")
+        fns = glob.glob(os.path.join(self.outdir, "*.elf"))
+        if (len(fns) != 1):
+            raise BuildError("Missing/multiple output ELF binary")
 
-        return SizeCalculator(fn)
+        return SizeCalculator(fns[0])
 
     def __repr__(self):
         return "<TestCase %s on %s>" % (self.test.name, self.platform.name)