#!/bin/bash # This is a tool for manual testing. # Similar code is included in test_cbd.sh for automated testing. set -u #------------------------------------------------------------------------------ # This code simulates what test_cbdd.sh does. It should NOT be copy/pasted # into test_cbd.sh. declare CfgFile=test_cbd.$(hostname -s).cfg source $CfgFile || { echo BAILING; exit 1; } declare p4Exe=$SampleDepotHome/p4 declare p4dExe=$SampleDepotHome/p4d declare p4brokerExe=$SampleDepotHome/p4broker declare p4="$p4Exe -p $SampleDepotBrokerPort" declare p4c="$p4 -u bruno -c $TestWS" #------------------------------------------------------------------------------ # This following sample code may be copy/pasted in whole or in part into # test_cbd.sh declare P4TestCmd= declare ExpectedExit= declare -i ExpectedExitCode declare ExpectedString= declare Comments= declare CLITestDataOK=1 declare CLITestDataFile=cli_tests.txt declare User= declare Workspace= declare -i Line=0 declare -i OverallReturnStatus=0 while read entry; do Line=$((Line+1)) [[ -z "$(echo $entry)" ]] && continue [[ $entry == "#"* ]] && continue P4TestCmd=${entry%%|*} ExpectedExit=${entry#*|} ExpectedExit=${ExpectedExit%%|*} ExpectedString=${entry%|*} ExpectedString=${ExpectedString##*|} Comments=${entry##*|} if [[ $P4TestCmd == "p4 "* ]]; then P4TestCmd=${P4TestCmd/p4 /$p4c } elif [[ $P4TestCmd == "p4:"* ]]; then # Parse entries like: "p4:user:client command args ..." User=${P4TestCmd#p4:} User=${User%%:*} Workspace=${P4TestCmd#p4:} Workspace=${Workspace#*:} Workspace=${Workspace%% *} P4TestCmd=${P4TestCmd/p4:$User:$Workspace /$p4 -u $User -c $Workspace } else echo -e "Warning: Entry on line $Line of $CLITestDataFile has a bogus 'p4' command. Must start with 'p4 '. Skipping this test." CLITestDataOK=0 continue fi if [[ $ExpectedExit == U ]]; then ExpectedExit=Undefined else if [[ $ExpectedExit =~ [0-9]+ ]]; then ExpectedExitCode=$ExpectedExit else echo -e "Warning: Entry on line $Line of $CLITestDataFile has a bogus exit code. Must be numeric or 'U', value is $ExpectedExit. Skipping this test." CLITestDataOK=0 continue fi fi echo "C:[$P4TestCmd] E:[$ExpectedExit] S:[$ExpectedString] Comments: $Comments" done < $CLITestDataFile if [[ $CLITestDataOK -eq 1 ]]; then echo -e "\nVerified: All test entries are OK.\n" else echo -e "\nWarning: Some tests were skipped due to invalid entries in $CLITestDataFile.\n" OverallReturnStatus=1 fi echo -e "That took about $(($SECONDS/3600)) hours $(($SECONDS%3600/60)) minutes $(($SECONDS%60)) seconds.\n" # See the terminate() function, which is really where this script exits. exit $OverallReturnStatus
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#5 | 15274 | C. Thomas Tyler |
Merge Down of cbd to dev from main using: p4 merge -b perforce_software-cbd-dev |
||
#4 | 15178 | C. Thomas Tyler |
Routine Merge Down to dev from main for CBD using: p4 merge -b perforce_software-cbd-dev |
||
#3 | 14981 | C. Thomas Tyler |
Enhanced broker input simulation testing to account for testing with SDP, by parameterizing previously hard-coded test data fields. |
||
#2 | 14844 | C. Thomas Tyler |
Overhauled regression test suite. Added various command line tests. Enhanced test suite to allow entries in the test data file to specify alternate user and workspaces (differing from defaults defined in the test test configuration files, test_cbd.*.cfg) for certain tests. Added new testing method, broker input testing, to augment existing command line testing. This test method simulates having 'p4d' call the CBD broker sync script by feeding handcrafted/simulated broker input files to the CBD engine, simulating the way p4d uses stdin to feed the broker parameters when a user makes a request. This enables more diverse testing and better simulation of Window and P4V-side testing. |
||
#1 | 14199 | C. Thomas Tyler | Added test suite. |