hi_test_settings.sh #3

  • //
  • guest/
  • perforce_software/
  • helix-installer/
  • main/
  • test/
  • hi_test_settings.sh
  • View
  • Commits
  • Open Download .zip Download (2 KB)
#!/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 P4AdminList."
if grep -q P4AdminList "$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
#4 27427 C. Thomas Tyler Released SDP 2021.2.27425 (2021/02/09).
Copy Up using 'p4 copy -r -b perforce_software-helix-installer-dev'.
#3 26975 C. Thomas Tyler Released HelixInstaller 2020.2.26973 (2020/12/01).
#2 26793 C. Thomas Tyler Released HelixInstaller/MultiArch/2020.1/26784 (2020/09/25).
#1 26031 C. Thomas Tyler Released Helix Installer 2019.4.26026 (2019/08/22).
//guest/perforce_software/helix-installer/dev/test/hi_test_settings.sh
#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.