test_sdp.sh #1

  • //
  • p4-sdp/
  • r26.1.0.BETA/
  • test/
  • docker/
  • files/
  • test_sdp.sh
  • View
  • Commits
  • Open Download .zip Download (3 KB)
#!/bin/bash
# Tests the SDP - basic tests

#------------------------------------------------------------------------------
# Version ID Block. Relies on +k filetype modifier.
# VersionID='$Id: //p4-sdp/r26.1.0.BETA/test/docker/files/test_sdp.sh#1 $ $Change: 33444 $'

declare -i ExitCode=0

/p4/reset_sdp.sh
sudo ln -f -s /sdp/Server/test/test_SDP.py /p4/test_SDP.py
sudo ln -f -s /sdp/Server/test/test_Upgrade.py /p4/test_Upgrade.py

# Use the virtual environment created by the SDP build process to run the test scripts.
. "$HOME/.venv/bin/activate"

if ! python3 /p4/test_SDP.py --version 25.2; then
   tail /tmp/SDPTest.log
   exit 1
fi

if ! python3 /p4/test_Upgrade.py; then
   tail /tmp/UpgradeSDPTest.log
   exit 1
fi

#------------------------------------------------------------------------------
# To test extraction of custom logic during SDP upgrade, inject some custom
# logic pre-upgrade. Later, we'll test both the extraction and the post-
# extraction shell environment load order.
echo -e "### MAKE LOCAL CHANGES HERE\\nexport TEST_MESSAGE=Life\\n" >> /p4/common/bin/p4_vars
echo -e "### MAKE LOCAL CHANGES HERE\\nexport TEST_MESSAGE+=\" is Good\"\\n" >> /p4/common/config/p4_1.vars
echo -e "export DO_PARALLEL_CHECKPOINTS=6" >> /p4/common/config/p4_1.vars

#------------------------------------------------------------------------------
# Test SDP Upgrade
# This steps are pulled from the 'Upgrading the SDP' section of the SDP
# Guide.
echo Testing the SDP Upgrade Procedure
cd /p4depots
[[ -d downloads ]] || mkdir downloads
cd downloads
[[ -d new ]] && mv new old.$(date +'%Y%m%d-%H%M')
[[ -e sdp.Unix.tgz ]] && mv sdp.Unix.tgz sdp.Unix.old.$(date +'%Y%m%d-%H%M%S')
curl -s -O https://workshop.perforce.com/download/p4-sdp/main/downloads/sdp.Unix.tgz
mkdir new
cd new
tar -xzf ../sdp.Unix.tgz
rsync -a /p4depots/sdp/ /p4depots/downloads/new/sdp
cd /p4depots/downloads/new/sdp/Server/Unix/p4/common/sdp_upgrade

if ./sdp_upgrade.sh -y > /tmp/sdp_upgrade.log 2>&1; then
   echo SDP Upgrade OK.
else
   echo SDP Upgrade FAILED.
   tail /tmp/sdp_upgrade.log
   exit 1
fi

#------------------------------------------------------------------------------
# Call verify_sdp.sh after the SDP upgrade.
echo Calling verify_sdp.sh after the SDP Upgrade.
if /p4/common/bin/verify_sdp.sh 1 > /tmp/post_upgrade_verify.log 2>&1; then
   echo SDP Post-Upgrade Verify Completed OK.
else
   echo SDP Post-Upgrade Verify FAILED.
   tail /tmp/post_upgrade_verify.log
   exit 1
fi

#------------------------------------------------------------------------------
# Test extraction of custom logic after SDP upgrade.

for c in p4_vars.local p4_1.vars.local; do
   if [[ -r "/p4/common/site/config/$c" ]]; then
      echo "Found expected post-upgrade extracted file: $c"
   else
      echo "FAILED: Missing expected post-upgrade extracted file: $c"
      ExitCode=1
   fi
done

