about summary refs log tree commit diff homepage
path: root/tools
diff options
context:
space:
mode:
authorFrank Busse <bb0xfb@gmail.com>2021-11-01 17:32:24 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2021-11-02 15:53:14 +0000
commitf4c4f164a2d9132fcc53c0ce44ea8c5379d4d93e (patch)
treed40ea30b6491e4a06de2e31990b08ed961d8e313 /tools
parenta601685e34c61658f85d836a94f785192a5b426b (diff)
downloadklee-f4c4f164a2d9132fcc53c0ce44ea8c5379d4d93e.tar.gz
ktest-tool: --extract: warn if object can't be found
Diffstat (limited to 'tools')
-rwxr-xr-xtools/ktest-tool/ktest-tool7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/ktest-tool/ktest-tool b/tools/ktest-tool/ktest-tool
index 8356d36b..3b24cfa1 100755
--- a/tools/ktest-tool/ktest-tool
+++ b/tools/ktest-tool/ktest-tool
@@ -115,6 +115,7 @@ class KTest:
         return sio.getvalue()
 
     def extract(self, object_names, trim_zeros):
+        extracted_objects = set()
         for name, data in self.objects:
             if name not in object_names:
                 continue
@@ -123,6 +124,12 @@ class KTest:
             blob = data.rstrip(b'\x00') if trim_zeros else data
             f.write(blob)
             f.close()
+            extracted_objects.add(name)
+        missing_objects = list(object_names - extracted_objects)
+        missing_objects.sort()
+        if missing_objects:
+            sys.exit(f'Could not find object{"s"[:len(missing_objects)^1]}: {", ".join(missing_objects)}')
+