refactor: use event log utils in linux tpm tests

Simplifies event log parsing by replacing manual expect patterns with
capture_log, compare_log, and capture_and_compare_log utility functions.
Improves maintainability and consistency across TPM scripts.

Change-Id: I4e3ad47189f4ace1b447d28313902e6e357235bf
Signed-off-by: Harrison Mutai <harrison.mutai@arm.com>
diff --git a/expect/utils.inc b/expect/utils.inc
index d9113d7..db3935b 100644
--- a/expect/utils.inc
+++ b/expect/utils.inc
@@ -125,10 +125,7 @@
     }
 }
 
-proc capture_and_compare_log {out end_re compare} {
-    set event_log [open $out w]
-    capture_log $out $end_re
-
+proc compare_log {out compare} {
     # Match the previously the given digests. The pass criteria is that both
     # digests must match.
     if {[catch {exec diff -s $out $compare} result options] == 0} {
@@ -138,3 +135,10 @@
             exit_uart -1
     }
 }
+
+proc capture_and_compare_log {out end_re compare} {
+    set event_log [open $out w]
+    capture_log $out $end_re
+
+    compare_log $out $compare
+}