test_get_exe_versions.sh #2

  • //
  • guest/
  • perforce_software/
  • hms/
  • dev/
  • p4/
  • common/
  • 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 Server Deployment Package (SDP), and also available online:
# https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE
#------------------------------------------------------------------------------

#==============================================================================
# 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
set -u

declare -i ErrorCount=0
declare SDPEnvFile=
declare HMSTestEnvFile="$PWD/env.sh"

[[ ${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
#7 29182 C. Thomas Tyler Moved HMS files from /p4/common/bin -> /p4/common/site/bin.
Moved HMS files from /p4/common/lib -> /p4/common/site/lib.
Removed dependency on SDP libs so that HMS can be deployed
with a wider variety of SDP versions.
#6 27748 C. Thomas Tyler First pass at "outer to inner" implementation, adding a new test
for same.
Removed some DEMO HACK code; more to be removed.
#5 27694 C. Thomas Tyler Copyright Update; non-functional change.
#4 27309 C. Thomas Tyler Fixed issue assuming USER is set.
#3 26713 C. Thomas Tyler WIP.
Logic now supports downloading version data files published
to updates.perforce.com.
#2 26539 C. Thomas Tyler Tweaks to improve testability.
#1 26538 C. Thomas Tyler Added preliminary files contributing to "hms upgrade", etc.