test_script-recover_correct_ckp_1.sh #2

  • //
  • p4-sdp/
  • dev_c2s/
  • test/
  • bsw/
  • test_script-recover_correct_ckp_1.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
set -u

# Version ID Block. Relies on +k filetype modifier.
#------------------------------------------------------------------------------
# shellcheck disable=SC2016
declare VersionID='$Id: //p4-sdp/dev_c2s/test/bsw/test_script-recover_correct_ckp_1.sh#2 $ $Change: 31472 $'
declare VersionStream=${VersionID#*//}; VersionStream=${VersionStream#*/}; VersionStream=${VersionStream%%/*};
declare VersionCL=${VersionID##*: }; VersionCL=${VersionCL%% *}
declare Version=${VersionStream}.${VersionCL}
[[ "$VersionStream" == r* ]] || Version="${Version^^}"

declare ThisScript="${0##*/}"
declare -i ErrorCount=0
declare -i Debug=${SDP_DEBUG:-0}
declare -i LocalLogCount=0
declare -a LocalLogList

function msg () { echo -e "$*"; }
function dbg () { [[ "$Debug" -eq 0 ]] || msg "DEBUG: $*"; }
function errmsg () { msg "\\nError: ${1:-Unknown Error}\\n"; ErrorCount+=1; }
function bail () { errmsg "${1:-Unknown Error}"; exit "$ErrorCount"; }

msg "Start test [$ThisScript version $Version]: Serial checkpoint, recover correct checkpoint."

# Setup: Create site/config dir if needed
mkdir -p /p4/common/site/config

msg "Configure serial checkpoint on commit."

{
   echo export DO_PARALLEL_CHECKPOINTS=0
   echo KEEPCKPS=2
   echo KEEPJNLS=2
   echo KEEPCKPS=2
} > /p4/common/site/config/p4_1.vars.local

msg "Take live checkpoint on commit."
live_checkpoint.sh 1 || errmsg "Live checkpoint failed."
LocalLogList[LocalLogCount]="/p4/1/logs/checkpoint.log"
LocalLogCount+=1

msg "Checking for syntax and unbound errors in scripts used in this test."
for log in "${LocalLogList[@]}"; do
   msg "Checking for 'unbound variable' in: $log"
   grep ':unbound variable' "$log" && \
      errmsg "Found 'unbound variable' error in $log"
   msg "Checking for 'syntax error' in: $log"
   grep ':syntax error' "$log" && \
      errmsg "Found 'syntax error' in $log"
done

exit "$ErrorCount"
# Change User Description Committed
#2 31472 C. Thomas Tyler Updated bash scripts and bash template to new file versioning scheme.
Modernized template bash script.
#1 31399 C. Thomas Tyler Populate -r -S //p4-sdp/dev_c2s.
//p4-sdp/dev/test/bsw/test_script-recover_correct_ckp_1.sh
#1 31397 C. Thomas Tyler Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368.
//guest/perforce_software/sdp/dev/test/bsw/test_script-recover_correct_ckp_1.sh
#3 30628 C. Thomas Tyler Added version id to all tests.

Added check for 'syntax error' and 'unbound variable' to all logs
involved in all tests, local and remote.
#2 30626 C. Thomas Tyler Refined test harness logic and added more tests.
#1 30623 C. Thomas Tyler Added feature for scripted test to run addtional checks from an earlier
execution of a script.

Added more tests.
//guest/perforce_software/sdp/dev/test/bsw/test_1-recover_correct_ckp.sh
#1 30622 C. Thomas Tyler Added files for initial SDP BSW test suite.