blob: cdf35f0a501d39e412bb958c6be428c331c0fbb3 [file] [log] [blame]
Leonardo Sandoval9dfdd1b2020-08-06 17:08:11 -05001#!/usr/bin/env bash
Fathi Boudra422bf772019-12-02 11:10:16 +02002#
Leonardo Sandoval579c7372020-10-23 15:23:32 -05003# Copyright (c) 2019-2020 Arm Limited. All rights reserved.
Fathi Boudra422bf772019-12-02 11:10:16 +02004#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8lookup() {
9 local string
10
11 string="$(grep "\\<${1:?}=" < "$proc_file")"
12 if [ "$string" ]; then
13 echo "$string"
14 eval "$string"
15 fi
16}
17
18for p in $(pgrep FVP); do
19 proc_file="$WORKSPACE/proc_file"
20 tr '\000' '\n' < "/proc/$p/environ" > "$proc_file"
21
22 echo "PID: $p"
23 lookup "TRUSTED_FIRMWARE_CI"
24 lookup "BUILD_NUMBER"
25 lookup "JOB_NAME"
26
27 if [ "$KILL_PROCESS" = "true" -a "$TRUSTED_FIRMWARE_CI" = "1" ]; then
28 kill -SIGTERM "$p"
29 echo "Killed $p"
30 fi
31
32 echo
33done