#!/bin/bash # Run the Docker tests for the SDP # Note that this file is expecting to be mapped into the root of the workspace # and with the sdp directory in the same root. # So workspace view should look something like: # View: # //guest/perforce_software/sdp/main/... //myws.sdp/sdp/... # Perforce version being tested P4VER=18.2 SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )" oses="" # Allow the specific platform to be specified via parameter if [ ,"$1" = ,"ubuntu" ] ; then oses="ubuntu" elif [ ,"$1" = ,"centos" ] ; then oses="centos6" elif [ ,"$1" = ,"centos6" ] ; then oses="centos6" elif [ ,"$1" = ,"centos7" ] ; then oses="centos7" else oses="ubuntu centos6 centos7" fi # Directory where test output is put by the container # Easier to make it under sdp which is a mounted volume test_output_dir="$SCRIPT_DIR/output" [[ -d "$test_output_dir" ]] || mkdir "$test_output_dir" all_test_output="$test_output_dir/alltests.out" if [ -f $all_test_output ] ; then rm $all_test_output fi # Make sure that p4 binaries are present and correct origdir=`pwd` cd $SCRIPT_DIR/../Server/Unix/p4/common/bin for exe in p4 p4d p4broker; do if [ ! -f $exe ]; then wget -nv ftp.perforce.com/perforce/r$P4VER/bin.linux26x86_64/$exe chmod +x $exe fi done cd $origdir echo Running SDP tests tests_failed=0 for os in $oses do test_output="$test_output_dir/test-${os}.out" if [[ -f $test_output ]]; then rm $test_output fi docker_dir=$SCRIPT_DIR/docker dockerfile_base=${docker_dir}/Dockerfile.${os}.base dockerfile_sdp=${docker_dir}/Dockerfile.${os}.sdp # Build the base Docker for the OS, and then the SDP variant on top docker build --rm=true -t=perforce/${os}-base -f ${dockerfile_base} ${docker_dir} # Note that by docker build --rm=true -t=perforce/${os}-sdp -f ${dockerfile_sdp} ${docker_dir} # Run the Docker image, mounting the /sdp directory within it. The SDP image # has a default RUN command which is configured within it. # We don't directly stop on error but process a little later below so that nice # messages are written to Jenkins console outut. set +e docker run --rm -v ${origdir}/sdp:/sdp -e TESTOS=${os} ${os}-sdp echo "docker run --rm -v ${origdir}/sdp:/sdp -e TESTOS=${os} ${os}-sdp" docker run --rm -v ${origdir}/sdp:/sdp -e TESTOS=${os} ${os}-sdp docker run --rm -v $SCRIPT_DIR/../../sdp:/sdp -e TESTOS=${os} perforce/${os}-sdp tests_failed=$? set -e echo $os>> $all_test_output # Avoid Jenkins immediately failing job without letting us cat the output set +e cat $test_output>> $all_test_output set -e if [ $tests_failed -ne 0 ]; then break fi done cat $all_test_output exit $tests_failed
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#8 | 25116 | Robert Cowham | Docker compose tests starting to get there... | ||
#7 | 25113 | Robert Cowham | Merge latest changes from dev | ||
#6 | 22507 | Robert Cowham | Refactor | ||
#5 | 22485 | Robert Cowham |
Update python to 3.5 Refactor tests to simplify workspace (no mapping into root), and to allow easy setup |
||
#4 | 22477 | Robert Cowham | Bring latest dev changes into test | ||
#3 | 22142 | Robert Cowham | Merge in latest changes from Dev | ||
#2 | 20727 | Robert Cowham |
Initial playbook to run tests. ansible-playbook sdp/test/playbooks/main.yaml |
||
#1 | 20726 | Robert Cowham | Catch up from dev | ||
//guest/perforce_software/sdp/dev/test/run_docker_tests.sh | |||||
#6 | 19407 | Russell C. Jackson (Rusty) | Updated p4 version to 16.1 | ||
#5 | 19367 | Robert Cowham | Improve error handling for Jenkinsß | ||
#4 | 19366 | Robert Cowham | Improve error messages hopefully when run by Jenkins | ||
#3 | 19099 | Robert Cowham | Minor refactor to make things a little clearer as to test file location. | ||
#2 | 19045 | Robert Cowham |
Add docker file for Centos7 Refactor to move common stuff to a shell script. |
||
#1 | 19019 | Robert Cowham | Run ubuntu |