rscm-accurev 0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. data/Rakefile +7 -76
  2. data/TODO +3 -17
  3. data/lib/rscm/accurev.rb +1 -13
  4. data/lib/rscm/scm/accurev/#command.rb# +95 -0
  5. data/lib/rscm/scm/accurev/api.rb +77 -258
  6. data/lib/rscm/scm/accurev/command.rb +40 -97
  7. data/lib/rscm/scm/accurev/filterio.rb +4 -6
  8. data/lib/rscm/scm/accurev/xml.rb +11 -199
  9. data/test/t_command.rb +11 -59
  10. data/test/t_load.rb +0 -1
  11. data/test/t_scrubio.rb +6 -1
  12. data/{apitest.rb → test.rb} +0 -1
  13. data/{test/eg/update-newwksp.xml → testing.log} +138 -0
  14. metadata +15 -57
  15. data/STATUS +0 -63
  16. data/bumprelease.sh +0 -13
  17. data/lib/rscm/scm/accurev/api.rb.mine +0 -382
  18. data/lib/rscm/scm/accurev/api.rb.r263 +0 -364
  19. data/lib/rscm/scm/accurev/api.rb.r265 +0 -393
  20. data/lib/rscm/scm/accurev/exception.rb +0 -38
  21. data/lib/test/unit/ui/xml/testrunner.rb +0 -165
  22. data/lib/test/unit/ui/xml/xmltestrunner.xslt +0 -79
  23. data/test/coverage/analyzer.rb +0 -127
  24. data/test/coverage/c_loader.rb +0 -34
  25. data/test/coverage/cover.rb +0 -91
  26. data/test/coverage/coverage_loader.rb +0 -21
  27. data/test/coverage/coveragetask.rb +0 -38
  28. data/test/coverage/index_tmpl.html +0 -42
  29. data/test/coverage/template.html +0 -36
  30. data/test/eg/ac-files.xml +0 -172
  31. data/test/eg/ac-pop.txt +0 -195
  32. data/test/eg/files-various-states.xml +0 -188
  33. data/test/eg/hist-oneweek-all.xml +0 -1483
  34. data/test/eg/hist-oneweek-external.xml +0 -246
  35. data/test/eg/hist-oneweek-promotes.xml +0 -1092
  36. data/test/eg/info.txt +0 -14
  37. data/test/eg/stat-a-various.xml +0 -1789
  38. data/test/eg/stat-m.xml +0 -13
  39. data/test/eg/stat-overlap.xml +0 -13
  40. data/test/eg/stat-x.xml +0 -20
  41. data/test/eg/update-i-mods-and-updates-and-overlap.xml +0 -73
  42. data/test/eg/update-i-nochanges.xml +0 -8
  43. data/test/eg/update-i-stale.xml +0 -0
  44. data/test/eg/update-i-updates.xml +0 -125
  45. data/test/eg/update-nochanges.xml +0 -7
  46. data/test/eg/update-stale.xml +0 -12
  47. data/test/eg/update-updates.xml +0 -147
  48. data/test/t_api.rb +0 -163
  49. data/test/t_xmlmapper.rb +0 -75