source /p4/common/bin/p4_vars 1
Output=$(echo $TEST_MESSAGE)

if [[ "$Output" == *"Life is Good"* ]]; then
   echo "Post-upgrade Test Message is as expected: $Output"
else
   echo "FAILED: Post-upgrade Test Message is not as expected: $Output"
   ExitCode=1
fi

exit "$ExitCode"
# Change User Description Committed
#1 33444 Claude (AI Agent by Anthropic) Initial population of r26.1.0.BETA from main.
//p4-sdp/main/test/docker/files/test_sdp.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/docker/files/test_sdp.sh
#5 33409 Claude (AI Agent by Anthropic) Copy Up from //p4-sdp/dev_rebrand into //p4-sdp/dev.

This is the first promotion of dev_rebrand's work into dev since
dev_rebrand was created (2025-05-24) -- 303 files, covering the entire
2026.1 rebranding effort (SDP-1379), the Secure By Default adaptation
(SDP-1350), OrgName-aware auth.id/ServerID (SDP-1286), RCS-keyword
version identification (SDP-1161/SDP-799), and the Streams-native release
process redesign (Task 5) done this session, plus everything else
accumulated in dev_rebrand's history before this session.

Per the Merge Down/Copy Up flow, this is intentionally a full,
unconditional blast-replace of dev's content from dev_rebrand -- all
selectivity/care happened in the preceding Merge Down (dev -> dev_rebrand,
changes 33407-33408), which absorbed Robert Cowham's independent dev-side
work first so nothing of his is lost by this Copy Up.

Two files are worth calling out since they might look alarming in
isolation:
- tools/mdcu.sh is deleted -- intentional, retired this session in favor
  of the two direct Streams commands now documented in
  doc/ReleaseProcessOverview.md.
- tools/ReleaseProcessOverview.md is deleted -- this is a stale relic of
  a file move dev_rebrand made back in 2025-05-24 (tools/ -> doc/) that
  was never previously propagated to dev; the current, fully-rewritten
  doc/ReleaseProcessOverview.md is added/updated correctly by this same
  changelist.
#4 33269 Robert Cowham Fix tests in dev
#3 32480 C. Thomas Tyler Routine merge for SDP from Classic to Streams, done with:

p4 merge -b SDP_Classic_to_Streams
p4 resolve -as

  The automatic-safe resolve handled all files; neither '-am' nor interative resolves were needed.
#2 31574 C. Thomas Tyler Merged SDP 2024.2 Patch 4 from Classic to Streams.
p4 merge -b SDP_Classic_to_Streams
#1 31397 C. Thomas Tyler Populate -b SDP_Classic_to_Streams -s //guest/perforce_software/sdp/...@31368.
//guest/perforce_software/sdp/dev/test/docker/files/test_sdp.sh
#8 31034 C. Thomas Tyler Added version parameter.
#7 29594 C. Thomas Tyler Adjusted test for r23.1 multifile parallel checkpoint.
#6 28850 C. Thomas Tyler Test suite tweaks:
* Added command line usage notes in scripts.
* Enhanced comand line processing.
* Added aliases for building on Rocky Linux 8.

#review-28851
#5 28377 C. Thomas Tyler Added test for correct extraction of custom logic during SDP ugprade.
This test also ensure correct load order for the shell environment.

#review-28378
#4 28252 C. Thomas Tyler Enahced test suite: verify_sdp.sh runs after testing sdp_ugprade.sh.
#3 28232 C. Thomas Tyler Added test for sdp_upgrade.sh.
#2 25554 Robert Cowham Automated tests for calling upgrade.sh
#1 25258 Robert Cowham Rework the containers in preparation for multi container testing
mkrep changes:
Remove -c cfg option which was unused anyway
Converted tabs to spaces
Fixed logic error causing forwarding replicas to bail due to unsupported p4d version
Standby servers require ReplicatingFrom field
Add seconds to log file name (useful for testing to avoid overwriting files)