test_get_exe_versions.sh #2

  • //
  • p4-hms/
  • dev/
  • p4/
  • common/
  • site/
  • hms/
  • test/
  • test_get_exe_versions.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
#==============================================================================
# Copyright and license info is available in the LICENSE file included with
# the Helm Management System (HMS), and also available online:
# https://workshop.perforce.com/projects/p4-hms/main/LICENSE
#------------------------------------------------------------------------------

set -u

#==============================================================================
# Functions
function msg () { echo -e "$*"; }
function errmsg () { msg "\nError: ${1:-Unknown Error}\n"; ErrorCount+=1; }
function bail () { errmsg "${1:-Unknown Error}"; exit "${2:-1}"; }

#==============================================================================
# Declarations and Environment

declare -i ErrorCount=0
declare SDPEnvFile=
declare HMSTestEnvFile="$PWD/env.sh"
declare ThisScript="${0##*/}"
declare Version=1.1.2
declare ThisUser=

ThisUser=$(whoami)

msg "\nStarting $ThisScript v$Version as $ThisUser@${HOSTNAME%%.*} on $(date)."

[[ ${BASH_VERSINFO[0]} -lt 4 ]] && \
   bail "${0##*/} requires bash version 4.x+; current bash version is $BASH_VERSION."

[[ -r "$HMSTestEnvFile" ]] || bail "Missing HMS test environment file: $HMSTestEnvFile"
source "$HMSTestEnvFile" ||\
   errmsg "Failed to load SDP environment file: $HMSTestEnvFile"

SDPEnvFile="${SDP_ENV:-/p4/common/bin/p4_vars}"

[[ -r "$SDPEnvFile" ]] || bail "Missing SDP environment file: $SDPEnvFile"
source "$SDPEnvFile" hms ||\
   errmsg "Failed to load HMS test environment file: $HMSTestEnvFile"

# Override P4TMP to work outside full SDP runtime environment.
export P4TMP="/tmp/hms.test"
[[ -d "$P4TMP" ]] || mkdir -p "$P4TMP"

declare BASH_LIBS=$P4U_ENV
BASH_LIBS+=" ${HMS_LIB}/hms_exe_versions.sh"

for bash_lib in $BASH_LIBS; do
   # shellcheck disable=SC1090
   source "$bash_lib" ||\
      errmsg "Failed to load bash lib [$bash_lib]. Aborting."
done

[[ "$ErrorCount" -eq 0 ]] || bail "Aborting due to lib load failures."

msg "Starting tests."
VERBOSITY=6

load_exe_versions 1
# Change User Description Committed
#2 33529 C. Thomas Tyler Cosmetic: normalize double-backslash \\n / \\t to single-backslash \n / \t

An older version of ShellCheck once recommended escaping backslash-n and
backslash-t as \\n / \\t in double-quoted strings; a later version reversed
that guidance since it was unnecessary. Both forms behave identically at
runtime, but the double-backslash form is visual clutter. Applied via
tools/sed_fixer.sh across the tree; no functional change.
#1 33516 C. Thomas Tyler Consistency pass: fix absolute URLs, p4ms->hms renames, script/doc typos and bugs

- Convert absolute workshop.perforce.com URLs to relative paths in dlp/ReadMe.md
- Fix case-mismatch link to HMS_Product_Roadmap.md in README.md
- Rename reset_p4ms.sh -> reset_hms.sh and p4broker_p4ms_test -> p4broker_hms_test
- Fix .sh-suffix bugs: bin/hms calling global_replica_status.sh (should be no ext),
  and matching SEE ALSO / doc references for sdp_sync and global_replica_status
- Add missing scripts (gtu, hrun, irun, global_replica_status) to gen_script_man_pages.sh
- Add stub scripts: nj_help.sh, broker_njob.pl, broker_mkproj.pl, broker_jr.pl
- Remove dangling absolute symlinks HostCM/p4 and HostCM/p4d (cruft)
- Rename test/b -> test/broker_ctl.sh for clarity
- Fix real bugs: broker_imply-u.pl broken regex match, gen_dlp_broker_cfg.sh and
  gen_nj_broker_cfg.sh copy-pasted Version-file existence check, garbled comment
  in broker_must_be_owner.pl, unclosed quote in tools/gsr.sh usage(), missing 'h'
  in HMS_SystemComponents.md broker command example (^ms$ -> ^hms$)
- Fix broken sed command and incomplete sentence in HMS_Install_Notes.md and
  SDP_and_HMS_Update_Process.md
- Fix broken markdown table in HMS_Product_Roadmap.md
- Fix unclosed parenthesis, missing verb, and FKA Swarm mislabel in
  HMSDeploymentPlanning.adoc
- Standardize //streams/main/... naming in HostCM/ReadMe.md
- Numerous typo fixes across README.md, HMS_SystemComponents.md,
  SDP_and_HMS_Update_Process.md, HMS_TightShipManagement.adoc,
  HMSDeploymentPlanning.adoc, HostCM/ReadMe.md, and various scripts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>