scripted_test_5.sh #1

  • //
  • cbd/
  • main/
  • test/
  • shared/
  • scripted_test_5.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/bin/bash
set -u

function msg () { echo -e "$*"; }
function cmd () { echo -e "Executing: $*"; $*; return $?; }
function bail () { echo -e "\nError: ${1:-Unkown Error}\n"; exit ${2:-1}; }

export TestID=${1:-1}
export P4BIN=${2:-p4}
export P4PORT=${3:-1666}
export P4USER=${4:-bruno}
export P4CLIENT=TestWS.$TestID
export P4CONFIG=/tmp/.p4config.$TestID
declare -i ExitCode=0
declare TmpFile=/tmp/tmpFile.$TestID.$$.$RANDOM
declare RootDir=/tmp/$P4CLIENT
declare SSTFile=DeepThought-Components.cbdsst
declare MainlineStream=//DeepThought/Components/main
declare DevStream=//DeepThought/Components/dev

echo -e "Running Test $TestID\n$0 $*\n"

/bin/rm -f "$P4CONFIG"
echo -e "P4PORT=$P4PORT\nP4USER=$P4USER\nP4CLIENT=$P4CLIENT\nP4IGNORE=.p4ignore\nP4TICKETS=$PWD/.p4tickets\nP4ENVIRO=$PWD/.p4enviro\nP4TRUST=$PWD/.p4trust" > $P4CONFIG
echo -e "Wrote this P4CONFIG file $P4CONFIG:\n$(cat $P4CONFIG)"

msg "Creating development stream $DevStream."
$P4BIN stream -t development -P $MainlineStream -o $DevStream | grep -v '^#' > $TmpFile

msg "Loading this stream spec:\n$(cat $TmpFile)\n"

$P4BIN -s stream -i < $TmpFile || bail "Failed to create stream $DevStream."

echo -e "Client: $P4CLIENT\n\nOwner: bruno\n\nRoot: $RootDir\n\nStream: $DevStream\n\n" > $TmpFile
$P4BIN -s client -i < $TmpFile || bail "Failed to create workspace [$P4CLIENT]."

$P4BIN -s populate -r -S $DevStream

cmd $P4BIN -s -c $P4CLIENT sync -q
ExitCode=$?

cd $RootDir || bail "Could not cd to workspace $P4CLIENT root dir $RootDir."

# The exit code is for the 'p4 sync' command; that's what matters for this test.
exit $ExitCode
# Change User Description Committed
#1 21633 C. Thomas Tyler Populate -o //guest/perforce_software/cbd/main/...
//cbd/main/....
//guest/perforce_software/cbd/main/test/shared/scripted_test_5.sh
#1 19351 C. Thomas Tyler Released CBD/MultiArch/2016.2/19348 (2016/05/10).
Copy Up using 'p4 copy -r -b perforce_software-cbd-dev'.
//guest/perforce_software/cbd/dev/test/shared/scripted_test_5.sh
#1 19348 C. Thomas Tyler Added test for sync in depot with StreamDepth > 1.