#!/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"
`sh changelist.sh one` # Create changelist 1
`sh changelist.sh two` # Create changelist 2
`sh changelist.sh three` # Create changelist 3
`sh newjob.sh` # Create job000001
`p4 jobspec -i < jobspec.txt` # Define the jobspec
`p4 job -i < goodjob.txt` # Create job000002
`p4 job -i < goodjob.txt` # Create job000003
`p4 job -i < goodjob.txt` # Create job000004
`p4 job -i < goodjob.txt` # Create job000005
`p4 job -i < goodjob.txt` # Create job000006
end
cmd = `p4 job -i < badjob-1.txt 2>&1`.chomp
if cmd =~ /^Error in job specification/ &&
cmd =~ /Tchangelist/ &&
cmd =~ /Tdepotpath/ &&
cmd =~ /Tfilepath/ &&
cmd =~ /Tjobid/ &&
cmd =~ /Tlistchangelist/ &&
cmd =~ /Tlistdepotpath/ &&
cmd =~ /Tlistfilepath/ &&
cmd =~ /Tlistjobid/ &&
cmd =~ /Tlistuserid/ &&
cmd =~ /Tuserid/ then
printf("badjob-1 passed\n")
else
printf("FAILED: badjob-1: [%s]\n", cmd)
failures += 1
end
cmd = `p4 job -i < badjob-2.txt 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("badjob-2 passed\n")
else
printf("FAILED: badjob-2: [%s]\n", cmd)
failures += 1
end
cmd = `p4 job -i < badjob-3.txt 2>&1`.chomp
if cmd =~ /^Error in job specification/ &&
cmd =~ /Status cannot be initialized as duplicate/ then
printf("badjob-3 passed\n")
else
printf("FAILED: badjob-3: [%s]\n", cmd)
failures += 1
end
cmd = `p4 job -i < badjob-4.txt 2>&1`.chomp
if cmd =~ /^Error in job specification/ &&
cmd =~ /DuplicateOf cannot be defined for non-duplicate/ then
printf("badjob-4 passed\n")
else
printf("FAILED: badjob-4: [%s]\n", cmd)
failures += 1
end
cmd = `p4 job -i < badjob-5.txt 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("FAILED: badjob-5: [%s]\n", cmd)
failures += 1
else
printf("badjob-5 passed\n")
end
cmd = `p4 job -i < badjob-6.txt 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("badjob-6 passed\n")
else
printf("FAILED: badjob-6: [%s]\n", cmd)
failures += 1
end
#
# SET JOB-5 as dup of JOB-5
#
print `p4 job -o job000005 | egrep -v '^Status:' > job01.tmp`
`echo \"DuplicateOf: job000005\" >> job01.tmp`
`echo \"Status: duplicate\" >> job01.tmp`
cmd = `p4 job -i < job01.tmp 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("FAILED: badjob-7: [%s]\n", cmd)
failures += 1
else
printf("badjob-7 passed\n")
end
File.unlink("job01.tmp")
#
# SET JOB-5 as dup of JOB-4
#
print `p4 job -o job000005 | egrep -v '^Status:' > job01.tmp`
`echo \"DuplicateOf: job000004\" >> job01.tmp`
`echo \"Status: duplicate\" >> job01.tmp`
cmd = `p4 job -i < job01.tmp 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("badjob-8 passed\n")
else
printf("FAILED: badjob-8: [%s]\n", cmd)
failures += 1
end
File.unlink("job01.tmp")
#
# Remove DuplicateOf from JOB-5
#
print `p4 job -o job000005 | egrep -v '^DuplicateOf:' > job01.tmp`
cmd = `p4 job -i < job01.tmp 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("FAILED: badjob-9: [%s]\n", cmd)
failures += 1
else
printf("badjob-9 passed\n")
end
File.unlink("job01.tmp")
#
# CHANGE JOB-5 to be dup of JOB-6
#
print `p4 job -o job000005 | egrep -v '^DuplicateOf:' > job01.tmp`
`echo \"DuplicateOf: job000006\" >> job01.tmp`
cmd = `p4 job -i < job01.tmp 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("FAILED: badjob-10: [%s]\n", cmd)
failures += 1
else
printf("badjob-10 passed\n")
end
File.unlink("job01.tmp")
#
# CHANGE JOB-5 to reference itself
#
print `p4 job -o job000005 | egrep -v '^RelatedJobs:' > job01.tmp`
`echo \"RelatedJobs: job000005\" >> job01.tmp`
cmd = `p4 job -i < job01.tmp 2>&1`.chomp
if cmd =~ /^Job job[0-9]+ saved/ then
printf("FAILED: badjob-11: [%s]\n", cmd)
failures += 1
else
printf("badjob-11 passed\n")
end
File.unlink("job01.tmp")
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
# |
Change |
User |
Description |
Committed |
|
#1
|
8493 |
Alan H Teague |
Initial import of the Enhanced Jobs Project |
|
|