Debian Codegraph @

launcher/image/test/scripts/test_launcher_workload_discover_signatures.sh

raw
1 #!/bin/bash
2 set -euxo pipefail
3 source util/read_serial.sh
4
5 # This test requires the workload to run and printing
6 # corresponding messages to the serial console.
7 SERIAL_OUTPUT=$(read_serial $1 $2)
8 print_serial=false
9
10 # Check how many times "Found container image signatures" is being logged.
11 counts=$(echo $SERIAL_OUTPUT | grep -o "$3" | wc -l)
12 if [ $counts -eq $4 ]; then
13 echo "- container image signatures pattern [$3] found with expected counts: $4"
14 else
15 echo "FAILED: container image signatures want $4 counts, but got $counts"
16 echo 'TEST FAILED.' > /workspace/status.txt
17 print_serial=true
18 fi
19
20 if $print_serial; then
21 echo $SERIAL_OUTPUT
22 fi