#!/usr/local/bin/ruby # # Copyright 2005 Perforce Software. All rights reserved. # require "../../cur.triggers/P4Data.rb" require "../../cur.triggers/P4Form.rb" failures = 0 if ischangelist("1") then # SKIP INIITIALIZATION printf "System currently populated with test data\n" else printf "Populating system with test data\n" `(cd ../..; sh p4user.setup karen)` # Add user `sh newjob.sh` # Create job000001 `sh newjob.sh` # Create job000002 `sh newjob.sh` # Create job000003 `sh changelist.sh one` # Create 1 `sh changelist.sh two` # Create 2 `sh changelist.sh three` # Create 3 `sh changelist.sh four` # Create 4 end for n in 1..3 do jobid = "job00000#{n}" `p4 job -o #{jobid} | sed -e 's/ / /g' | sed -e 's=..../../.. ..:..:..=yyyy/mm/dd hh:mm:ss=' | awk '/^[^#]/ { print $0; }' > fixes.#{n}.pre-post` print `p4 fix -c #{n} #{jobid}` if n == 3 then print `p4 fix -c 4 #{jobid}` end `p4 job -o #{jobid} | sed -e 's/ / /g' | sed -e 's=..../../.. ..:..:..=yyyy/mm/dd hh:mm:ss=' | awk '/^[^#]/ { print $0; }' >> fixes.#{n}.pre-post` cmd=`diff fixes.#{n}.pre-post fixes.#{n}.exp`.chomp printf("Checking %s:", jobid) if cmd == nil || cmd.strip == "" then printf(" passed\n") File.unlink("fixes.#{n}.pre-post") else printf(" FAILED\n%s\n", cmd) failures += 1 end end for n in 1..3 do jobid = "job00000#{n}" print `p4 fix -d -c #{n} #{jobid}` if n == 3 then print `p4 fix -d -c 4 #{jobid}` end `p4 job -o #{jobid} | sed -e 's/ / /g' | sed -e 's=..../../.. ..:..:..=yyyy/mm/dd hh:mm:ss=' | awk '/^[^#]/ { print $0; }' >> fixes.#{n}.pre-post` cmd=`diff fixes.#{n}.pre-post fixes.#{n}.exp2`.chomp printf("Checking %s:", jobid) if cmd == nil || cmd.strip == "" then printf(" passed\n") File.unlink("fixes.#{n}.pre-post") else printf(" FAILED\n%s\n", cmd) failures += 1 end end printf "\n" if failures > 0 then printf "ALL TESTS DID NOT PASS: %d failed\n", failures exit 1 else printf "All tests PASSED\n" exit 0 end