#!/bin/bash #------------------------------------------------------------------------------ set -u function msg () { echo -e "$*"; } function errmsg () { msg "\\nError: ${1-Unknown Error}\\n"; ErrorCount+=1; } function bail () { errmsg "${1-Unknown Error}"; exit "${2:-1}"; } declare TmpFile= declare -i ErrorCount=0 TmpFile=$(mktemp) cd /hxdepots/reset || bail "Could not cd to: /hxdepots/reset" if [[ -r reset_sdp.sh.txt ]]; then mv reset_sdp.sh.txt reset_sdp.sh chmod +x reset_sdp.sh fi ./reset_sdp.sh -C > settings.cfg.orig sed -e "s:^OSUSER=.*:OSUSER=cooldude:g" \ -e "s:^OSUSER_HOME=.*:OSUSER_HOME=/home/cooldude:g" \ -e "s:^OSGROUP=.*:OSGROUP=heroes:g" \ -e "s:^P4USER=.*:P4USER=superman:g" \ -e "s:^Instance=.*:Instance=fgs:g" \ settings.cfg.orig > settings.cfg ./reset_sdp.sh -c settings.cfg -fast -no_ssl -no_sd -no_ppr 2>&1 | tee log.reset_sdp.test_settings.txt msg "Checking that OS user cooldude got created, doing: id -u cooldude" if id -u cooldude; then msg "Verified: OS User cooldude exists." else errmsg "Error: OS User cooldude does NOT exist." fi msg "Doing 'p4 set -q P4USER' as OSUSER cooldude." if su - cooldude -c "/p4/common/bin/p4master_run fgs p4 set -q P4USER" > "$TmpFile"; then msg "Checking P4USER value by OSUSER cooldude worked." else errmsg "Checking P4USER value by OSUSER cooldude failed." fi msg "Checking that 'p4 set -q P4USER' output shows value superman." if grep -q superman "$TmpFile"; then msg "Verified: P4USER superman is configured." else errmsg "Error: P4USER superman is NOT configured." fi msg "Checking crontab of OSUSER cooldude." if su - cooldude -c "crontab -l" > "$TmpFile"; then msg "Crontab command 'crontab -l' executed OK." else errmsg "Failed to run command 'crontab -l'." fi msg "Checking that 'crontab -l' output contains p4master_run." if grep -q p4master_run "$TmpFile"; then msg "Verified: crontabl -l contains expected output." else errmsg "The crontab does not contain expected output." fi exit "$ErrorCount"
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#7 | 27288 | C. Thomas Tyler | Removed old Vagrant Test suite. | ||
#6 | 26964 | C. Thomas Tyler | Fixed broken test. | ||
#5 | 26892 | C. Thomas Tyler | Added test for now crontab functionality. | ||
#4 | 26771 | C. Thomas Tyler | Fixed typo. | ||
#3 | 26027 | C. Thomas Tyler | Tweaked test suite to also change OSUSER_HOME dir. | ||
#2 | 26026 | C. Thomas Tyler | Test suite refinements. | ||
#1 | 26021 | C. Thomas Tyler |
Test suite enhancements to better test Configured mode with settings.cfg. |