@@ -1,127 +0,0 @@
1
- #!/usr/bin/ruby
2
- require 'erb'
3
- require 'fileutils'
4
- include FileUtils
5
-
6
- #
7
- # usage:
8
- # rake coverage
9
- #
10
- #
11
-
12
- trace_file = ARGV.shift
13
- output_dir = ARGV.shift
14
- template_file = ARGV.shift
15
- template_index = ARGV.shift
16
-
17
- if trace_file.nil? or output_dir.nil?
18
- raise "Usage: $0 <tracefile> <output_dir> <template> <index_template>"
19
- end
20
-
21
- # stdout.printf("#%d:%s:%d:%s:%s: %s",
22
- # get_thread_no,
23
- # file,
24
- # line,
25
- # klass || '',
26
- # EVENT_SYMBOL[event],
27
- # get_line(file, line))
28
-
29
- puts "Reading trace data #{trace_file}..."
30
- files = {}
31
- File.open( trace_file, "r" ).each_line do |line|
32
- data, linedump = line.split(/ /)
33
- threadno, file, n, classname, eventsym = data.split(/:/)
34
- files[file] ||= []
35
- files[file][n.to_i] ||= 0
36
- files[file][n.to_i] += 1
37
- end
38
-
39
- class Summary
40
- attr_accessor :filename, :total_lines, :covered_lines
41
- attr_accessor :lines, :seen
42
- def initialize( filename )
43
- @filename = filename
44
- @total_lines = 0
45
- @covered_lines = 0
46
- @lines = []
47
- @seen = []
48
- end
49
- def pct
50
- @covered_lines.to_f / @total_lines.to_f
51
- end
52
- def htmlfile
53
- @filename.gsub(/[\.\/]/, '_') + ".html"
54
- end
55
- def get_binding
56
- binding
57
- end
58
- end
59
-
60
- class IndexSummary
61
- attr_accessor :summary
62
- def get_binding
63
- binding
64
- end
65
- end
66
-
67
- def pretty( template, output_dir, s )
68
- htmlfile = "#{output_dir}/#{s.htmlfile}"
69
- puts htmlfile
70
- File.open( htmlfile, "w" ) do |out|
71
- rhtml = ERB.new( template )
72
- out.print( rhtml.result( s.get_binding ) )
73
- end
74
- end
75
-
76
- def index( template, output_dir, summaries )
77
- idx = IndexSummary.new
78
- idx.summary = summaries
79
- puts "#{output_dir}/index.html"
80
- File.open( "#{output_dir}/index.html", "w" ) do |out|
81
- rhtml = ERB.new( template )
82
- out.print( rhtml.result( idx.get_binding ) )
83
- end
84
- end
85
-
86
- template = File.read( template_file )
87
- index_tmpl = File.read( template_index )
88
-
89
- puts "Outputting to #{output_dir}..."
90
- mkdir_p( output_dir )
91
- summary = {}
92
- files.each do |file, linelist|
93
- s = Summary.new( file )
94
- lineno = 0
95
- File.open( file ).each_line do |line|
96
- lineno += 1
97
- seen_this = false
98
- # basic: line was traced
99
- unless linelist[lineno].nil?
100
- seen_this = true
101
- end
102
- # misc: various comments, blank lines, other "untraceables"
103
- # mark them as seen
104
- if line =~ /^\s*$/
105
- seen_this = true
106
- end
107
- if line =~ /^\s*#/
108
- seen_this = true
109
- end
110
- if line =~ /^\s*(require|class|module|end|else|include|def)/
111
- seen_this = true
112
- end
113
- s.seen << seen_this
114
- if seen_this
115
- s.covered_lines += 1
116
- end
117
- s.total_lines +=1
118
- s.lines << line
119
- end
120
- summary[file] = s
121
- pretty( template, output_dir, summary[file] )
122
- end
123
- index( index_tmpl, output_dir, summary )
124
-
125
-
126
-
127
-
@@ -1,34 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'tracer'
3
-
4
- # Initialize tracer
5
- TRACE_FILE = "xxx.trace"
6
- OUTPUT = File.open( TRACE_FILE, "w" )
7
- puts "Tracing to #{TRACE_FILE}"
8
- t = Tracer.new()
9
- def t.stdout
10
- OUTPUT
11
- end
12
- def t.coverage_filter( event, file, line, id, binding, klass )
13
- # skip c libs
14
- return false if event == 'c-call'
15
- return false if event == 'c-return'
16
- return false if event == 'class'
17
- # skip any (other) core libs
18
- return false if file =~ /^\//
19
- # skip magical eval code
20
- return false if file =~ /\(eval\)/
21
- # log everything else
22
- return true
23
- end
24
- t.add_filter( t.method(:coverage_filter).to_proc )
25
-
26
- # load in test files
27
- ARGV.each do |f|
28
- load f unless f =~ /^-/
29
- end
30
-
31
- # turn tracing on: test::unit::autorunner runs test in an at_exit proc
32
- t.on
33
-
34
-
@@ -1,91 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- # set_trace_func proc do |event,file,line,id,binding,classname|
4
- # 'c-call' # call into clib - file:line -> caller
5
- # 'c-return' # return out of clib - file:line -> caller
6
- # 'call' # call into ruby fn - file:line -> fn def
7
- # 'class' # start class/mod def (only for dyn classes?)
8
- # 'end' # end class/mod def
9
- # 'line' # exec line
10
- # 'raise' # exception
11
- # 'return' # return from ruby fn - file:line -> returning stmt
12
- # end
13
-
14
- require 'rexml/document'
15
- include REXML
16
-
17
- # defining script_lines make ruby dump all scripts into this hash
18
- SCRIPT_LINES__ = {} unless defined? SCRIPT_LINES__
19
-
20
-
21
- module Test
22
-
23
- class Cover
24
-
25
- attr_accessor :codebase_files
26
-
27
- def initialize()
28
- @codebase_files = []
29
- # seen_lines is a hash of hashes
30
- @seen_lines = {}
31
- end
32
-
33
- def trace_func( event, file, line, id, binding, classname )
34
- return if event == 'c-call'
35
- return if event == 'c-return'
36
- return if event == 'class'
37
- @seen_lines[file] ||= {}
38
- @seen_lines[file][line] ||= 0
39
- @seen_lines[file][line] += 1
40
- end
41
-
42
- def coverage()
43
- set_trace_func( self.method(:trace_func).to_proc )
44
- yield self
45
- set_trace_func( nil )
46
- end
47
-
48
- def coverage_all()
49
- set_trace_func( self.method(:trace_func).to_proc )
50
- end
51
-
52
- def coverage_clear()
53
- set_trace_func( nil )
54
- end
55
-
56
- def to_xml
57
- doc = Document.new()
58
- doc << XMLDecl.new()
59
- root = Element.new( "coverage" )
60
- doc << root
61
- root.attributes['timestamp'] = Time.now
62
- codebase = Element.new( "codebase" )
63
- root << codebase
64
- @codebase_files.each do |file|
65
- e = Element.new( "file" )
66
- e.attributes['name'] = file
67
- codebase << e
68
- if @seen_lines.has_key?( file )
69
- seen = Element.new( "seen" )
70
- e << seen
71
- linehash = @seen_lines[file]
72
- next unless SCRIPT_LINES__.has_key?( file )
73
- linehash.each do |n,occur|
74
- le = Element.new( "line" )
75
- le.attributes['n'] = n
76
- le.attributes['occur'] = occur
77
- seen << le
78
- end
79
- ce = Element.new( "coverage" )
80
- ce.attributes['seen'] = linehash.size
81
- ce.attributes['total'] = SCRIPT_LINES__[file].size
82
- ce.attributes['pct'] = linehash.size.to_f / SCRIPT_LINES__[file].size.to_f
83
- seen << ce
84
- end
85
- end
86
- return doc
87
- end
88
-
89
- end
90
-
91
- end
@@ -1,21 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'rubygems'
3
- #require 'tracer'
4
- require 'test/cover'
5
-
6
- cover = Test::Cover.new()
7
- cover.coverage_all
8
- cover.codebase_files << "./lib/rscm/accurev.rb"
9
- cover.codebase_files << "./lib/rscm/scm/accurev/command.rb"
10
-
11
- #Tracer.on
12
- ARGV.each do |f|
13
- load f unless f =~ /^-/
14
- end
15
-
16
- END {
17
- cover.coverage_clear
18
- File.open( "xxx.xml", "w" ) do |f|
19
- f.puts( cover.to_xml )
20
- end
21
- }
@@ -1,38 +0,0 @@
1
- #/usr/bin/env ruby
2
- require 'rubygems'
3
- require 'rake'
4
- require 'rake/tasklib'
5
-
6
- module Rake
7
-
8
- class CoverageTask < TaskLib
9
- attr_accessor :name
10
- attr_accessor :libs
11
- attr_accessor :test_files
12
- attr_accessor :ruby_opts
13
-
14
- def initialize( name=:coverage )
15
- @name = name
16
- @libs = ["lib"]
17
- @test_files = nil
18
- @ruby_opts = []
19
- yield self if block_given?
20
- define
21
- end
22
-
23
- def define
24
- lib_path = @libs.join( File::PATH_SEPARATOR )
25
- @ruby_opts.unshift( "-I#{lib_path}" )
26
- task @name do
27
- ruby @ruby_opts.join(" ") +
28
- "test/coverage_loader.rb " +
29
- file_list.collect {|fn| "\"#{fn}\"".join(" ")
30
- end
31
- end
32
-
33
- def test_loader()
34
- find_file( 'test/coverage_loader' ) or fail "I DIE"
35
- end
36
-
37
- end
38
- end
@@ -1,42 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Coverage Summary</title>
4
- </head>
5
- <body>
6
- <h1>Coverage Summary</h1>
7
-
8
- <%
9
- def grad( pct )
10
- zero_end = [255,0,0]
11
- one_end = [0,255,0]
12
- g = []
13
- (0..2).each do |i|
14
- g[i] = (pct * (one_end[i]-zero_end[i])) + zero_end[i]
15
- end
16
- return "#"+g.collect{|x| "%02x" % x }.join("")
17
- end
18
- %>
19
- <p>
20
- Codebase:
21
-
22
- <table border="1">
23
- <tr>
24
- <td>File</td>
25
- <td>Lines</td>
26
- <td>Covered</td>
27
- <td>% Covered</td>
28
- </tr>
29
-
30
- <% summary.each do |filename,s| %>
31
- <tr>
32
- <td><a href="<%= s.htmlfile %>"><%= filename %></a></td>
33
- <td><%= s.total_lines %></td>
34
- <td><%= s.covered_lines %></td>
35
- <td bgcolor="<%= grad(s.pct) %>"><%= s.pct %></td>
36
- </tr>
37
- <% end %>
38
-
39
- </table>
40
- </p>
41
- </body>
42
- </html>
@@ -1,36 +0,0 @@
1
- <?xml version="1.0"?>
2
- <html>
3
- <head>
4
- <title><%= filename %></title>
5
- <style>
6
- span.marked {
7
- background-color: rgb(185, 200, 200);
8
- display: block;
9
- }
10
- </style>
11
- </head>
12
- <body>
13
- <h1><%= filename %></h1>
14
-
15
- <p>
16
- Total lines: <%= total_lines %>
17
- </p>
18
- <p>
19
- Covered lines: <%= covered_lines %>
20
- </p>
21
- <p>
22
- Percent covered: <b><%= pct %></b>
23
- </p>
24
-
25
- <hr />
26
-
27
- <pre>
28
- xxxx unreached line
29
- <span class="marked">xxxx covered line</span>
30
-
31
- <% (0..lines.length).each do |i| %><% if seen[i] %><span class="marked"><% end %><%= "%4d"%i %> <%= lines[i] %><% if seen[i] %></span><% end %><% end %>
32
-
33
- </pre>
34
-
35
- </body>
36
- </html>
data/test/eg/ac-files.xml DELETED
@@ -1,172 +0,0 @@
1
- <?xml version="1.0"?>
2
- <AcResponse
3
- Command="stat"
4
- Directory="/home/gfast/dev/orbitz-host-gt3-0-impl">
5
- <element
6
- location="./.acignore"
7
- dir="no"
8
- id="197"
9
- elemType="text"
10
- Virtual="7/2"
11
- namedVersion="orbitz-host-gt3-0-impl/2"
12
- Real="8/2"
13
- status="(backed)"/>
14
- <element
15
- location="./apps"
16
- dir="yes"
17
- id="6"
18
- elemType="dir"
19
- Virtual="4/1"
20
- namedVersion="orbitz-host-gt3-0-rc/1"
21
- Real="6/1"
22
- status="(backed)"/>
23
- <element
24
- location="./bin"
25
- dir="yes"
26
- id="20"
27
- elemType="dir"
28
- Virtual="4/1"
29
- namedVersion="orbitz-host-gt3-0-rc/1"
30
- Real="6/1"
31
- status="(backed)"/>
32
- <element
33
- location="./build"
34
- dir="yes"
35
- id="34"
36
- elemType="dir"
37
- Virtual="4/1"
38
- namedVersion="orbitz-host-gt3-0-rc/1"
39
- Real="6/1"
40
- status="(backed)"/>
41
- <element
42
- location="./build-deps.xml"
43
- dir="no"
44
- id="2"
45
- elemType="text"
46
- Virtual="4/1"
47
- namedVersion="orbitz-host-gt3-0-rc/1"
48
- Real="6/1"
49
- status="(backed)"/>
50
- <element
51
- location="./build.properties"
52
- dir="no"
53
- id="3"
54
- elemType="text"
55
- Virtual="4/1"
56
- namedVersion="orbitz-host-gt3-0-rc/1"
57
- Real="6/1"
58
- status="(backed)"/>
59
- <element
60
- location="./build.xml"
61
- dir="no"
62
- id="4"
63
- elemType="text"
64
- Virtual="7/1"
65
- namedVersion="orbitz-host-gt3-0-impl/1"
66
- Real="8/1"
67
- status="(backed)"/>
68
- <element
69
- location="./conf"
70
- dir="yes"
71
- id="65"
72
- elemType="dir"
73
- Virtual="4/1"
74
- namedVersion="orbitz-host-gt3-0-rc/1"
75
- Real="6/1"
76
- status="(backed)"/>
77
- <element
78
- location="./doc"
79
- dir="yes"
80
- id="117"
81
- elemType="dir"
82
- Virtual="4/1"
83
- namedVersion="orbitz-host-gt3-0-rc/1"
84
- Real="6/1"
85
- status="(backed)"/>
86
- <element
87
- location="./hosts.properties"
88
- dir="no"
89
- id="198"
90
- elemType="text"
91
- Virtual="7/2"
92
- namedVersion="orbitz-host-gt3-0-impl/2"
93
- Real="8/2"
94
- status="(backed)"/>
95
- <element
96
- location="./logs"
97
- dir="yes"
98
- id="128"
99
- elemType="dir"
100
- Virtual="4/1"
101
- namedVersion="orbitz-host-gt3-0-rc/1"
102
- Real="6/1"
103
- status="(backed)"/>
104
- <element
105
- location="./scripts"
106
- dir="yes"
107
- id="130"
108
- elemType="dir"
109
- Virtual="4/1"
110
- namedVersion="orbitz-host-gt3-0-rc/1"
111
- Real="6/1"
112
- status="(backed)"/>
113
- <element
114
- location="./src"
115
- dir="yes"
116
- id="136"
117
- elemType="dir"
118
- Virtual="4/1"
119
- namedVersion="orbitz-host-gt3-0-rc/1"
120
- Real="6/1"
121
- status="(backed)"/>
122
- <element
123
- location="./test"
124
- dir="yes"
125
- id="194"
126
- elemType="dir"
127
- Virtual="4/1"
128
- namedVersion="orbitz-host-gt3-0-rc/1"
129
- Real="6/1"
130
- status="(backed)"/>
131
- <element
132
- location="./version.properties"
133
- dir="no"
134
- id="5"
135
- elemType="text"
136
- Virtual="7/1"
137
- namedVersion="orbitz-host-gt3-0-impl/1"
138
- Real="8/1"
139
- status="(backed)"/>
140
- <element
141
- location="./install"
142
- dir="yes"
143
- status="(external)"/>
144
- <element
145
- location="./target"
146
- dir="yes"
147
- status="(external)"/>
148
- <element
149
- location="./ground.iml"
150
- dir="no"
151
- status="(external)"/>
152
- <element
153
- location="./.project"
154
- dir="no"
155
- status="(external)"/>
156
- <element
157
- location="./.eclipsebuild"
158
- dir="yes"
159
- status="(external)"/>
160
- <element
161
- location="./.classpath"
162
- dir="no"
163
- status="(external)"/>
164
- <element
165
- location="./ac-files.xml"
166
- dir="no"
167
- status="(external)"/>
168
- <element
169
- location="./TODO"
170
- dir="no"
171
- status="(external)"/>
172
- </AcResponse>