test_script-refresh_P4ROOT_from_offline_db_1.sh #1

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

declare ThisScript="${0##*/}"
declare Version=1.0.2
declare -i ErrorCount=0
declare -i Debug=${SDP_DEBUG:-0}
declare LinkTarget=

function msg () { echo -e "$*"; }
# shellcheck disable=SC2317
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 v$Version]: Load checkpoint man page."

# shellcheck disable=SC1091
source /p4/common/bin/p4_vars 1 ||\
   bail "Could not do: source /p4/common/bin/p4_vars 1"

LinkTarget=$(readlink "${P4ROOT}")
if [[ "$LinkTarget" == *db1 ]]; then
   msg "Verified: Pre-swap P4ROOT symlink points to db1."
else
   bail "Pre-swap P4ROOT does NOT point to db1. Aborting this test due to unexpected pre-start conditions."
fi

LinkTarget=$(readlink "${P4ROOT%/root}/offline_db")
if [[ "$LinkTarget" == *db2 ]]; then
   msg "Verified: Pre-swap offline_db symlink points to db2."
else
   bail "Pre-swap offline_db symlink does NOT point to db2. Aborting this test due to unexpected pre-start conditions."
fi

msg "Running: refresh_P4ROOT_from_offline_db.sh"
refresh_P4ROOT_from_offline_db.sh ||\
   errmsg "refresh_P4ROOT_from_offline_db.sh reported non-zero exit code in test expecting 0 exit code."

LinkTarget=$(readlink "${P4ROOT}")
if [[ "$LinkTarget" == *db2 ]]; then
   msg "Verified: Post-swap P4ROOT symlink points to db2."
else
   errmsg "Post-swap P4ROOT does NOT point to db2."
fi

LinkTarget=$(readlink "${P4ROOT%/root}/offline_db")
if [[ "$LinkTarget" == *db1 ]]; then
   msg "Verified: Post-swap offline_db symlink points to db1."
else
   bail "Post-swap offline_db symlink does NOT point to db1."
fi

exit "$ErrorCount"
# Change User Description Committed
#1 33565 Claude (AI Agent by Anthropic) Initial population of r26.1.0 from main.
//p4-sdp/main/test/bsw/test_script-refresh_P4ROOT_from_offline_db_1.sh
#1 33433 Claude (AI Agent by Anthropic) Copy Up from //p4-sdp/dev into //p4-sdp/main.

This is the first-ever population of main under the new Streams-based
depot structure -- main has held zero files/history until now, since no
release has ever gone through this process before. 463 files, covering
the entire 2026.1 cycle: rebranding (SDP-1379), Secure By Default
(SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword version
identification (SDP-1161/SDP-799), the Streams-native release process
redesign itself (Task 5), the opt_perforce_sdp_backup.sh false-error fix,
the P4D 2026.1 test-suite targeting, refreshed P4*.json files, and the
fixed-main-URL/isolate-downloads tarball design -- everything accumulated
in dev's history to date. Isolated paths (ai_dev_support/, Version,
doc/*.html, doc/*.pdf, doc/gen/*.man.txt, doc/gen/sdp_install.cfg,
Unsupported/doc/*.html, Unsupported/doc/*.pdf, downloads/) correctly did
not come along -- each stream maintains those independently by design.

Per the Merge Down/Copy Up flow (Step 9 confirmed clean, nothing to
merge), this is an unconditional, all-or-nothing copy of dev's content --
this is the first Streams-based SDP release, being rehearsed step by step
per the release process doc.

Agent: Claude Code, Model: Claude Sonnet 5 (claude-sonnet-5), operating as bot_Claude_Anthropic.
//p4-sdp/dev/test/bsw/test_script-refresh_P4ROOT_from_offline_db_1.sh
#1 31997 C. Thomas Tyler p4 merge -b SDP_Classic_to_Streams && p4 resolve -as && p4 submit
//guest/perforce_software/sdp/dev/test/bsw/test_script-refresh_P4ROOT_from_offline_db_1.sh
#2 31985 C. Thomas Tyler Shellcheck tweaks.
#1 31984 C. Thomas Tyler Added test for refresh_P4ROOT_from_offline_db.sh basic functionality.