Skip to content

Commit

Permalink
Merge pull request #679 from askervin/5DU_e2e_vm-check-source-files-c…
Browse files Browse the repository at this point in the history
…hanged

e2e: add function for checking if local binary is out-of-date
  • Loading branch information
klihub authored Jul 5, 2021
2 parents 5b71c98 + cc1138f commit 915cedc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions demo/lib/vm.bash
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,23 @@ vm-check-binary-cri-resmgr() {
return 0
}


vm-check-source-files-changed() {
local bin_change
local src_change
local src_dir="$1"
local bin_file="$2"
bin_change=$(stat --format "%Z" "$bin_file")
src_change=$(find "$src_dir" -name '*.go' -type f -print0 | xargs -0 stat --format "%Z" | sort -n | tail -n 1)
if [[ "$src_change" > "$bin_change" ]]; then
echo "WARNING:"
echo "WARNING: Source files changed, outdated binaries in"
echo "WARNING: $(dirname "$bin_file")/"
echo "WARNING:"
sleep "${warning_delay:-0}"
fi
}

vm-command() { # script API
# Usage: vm-command COMMAND
#
Expand Down

0 comments on commit 915cedc

Please sign in to comment.