~ubuntu-branches/ubuntu/saucy/pixman/saucy-security

« back to all changes in this revision

Viewing changes to test/scaling-test-bisect.rb

  • Committer: Bazaar Package Importer
  • Author(s): Julien Cristau
  • Date: 2009-09-28 18:12:47 UTC
  • mfrom: (1.1.8 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090928181247-3iehog63i50htejf
Tags: 0.16.2-1
* New upstream release (closes: #546849).
* Upload to unstable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env ruby
 
2
 
 
3
if not ARGV[0] or not ARGV[1] then
 
4
    printf("Please provide two 'scaling-test' static binaries in the command line.\n\n")
 
5
    printf("The first should be linked with the correct reference pixman library.\n")
 
6
    printf("The second binrary should be linked with the pixman library to be tested.\n")
 
7
    exit(0)
 
8
end
 
9
 
 
10
$MAX = 3000000
 
11
$MIN = 1
 
12
$AVG = 0
 
13
 
 
14
if `#{ARGV[0]} #{$MAX} 2>/dev/null` == `#{ARGV[1]} #{$MAX} 2>/dev/null` then
 
15
    printf("test ok\n")
 
16
    exit(0)
 
17
end
 
18
 
 
19
printf("test failed, bisecting...\n")
 
20
 
 
21
while $MAX != $MIN + 1 do
 
22
    $AVG = (($MIN + $MAX) / 2).to_i
 
23
    res1 = `#{ARGV[0]} #{$AVG} 2>/dev/null`
 
24
    res2 = `#{ARGV[1]} #{$AVG} 2>/dev/null`
 
25
    if res1 != res2 then
 
26
        $MAX = $AVG
 
27
    else
 
28
        $MIN = $AVG
 
29
    end
 
30
end
 
31
 
 
32
printf("-- ref --\n")
 
33
printf("%s\n", `#{ARGV[0]} -#{$MAX}`)
 
34
printf("-- new --\n")
 
35
printf("%s\n", `#{ARGV[1]} -#{$MAX}`)
 
36
 
 
37
printf("\nFailed test number is %d, you can reproduce the problematic conditions\n", $MAX)
 
38
printf("by running 'scaling-test -%d'\n", $MAX)