#!/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.2 #------------------------------------------------------------------------------ # 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 /hxdepots /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 /hxdepots/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 | |
---|---|---|---|---|---|
#15 | 21801 | C. Thomas Tyler | Tweaked to adapt to new SDP volume mount point structure. | ||
#14 | 19292 | C. Thomas Tyler |
Copy Up from dev to main. Released CBD/MultiArch/2016.1/19285 (2016/05/07). * Added 'Version' file and Release Notes. * Added test suite documentation. * Tweaks to CBD logging, back to using append mode. |
||
#13 | 16879 | C. Thomas Tyler | Consume CBD from main branch. | ||
#12 | 16875 | C. Thomas Tyler | Changed to consume SDP from dev branch by default. | ||
#11 | 16695 | C. Thomas Tyler | Added -l flag to get_worlshop_cbd.sh call. | ||
#10 | 16693 | C. Thomas Tyler | Added '-o' flag in call to get_workshop_cbd.sh. | ||
#9 | 16691 | C. Thomas Tyler | Refining mechanism to get CBD scripts. | ||
#8 | 16668 | C. Thomas Tyler | Fixed issue with missing script needed by Vagrant installer. | ||
#7 | 16664 | C. Thomas Tyler |
Refactored logic to pull CBD from the Workshop by calling the new get_workshop_cbd.sh script rather than using internal code. So auto_test_cbd_vagrant.sh once again pulls CBD, but does so using the new script. The test_cbd.sh script is no longer responsible for pulling CBD (though the capability could not easily be added if needed). Added '-p bin/cbd' call to the Helix Installer SDP reset script, to preserve the installed CBD directory. Minor copyright tweaks too. |
||
#6 | 16653 | C. Thomas Tyler |
Adjusted CBD Test Suite to work with latest Helix Installer script (and the SDP installer). Moved logic to acquire CBD scripts from The Workshop, from the auto_test_cbd_vagrant.sh script into test_cbd.sh, where it is more accessible (and where it must be now that the latest Helix Installer blasts the CBD files and the rest of the SDP structure). Enhanced logic acquring CBD to clone using remote specs (DVCS features) rather than a flush/clean in a typical workspace. Added '-b <branch>' flag to test_cbd.sh to specify which branch in The Workshop to acquire CBD from. |
||
#5 | 15346 | C. Thomas Tyler | Accounted for 'p4 clean' being a path-relative command. | ||
#4 | 15287 | C. Thomas Tyler | Replaced sync -f with flush and clean. | ||
#3 | 15239 | C. Thomas Tyler | Changed default branch for the test suite to main. | ||
#2 | 15022 | C. Thomas Tyler |
Copy-Up to main from ntx64: * Fixed Cbd.py issue with an exception handling bug for Host field. * Rebased CbdDev.py to Cbd.py * Simplified test operations. * Fixed a cosmetic typo in test doc/data. |
||
#1 | 15009 | C. Thomas Tyler | Promoted CBD development work to main from dev. | ||
//guest/perforce_software/cbd/dev/test/auto_test_cbd_vagrant.sh | |||||
#10 | 15006 | C. Thomas Tyler | Reversed rsync args. | ||
#9 | 15004 | C. Thomas Tyler | Tweaked. | ||
#8 | 15003 | C. Thomas Tyler | Sudo indirection correction. | ||
#7 | 15002 | C. Thomas Tyler | Tweaked restart script. | ||
#6 | 15001 | C. Thomas Tyler | Resolved a chicken-and-egg problem. | ||
#5 | 14998 | C. Thomas Tyler | Added some sudo calls. | ||
#4 | 14991 | C. Thomas Tyler | General VM envrionment testing improvements. | ||
#3 | 14959 | C. Thomas Tyler |
Implemented '-S' and configured to work existing SDP, as set up by the Helix SDP Installer. Work in progress. |
||
#2 | 14937 | C. Thomas Tyler |
Incorporated symlink trick used in manual test environment for use with Vagrant test environment. |
||
#1 | 14928 | C. Thomas Tyler | Tweakes to Vagrant test flow. |