Leonardo Sandoval | 9dfdd1b | 2020-08-06 17:08:11 -0500 | [diff] [blame] | 1 | #!/usr/bin/env bash |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 2 | # |
Leonardo Sandoval | 579c737 | 2020-10-23 15:23:32 -0500 | [diff] [blame] | 3 | # Copyright (c) 2019-2020 Arm Limited. All rights reserved. |
Fathi Boudra | 422bf77 | 2019-12-02 11:10:16 +0200 | [diff] [blame] | 4 | # |
| 5 | # SPDX-License-Identifier: BSD-3-Clause |
| 6 | # |
| 7 | |
| 8 | lookup() { |
| 9 | local string |
| 10 | |
| 11 | string="$(grep "\\<${1:?}=" < "$proc_file")" |
| 12 | if [ "$string" ]; then |
| 13 | echo "$string" |
| 14 | eval "$string" |
| 15 | fi |
| 16 | } |
| 17 | |
| 18 | for 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 |
| 33 | done |