#!/bin/bash set -u set -e # Usage: # ./run_tests.sh 2>&1 | tee log.run_tests.txt THISSCRIPT=${0##*/} VERSION=1.2.2 function bail () { echo -e "\nError: ${1:-Unknown Error}"; exit ${2:-1}; } H="==============================================================================" TEST_HOME=${TEST_HOME:-Undefined} if [[ $TEST_HOME == Undefined ]]; then cd .. || bail source ./env.sh || bail "Error finding or loading shell environment file." fi [[ $P4ROOT != $TEST_HOME/.p4root ]] && bail "Invalid P4ROOT [$P4ROOT]." echo "Resetting P4ROOT." /bin/rm -rf "$P4ROOT" /bin/mkdir "$P4ROOT" echo -e "Triggers:\n\tJobName form-in job \"$APP_HOME/src/job-new.sh %formfile%\"\n\n" | p4 triggers -i scriptVer=$(grep VERSION= $TEST_HOME/../src/job-new.sh|cut -d '=' -f 2) echo -e "$THISSCRIPT v$VERSION testing job-new.sh v$scriptVer\n$(ls -l $TEST_HOME/../src/job-new.sh)\n" echo TEST_HOME=$TEST_HOME export P4CONFIG=${P4CONFIG:-Undefined} [[ "$P4CONFIG" != *.p4config.test ]] && bail "Bad P4CONFIG setting." echo "Test Environment Info:" for p4Cmd in "set" "-s info -s" "login -s" "triggers -o"; do p4 $p4Cmd ||: done echo Remove any jobs from the test server. for job in $(p4 -ztag -F %Job% jobs); do p4 job -d $job ||: done echo "Running 9 tests (Pass 1)" for f in 1 2 3 4 5 6 7 8 9; do testFile=$TEST_DATA/test-$f.job job=$(grep ^Job: $testFile ||:) job=${job#Job:} job=$(echo $job) echo -e "\n${H}\nProcessing test file [$testFile] with job [$job]." cp -p -f $testFile foo.txt ||: #$TEST_HOME/../src/job-new.sh foo.txt cat foo.txt p4 job -i < foo.txt ||: done echo "Running 5 tests (Pass 2)" for f in 3 4 5 6 7; do testFile=$TEST_DATA/test-$f.job job=$(grep ^Job: $testFile ||:) job=${job#Job:} job=$(echo $job) echo -e "${H}\nRe-Processing test file [$testFile] with job [$job]." cp -p -f $testFile foo.txt ||: #$TEST_HOME/../src/job-new.sh foo.txt cat foo.txt p4 job -i < foo.txt ||: done echo "Running 3 tests (Pass 3)" for f in 5 6 7; do testFile=$TEST_DATA/test-$f.job job=$(grep ^Job: $testFile ||:) job=${job#Job:} job=$(echo $job) echo -e "${H}\nRe-Re-Processing test file [$testFile] with job [$job]." cp -p -f $testFile foo.txt ||: #$TEST_HOME/../src/job-new.sh foo.txt cat foo.txt p4 job -i < foo.txt ||: done /bin/rm -f foo.txt
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#4 | 12555 | C. Thomas Tyler |
Test suite improvements: * Test cases now describe expected results. * Removed junk files (log and foo.txt). * Removed 'p4s' utility script, made obsolete by using the P4PORT 'rsh hack' for the test suite. * URLs for wget recommendations updated to refer to 2015.1. * Enhanced run_tests.sh to fix ugly output to make test verification more readable. |
||
#3 | 12539 | C. Thomas Tyler |
Implemened features to transform job-new.sh into a general purpose job name validation script, in addition to the original mission of incrementing '-new' features, per requirements from Thomas Gray. Updated test suite accordingly. Also simplified the test suite, which now uses the P4PORT 'rsh hack' to avoid needing to fire up a test server. #review-12540 @thomas_gray @lester_cheung |
||
#2 | 12094 | C. Thomas Tyler |
Added version tags to job-new.sh and run-tests.sh. Removed debug statements from job-new.sh. Updated .p4ignore to avoid adding log file. Updated test suite to run multi-pass test. Added APP_DATA setting to env.sh. |
||
#1 | 12093 | C. Thomas Tyler | Added job-new.sh and friends. |