#!/bin/bash #============================================================================== # Copyright and license info is available in the LICENSE file included with # the Component Based Development (CBD) project, and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-cbd/view/main/LICENSE declare Version=1.3.1 #------------------------------------------------------------------------------ # This wrapper to test_cbd.sh defines recommended flags for use with Vagrant # VM testing, and in general handles the vagaries of operatring in a # Vagrant VM environment. set -u function bail () { echo -e "\nError: ${1:-Unknown Error}\n"; exit ${2:-1}; } export CBD_HOME=/p4/common/bin/cbd export CBD_BRANCH=${CBD_BRANCH:-main} declare RunUser=perforce declare RunGroup=perforce declare RunHost=helix-01 declare SudoUser=vagrant declare TestSuiteCmd= declare CopyOfThisScript= declare ScriptDir=$(dirname $0) if [[ `id -u` = 0 || "`id -u -n`" == $SudoUser ]]; then CopyOfThisScript=/tmp/${0##*/} sudo cp -p $0 $CopyOfThisScript sudo chmod 740 $CopyOfThisScript sudo chown $RunUser:$RunGroup $CopyOfThisScript exec sudo su -l $RunUser -c "$CopyOfThisScript $*" elif [[ "`id -u -n`" != $RunUser ]]; then echo "$0 can only be run by root, $RunUser, or $SudoUser on host $RunHost." exit 1 fi if [[ ${HOSTNAME%%.*} != $RunHost ]]; then echo "$0 can only be run by root, $RunUser, or $SudoUser on host $RunHost." fi echo "Starting ${0##*/} v$Version as user $USER on ${HOSTNAME%%.*} at $(date)." chownCmd="sudo chown -R $RunUser:$RunGroup /depotdata /p4" echo "Running: $chownCmd" $chownCmd if [[ -d /p4 ]]; then if [[ -L /p4/common ]]; then echo "Verified: SDP /p4/common symlink exists." else echo "Making SDP symlink in /p4." cd /p4 linkCmd="sudo ln -s /depotdata/p4/common" echo "Running: $linkCmd" $linkCmd || bail "SDP symlink not created. Aborting." fi else bail "Expected /p4 directory does not exist. Aborting." fi cmd="yum install -q -y wget" echo "Running: $cmd" $cmd cd /tmp cmd="wget -q http://swarm.workshop.perforce.com/view/guest/perforce_software/cbd/$CBD_BRANCH/test/get_workshop_cbd.sh" echo "Running: $cmd" $cmd cmd="chmod +x get_workshop_cbd.sh" echo "Running: $cmd" $cmd cd - > /dev/null cmd="/tmp/get_workshop_cbd.sh -d $CBD_HOME -b $CBD_BRANCH -o -l" echo "Running: $cmd" $cmd ||\ bail "Failed to acquire CBD from The Workshop." TestSuiteCmd="$CBD_HOME/test/test_cbd.sh -I -S" echo -e "Running the Test Suite, executing:\n$TestSuiteCmd" $TestSuiteCmd || bail "Test Suite Failed." echo -e "SUCCESS: Test Suite Completed OK." exit 0
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 21706 | Sven Erik Knop |
Populate //cbd/main/... .... |