trema 0.3.18 → 0.3.19

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- data.tar.gz: ef4c570127042644202d811328fd28ba95b65c2e
4
- metadata.gz: 15407d9c4231e8d79511d0e561ea37bfd9fd5f77
3
+ data.tar.gz: 9885ea68bffe5d48af843709c06d6b0380ea2916
4
+ metadata.gz: 5b4335551a0a407c64d74c84641fac37ffb7167c
5
5
  SHA512:
6
- data.tar.gz: ed442ede234c7c877ce354826453e12115f6fcb5ee9e224d1f9f7a532691b2513ff3f0aa96b86e77c8e178bcd598683d7cb611a57338a23ab85c9adfe1969c32
7
- metadata.gz: 9c9b32674cad8e91467fb14becb1850a21c1ae2eb267e3dd155b59c627182d77228d741b1e23bca4160f930fedfb189b460d3a0b72fa107883768eae2961873a
6
+ data.tar.gz: e5484148554ae7e4c21e4653e91c13fee369a06b31c2454d15272a8ac581399b5079a818488d5d60d03388459173a26fe46b818aa3f55acbd1d5937dd4a51bf8
7
+ metadata.gz: e5defc8906693729384d4031065110450bffeab98f5954fa3e0b71ba9b3901512d1ca1e80f6a2b276b5111b1148a8620373c4fb48ba6a386a8e5cd50499883f1
data/README.md CHANGED
@@ -1,6 +1,7 @@
1
1
  Welcome to Trema
2
2
  ================
3
3
 
4
+ [![Gem Version](https://badge.fury.io/rb/trema.png)](http://badge.fury.io/rb/trema)
4
5
  [![Build Status](https://secure.travis-ci.org/trema/trema.png?branch=develop)](http://travis-ci.org/trema/trema)
5
6
  [![Code Climate](https://codeclimate.com/github/trema/trema.png)](https://codeclimate.com/github/trema/trema)
6
7
  [![Dependency Status](https://gemnasium.com/trema/trema.png)](https://gemnasium.com/trema/trema)
@@ -27,6 +28,7 @@ Supported Platforms
27
28
  Trema supports GNU/Linux only. And it has been tested on the following environments:
28
29
 
29
30
  * Ruby 1.8.7 (1.9.x is NOT supported yet)
31
+ * RubyGems 1.3.6 or higher
30
32
  * Ubuntu 12.10, 12.04, 11.10, and 10.04 (i386/amd64, Desktop Edition)
31
33
  * Debian GNU/Linux 6.0 (i386/amd64)
32
34
  * Fedora 16 (i386/x86_64)
@@ -46,12 +48,17 @@ Getting Started
46
48
 
47
49
  1.Install the prerequisites at the command prompt:
48
50
 
49
- (In Debian GNU/Linux or Ubuntu 12.04 and below)
50
- $ sudo apt-get install gcc make ruby rubygems ruby-dev libpcap-dev libsqlite3-dev
51
-
52
51
  (In Ubuntu 12.10)
53
52
  $ sudo apt-get install gcc make ruby1.8 rubygems1.8 ruby1.8-dev libpcap-dev libsqlite3-dev
54
53
 
54
+ (In Ubuntu 12.04, 11.10 or Debian GNU/Linux 6.0)
55
+ $ sudo apt-get install gcc make ruby rubygems ruby-dev libpcap-dev libsqlite3-dev
56
+
57
+ (In Ubuntu 10.04)
58
+ $ sudo apt-get install gcc make ruby rubygems ruby-dev libopenssl-ruby libpcap-dev libsqlite3-dev
59
+ $ sudo gem install rubygems-update
60
+ $ sudo /var/lib/gems/1.8/bin/update_rubygems
61
+
55
62
  (In Fedora 16)
56
63
  $ sudo yum install gcc make ruby rubygems ruby-devel libpcap-devel libsqlite3x-devel
57
64
 
data/Rakefile CHANGED
@@ -37,11 +37,10 @@ task :build_trema => [ Trema.log, Trema.pid, Trema.sock ] do
37
37
  end
38
38
 
39
39
 
40
- ################################################################################
41
- # Build libtrema.{a,so}
42
- ################################################################################
43
-
44
- require "rake/c/library-task"
40
+ require "paper-house/executable-task"
41
+ require "paper-house/ruby-library-task"
42
+ require "paper-house/shared-library-task"
43
+ require "paper-house/static-library-task"
45
44
  require "trema/version"
46
45
 
47
46
 
@@ -63,31 +62,31 @@ CFLAGS = [
63
62
  ]
64
63
 
65
64
 
66
- desc "Build trema library (static library)."
65
+ desc "Build Trema C library (static library)."
67
66
  task "libtrema:static" => "vendor:openflow"
68
- Rake::C::StaticLibraryTask.new "libtrema:static" do | task |
67
+ PaperHouse::StaticLibraryTask.new "libtrema:static" do | task |
69
68
  task.library_name = "libtrema"
70
69
  task.target_directory = Trema.lib
71
70
  task.sources = "#{ Trema.include }/*.c"
72
- task.includes = [ Trema.openflow ]
73
71
  task.cflags = CFLAGS
72
+ task.includes = [ Trema.openflow ]
74
73
  end
75
74
 
76
75
 
77
- desc "Build trema library (coverage)."
76
+ desc "Build Trema C library (coverage)."
78
77
  task "libtrema:gcov" => "vendor:openflow"
79
- Rake::C::StaticLibraryTask.new "libtrema:gcov" do | task |
78
+ PaperHouse::StaticLibraryTask.new "libtrema:gcov" do | task |
80
79
  task.library_name = "libtrema"
81
- task.target_directory = File.join( Trema.objects, "unittests" )
80
+ task.target_directory = "#{ Trema.home }/objects/unittests"
82
81
  task.sources = "#{ Trema.include }/*.c"
83
82
  task.includes = [ Trema.openflow ]
84
83
  task.cflags = [ "--coverage" ] + CFLAGS
85
84
  end
86
85
 
87
86
 
88
- desc "Build trema library (shared library)."
87
+ desc "Build Trema C library (shared library)."
89
88
  task "libtrema:shared" => "vendor:openflow"
90
- Rake::C::SharedLibraryTask.new "libtrema:shared" do | task |
89
+ PaperHouse::SharedLibraryTask.new "libtrema:shared" do | task |
91
90
  task.library_name = "libtrema"
92
91
  task.target_directory = Trema.lib
93
92
  task.version = Trema::VERSION
@@ -97,6 +96,83 @@ Rake::C::SharedLibraryTask.new "libtrema:shared" do | task |
97
96
  end
98
97
 
99
98
 
99
+ desc "Build Trema Ruby library."
100
+ task "rubylib" => "libtrema:static"
101
+ PaperHouse::RubyLibraryTask.new "rubylib" do | task |
102
+ task.library_name = "trema"
103
+ task.target_directory = Trema.ruby
104
+ task.sources = "#{ Trema.ruby }/trema/*.c"
105
+ task.includes = [ Trema.include, Trema.openflow ]
106
+ task.cflags = CFLAGS
107
+ task.ldflags = [ "-Wl,-Bsymbolic", "-L#{ Trema.lib }" ]
108
+ task.library_dependencies = [
109
+ "trema",
110
+ "sqlite3",
111
+ "pthread",
112
+ "rt",
113
+ "dl",
114
+ "crypt",
115
+ "m"
116
+ ]
117
+ end
118
+
119
+
120
+ desc "Build switch manager."
121
+ task :switch_manager => "libtrema:static"
122
+
123
+ PaperHouse::ExecutableTask.new :switch_manager do | task |
124
+ task.target_directory = File.dirname( Trema::Executables.switch_manager )
125
+ task.sources = [
126
+ "src/switch_manager/dpid_table.c",
127
+ "src/switch_manager/event_forward_entry_manipulation.c",
128
+ "src/switch_manager/secure_channel_listener.c",
129
+ "src/switch_manager/switch_manager.c",
130
+ "src/switch_manager/switch_option.c",
131
+ ]
132
+ task.includes = [ Trema.include, Trema.openflow ]
133
+ task.cflags = CFLAGS
134
+ task.ldflags = "-L#{ Trema.lib }"
135
+ task.library_dependencies = [
136
+ "trema",
137
+ "sqlite3",
138
+ "pthread",
139
+ "rt",
140
+ "dl",
141
+ ]
142
+ end
143
+
144
+
145
+ desc "Build switch daemon."
146
+ task :switch_daemon => "libtrema:static"
147
+
148
+ PaperHouse::ExecutableTask.new :switch_daemon do | task |
149
+ task.executable_name = File.basename( Trema::Executables.switch )
150
+ task.target_directory = File.dirname( Trema::Executables.switch )
151
+ task.sources = [
152
+ "src/switch_manager/cookie_table.c",
153
+ "src/switch_manager/event_forward_entry_manipulation.c",
154
+ "src/switch_manager/ofpmsg_recv.c",
155
+ "src/switch_manager/ofpmsg_send.c",
156
+ "src/switch_manager/secure_channel_receiver.c",
157
+ "src/switch_manager/secure_channel_sender.c",
158
+ "src/switch_manager/service_interface.c",
159
+ "src/switch_manager/switch.c",
160
+ "src/switch_manager/switch_option.c",
161
+ "src/switch_manager/xid_table.c",
162
+ ]
163
+ task.includes = [ Trema.include, Trema.openflow ]
164
+ task.cflags = CFLAGS
165
+ task.ldflags = "-L#{ Trema.lib }"
166
+ task.library_dependencies = [
167
+ "trema",
168
+ "sqlite3",
169
+ "pthread",
170
+ "rt",
171
+ "dl",
172
+ ]
173
+ end
174
+
175
+
100
176
  ################################################################################
101
177
  # Extract OpenFlow reference implementation
102
178
  ################################################################################
@@ -326,8 +402,6 @@ end
326
402
 
327
403
  task :setup do
328
404
  sh "./build.rb distclean"
329
- sh "bundle update"
330
- sh "bundle install"
331
405
  end
332
406
 
333
407
 
data/Rantfile CHANGED
@@ -39,7 +39,7 @@ task :default => [
39
39
  :management_commands,
40
40
  :rubylib,
41
41
  :switch_manager,
42
- :switch,
42
+ :switch_daemon,
43
43
  :packetin_filter,
44
44
  :tremashark,
45
45
  :packet_capture,
@@ -244,35 +244,9 @@ end
244
244
  # Build trema.so (ruby library)
245
245
  ################################################################################
246
246
 
247
- task :clean => "rubylib:clean"
248
- task :distclean => "rubylib:distclean"
249
-
250
-
251
- require "rbconfig"
252
- RUBY_PATH = File.join(
253
- RbConfig::CONFIG[ 'bindir' ],
254
- RbConfig::CONFIG[ 'RUBY_INSTALL_NAME' ] +
255
- RbConfig::CONFIG[ 'EXEEXT' ]
256
- )
257
-
258
247
  desc "Build ruby library."
259
- task :rubylib => "ruby/trema.so"
260
- file "ruby/trema.so" => FileList[ "ruby/trema/*.c", "ruby/trema/*.h", libtrema ] do
261
- sys.cd "ruby" do
262
- sys "#{ RUBY_PATH } extconf.rb --with-trema-include=#{ Trema.include } --with-trema-lib=#{ Trema.lib } --with-openflow-include=#{ Trema.openflow }"
263
- sys "make"
264
- end
265
- end
266
-
267
-
268
- task "rubylib:clean" do
269
- sys.cd "ruby" do
270
- sys "make clean" rescue nil
271
- end
272
- end
273
-
274
- task "rubylib:distclean" do
275
- sys.rm_f "ruby/Makefile"
248
+ task :rubylib do
249
+ sys "rake rubylib"
276
250
  end
277
251
 
278
252
 
@@ -280,59 +254,15 @@ end
280
254
  # Build switch manager
281
255
  ################################################################################
282
256
 
283
- switch_manager_objects_dir = objects( "switch_manager" )
284
-
285
- gen C::Dependencies, dependency( "switch_manager" ),
286
- :search => [ "src/switch_manager", Trema.include ], :sources => sys[ "src/switch_manager/*.{c,h}" ]
287
-
288
- gen Action do
289
- source dependency( "switch_manager" )
290
- end
291
-
292
-
293
- gen Directory, switch_manager_objects_dir
294
-
295
- gen DirectedRule, switch_manager_objects_dir => [ "src/switch_manager" ], :o => :c do | t |
296
- sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
297
- end
298
-
299
-
300
- switch_manager_objects = [
301
- "dpid_table.o",
302
- "event_forward_entry_manipulation.o",
303
- "switch_manager.o",
304
- "switch_option.o",
305
- "secure_channel_listener.o"
306
- ].collect do | each |
307
- File.join switch_manager_objects_dir, each
308
- end
309
-
310
257
  desc "Build switch manager."
311
- task :switch_manager => Trema::Executables.switch_manager
312
- file Trema::Executables.switch_manager => switch_manager_objects + [ libtrema ] do | t |
313
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpthread"
314
- end
315
-
316
-
317
- switch_objects = [
318
- "cookie_table.o",
319
- "event_forward_entry_manipulation.o",
320
- "ofpmsg_recv.o",
321
- "ofpmsg_send.o",
322
- "secure_channel_receiver.o",
323
- "secure_channel_sender.o",
324
- "service_interface.o",
325
- "switch.o",
326
- "switch_option.o",
327
- "xid_table.o",
328
- ].collect do | each |
329
- File.join switch_manager_objects_dir, each
258
+ task :switch_manager do
259
+ sys "rake switch_manager"
330
260
  end
331
261
 
262
+
332
263
  desc "Build switch."
333
- task :switch => Trema::Executables.switch
334
- file Trema::Executables.switch => switch_objects + [ libtrema ] do | t |
335
- sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpthread"
264
+ task :switch_daemon do
265
+ sys "rake switch_daemon"
336
266
  end
337
267
 
338
268
 
data/cruise.rb CHANGED
@@ -34,7 +34,6 @@ $coverage_threshold = 70.2
34
34
  $LOAD_PATH.unshift( File.expand_path( File.dirname( __FILE__ ) + "/ruby" ) )
35
35
 
36
36
  require "rubygems"
37
- require "bundler/setup"
38
37
 
39
38
  require "English"
40
39
  require "blocker"
@@ -359,6 +358,7 @@ $options.parse! ARGV
359
358
 
360
359
 
361
360
  def init_cruise
361
+ sh "bundle"
362
362
  sh "rake setup"
363
363
  end
364
364
 
@@ -39,6 +39,7 @@ Feature: C function example command "add_forward_entry"
39
39
  -t, --type={vendor,packet_in,port_status,state_notify} Specify event type.
40
40
  """
41
41
 
42
+ @slow_process
42
43
  Scenario Outline: Add 'mirror' to All Switch Manager/Daemon's event forwarding entries of packet_in
43
44
  Given a file named "nw_dsl.conf" with:
44
45
  """
@@ -60,6 +61,7 @@ Feature: C function example command "add_forward_entry"
60
61
  | SW 0x1 | -s 0x1 |
61
62
  | SW 0x2 | -s 0x2 |
62
63
 
64
+ @slow_process
63
65
  Scenario Outline: Switch added after event forwarding entry manipulation should also reflect new configuration of Switch Manager.
64
66
  Given a file named "nw_dsl.conf" with:
65
67
  """
@@ -87,6 +89,7 @@ Feature: C function example command "add_forward_entry"
87
89
  | SW 0x1 | -s 0x1 |
88
90
  | SW 0x2 | -s 0x2 |
89
91
 
92
+ @slow_process
90
93
  Scenario Outline: Add 'mirror' only to Switch Manager's event forwarding entry of packet_in
91
94
  Given a file named "nw_dsl.conf" with:
92
95
  """
@@ -108,6 +111,7 @@ Feature: C function example command "add_forward_entry"
108
111
  | 0x1 |
109
112
  | 0x2 |
110
113
 
114
+ @slow_process
111
115
  Scenario Outline: Add 'mirror' only to Switch Daemon 0x1's event forwarding entries of packet_in
112
116
  Given a file named "nw_dsl.conf" with:
113
117
  """
@@ -39,6 +39,7 @@ Feature: C function example command "delete_forward_entry"
39
39
  -t, --type={vendor,packet_in,port_status,state_notify} Specify event type.
40
40
  """
41
41
 
42
+ @slow_process
42
43
  Scenario Outline: Delete 'RepeaterHub' from All Switch Manager/Daemon's event forwarding entries of packet_in
43
44
  Given a file named "nw_dsl.conf" with:
44
45
  """
@@ -58,6 +59,7 @@ Feature: C function example command "delete_forward_entry"
58
59
  | SW 0x1 | -s 0x1 |
59
60
  | SW 0x2 | -s 0x2 |
60
61
 
62
+ @slow_process
61
63
  Scenario Outline: Delete 'RepeaterHub' only from Switch Manager's event forwarding entries of packet_in
62
64
  Given a file named "nw_dsl.conf" with:
63
65
  """
@@ -77,6 +79,7 @@ Feature: C function example command "delete_forward_entry"
77
79
  | 0x1 |
78
80
  | 0x2 |
79
81
 
82
+ @slow_process
80
83
  Scenario Outline: Delete 'RepeaterHub' only from Switch Daemon 0x1's event forwarding entries of packet_in
81
84
  Given a file named "nw_dsl.conf" with:
82
85
  """
@@ -37,6 +37,7 @@ Feature: C function example command "dump_forward_entries"
37
37
  -t, --type={vendor,packet_in,port_status,state_notify} Specify event type.
38
38
  """
39
39
 
40
+ @slow_process
40
41
  Scenario Outline: Dump Switch Manager's event forwarding entries for each event type
41
42
  Given a file named "nw_dsl.conf" with:
42
43
  """
@@ -56,6 +57,7 @@ Feature: C function example command "dump_forward_entries"
56
57
  | port_status |
57
58
  | state_notify |
58
59
 
60
+ @slow_process
59
61
  Scenario Outline: Dump Switch Daemon's event forwarding entries for each event type on each switch
60
62
  Given a file named "nw_dsl.conf" with:
61
63
  """
@@ -38,6 +38,7 @@ Feature: C function example command "set_forward_entries"
38
38
  -t, --type={vendor,packet_in,port_status,state_notify} Specify event type.
39
39
  """
40
40
 
41
+ @slow_process
41
42
  Scenario Outline: Replace Switch Manager's event forwarding entries of packet_in to 'mirror' and 'filter'
42
43
  Given a file named "nw_dsl.conf" with:
43
44
  """
@@ -61,6 +62,7 @@ Feature: C function example command "set_forward_entries"
61
62
  | 0x1 |
62
63
  | 0x2 |
63
64
 
65
+ @slow_process
64
66
  Scenario Outline: Replace Switch Daemon 0x1's event forwarding entries of packet_in to 'mirror' and 'filter'
65
67
  Given a file named "nw_dsl.conf" with:
66
68
  """
@@ -29,6 +29,7 @@ Feature: Ruby methods for adding switch event forwarding entry
29
29
  All the above methods take a result handler as Ruby block, but
30
30
  can be omitted if checking is not necessary.
31
31
 
32
+ @slow_process
32
33
  Scenario Outline: add_forward_entry_to_all_switches event_type, trema_name
33
34
  Given a file named "nw_dsl.conf" with:
34
35
  """
@@ -57,7 +58,7 @@ Feature: Ruby methods for adding switch event forwarding entry
57
58
  """
58
59
  When I successfully run `trema run ./AddEntryToAllTest.rb -c nw_dsl.conf -d`
59
60
  And wait until "AddEntryToAllTest" is up
60
- And *** sleep 1 ***
61
+ And *** sleep 2 ***
61
62
  Then the file "../../tmp/log/AddEntryToAllTest.log" should contain:
62
63
  """
63
64
  Successfully added a forwarding entry of <event_type>.
@@ -78,6 +79,7 @@ Feature: Ruby methods for adding switch event forwarding entry
78
79
  | :port_status | "new_controller", "AddEntryToAllTest" | "new_controller", "AddEntryToAllTest" |
79
80
  | :state_notify | "new_controller", "AddEntryToAllTest" | "new_controller", "AddEntryToAllTest", "switch_manager" |
80
81
 
82
+ @slow_process
81
83
  Scenario Outline: add_forward_entry_to_switch dpid, event_type, trema_name
82
84
  Given a file named "nw_dsl.conf" with:
83
85
  """
@@ -111,6 +113,7 @@ Feature: Ruby methods for adding switch event forwarding entry
111
113
  | :port_status | "new_controller", "AddEntryToSwitchDaemonTest" |
112
114
  | :state_notify | "new_controller", "AddEntryToSwitchDaemonTest", "switch_manager" |
113
115
 
116
+ @slow_process
114
117
  Scenario Outline: add_forward_entry_to_switch_manager event_type, trema_name
115
118
  Given a file named "AddEntryToSwitchManagerTest.rb" with:
116
119
  """ruby
@@ -29,6 +29,7 @@ Feature: Ruby methods for deleting switch event forwarding entry
29
29
  All the above methods take a result handler as Ruby block, but
30
30
  they can be omitted if checking is not necessary.
31
31
 
32
+ @slow_process
32
33
  Scenario Outline: delete_forward_entry_from_all_switches event_type, trema_name
33
34
  Given a file named "nw_dsl.conf" with:
34
35
  """
@@ -57,7 +58,7 @@ Feature: Ruby methods for deleting switch event forwarding entry
57
58
  """
58
59
  When I successfully run `trema run ./DeleteEntryFromAllTest.rb -c nw_dsl.conf -d`
59
60
  And wait until "DeleteEntryFromAllTest" is up
60
- And *** sleep 1 ***
61
+ And *** sleep 2 ***
61
62
  Then the file "../../tmp/log/DeleteEntryFromAllTest.log" should contain:
62
63
  """
63
64
  Successfully deleted a forwarding entry of <event_type>.
@@ -78,6 +79,7 @@ Feature: Ruby methods for deleting switch event forwarding entry
78
79
  | :port_status | | |
79
80
  | :state_notify | | "switch_manager" |
80
81
 
82
+ @slow_process
81
83
  Scenario Outline: delete_forward_entry_from_switch dpid, event_type, trema_name
82
84
  Given a file named "nw_dsl.conf" with:
83
85
  """
@@ -111,6 +113,7 @@ Feature: Ruby methods for deleting switch event forwarding entry
111
113
  | :port_status | |
112
114
  | :state_notify | "switch_manager" |
113
115
 
116
+ @slow_process
114
117
  Scenario Outline: delete_forward_entry_from_switch_manager event_type, trema_name
115
118
  Given a file named "DeleteFromSwitchManagerTest.rb" with:
116
119
  """ruby
@@ -22,6 +22,7 @@ Feature: Ruby methods for dumping switch event forwarding entry
22
22
  ----
23
23
  All the above methods take a result handler as Ruby block.
24
24
 
25
+ @slow_process
25
26
  Scenario Outline: dump_forward_entries_from_switch dpid, event_type
26
27
  Given a file named "nw_dsl.conf" with:
27
28
  """
@@ -56,6 +57,7 @@ Feature: Ruby methods for dumping switch event forwarding entry
56
57
  | :port_status | "port_status" |
57
58
  | :state_notify | "DumpSwitchDaemonTest", "switch_manager" |
58
59
 
60
+ @slow_process
59
61
  Scenario Outline: dump_forward_entries_from_switch_manager event_type
60
62
  Given a file named "nw_dsl.conf" with:
61
63
  """
@@ -26,6 +26,7 @@ Feature: Ruby methods for setting switch event forwarding entry
26
26
  All the above methods take a result handler as Ruby block, but
27
27
  they can be omitted if checking is not necessary.
28
28
 
29
+ @slow_process
29
30
  Scenario Outline: set_forward_entries_to_switch dpid, event_type, trema_names
30
31
  Given a file named "nw_dsl.conf" with:
31
32
  """
@@ -59,6 +60,7 @@ Feature: Ruby methods for setting switch event forwarding entry
59
60
  | :port_status | "SetEntriesToSwitchDaemonTest", "Another" |
60
61
  | :state_notify | "SetEntriesToSwitchDaemonTest", "Another" |
61
62
 
63
+ @slow_process
62
64
  Scenario Outline: set_forward_entries_to_switch_manager event_type, trema_names
63
65
  Given a file named "SetEntriesToSwitchManagerTest.rb" with:
64
66
  """ruby
data/ruby/trema/path.rb CHANGED
@@ -53,6 +53,7 @@ module Trema
53
53
 
54
54
 
55
55
  dir :home, "objects"
56
+ dir :home, "ruby"
56
57
  dir :home, "src/lib", :include
57
58
  dir :home, "vendor"
58
59
  dir :objects, "cmockery"
@@ -17,7 +17,7 @@
17
17
 
18
18
 
19
19
  module Trema
20
- VERSION = "0.3.18"
20
+ VERSION = "0.3.19"
21
21
  end
22
22
 
23
23
 
@@ -438,11 +438,11 @@ add_switch_manager_event_forward_entry( enum efi_event_type type, const char *se
438
438
  const char switch_manager[] = "switch_manager.m";
439
439
  list_element service_list;
440
440
  service_list.next = NULL;
441
- #pragma GCC diagnostic push
442
- #pragma GCC diagnostic ignored "-Wcast-qual"
443
- service_list.data = ( void * ) service_name;
444
- #pragma GCC diagnostic pop
445
- return send_efi_event_config_request( switch_manager, EVENT_FORWARD_ENTRY_ADD, type, &service_list, callback, user_data );
441
+ // Copying only to avoid const_cast warnings. Will not modify in callee.
442
+ service_list.data = xstrdup( service_name );
443
+ bool sent_ok = send_efi_event_config_request( switch_manager, EVENT_FORWARD_ENTRY_ADD, type, &service_list, callback, user_data );
444
+ xfree( service_list.data );
445
+ return sent_ok;
446
446
  }
447
447
 
448
448
 
@@ -451,11 +451,11 @@ delete_switch_manager_event_forward_entry( enum efi_event_type type, const char
451
451
  const char switch_manager[] = "switch_manager.m";
452
452
  list_element service_list;
453
453
  service_list.next = NULL;
454
- #pragma GCC diagnostic push
455
- #pragma GCC diagnostic ignored "-Wcast-qual"
456
- service_list.data = ( void * ) service_name;
457
- #pragma GCC diagnostic pop
458
- return send_efi_event_config_request( switch_manager, EVENT_FORWARD_ENTRY_DELETE, type, &service_list, callback, user_data );
454
+ // Copying only to avoid const_cast warnings. Will not modify in callee.
455
+ service_list.data = xstrdup( service_name );
456
+ bool sent_ok = send_efi_event_config_request( switch_manager, EVENT_FORWARD_ENTRY_DELETE, type, &service_list, callback, user_data );
457
+ xfree( service_list.data );
458
+ return sent_ok;
459
459
  }
460
460
 
461
461
 
@@ -480,11 +480,11 @@ add_switch_event_forward_entry( uint64_t dpid, enum efi_event_type type, const c
480
480
  snprintf( switch_name, MESSENGER_SERVICE_NAME_LENGTH, "switch.%#" PRIx64 ".m", dpid );
481
481
  list_element service_list;
482
482
  service_list.next = NULL;
483
- #pragma GCC diagnostic push
484
- #pragma GCC diagnostic ignored "-Wcast-qual"
485
- service_list.data = ( void * ) service_name;
486
- #pragma GCC diagnostic pop
487
- return send_efi_event_config_request( switch_name, EVENT_FORWARD_ENTRY_ADD, type, &service_list, callback, user_data );
483
+ // Copying only to avoid const_cast warnings. Will not modify in callee.
484
+ service_list.data = xstrdup( service_name );
485
+ bool sent_ok = send_efi_event_config_request( switch_name, EVENT_FORWARD_ENTRY_ADD, type, &service_list, callback, user_data );
486
+ xfree( service_list.data );
487
+ return sent_ok;
488
488
  }
489
489
 
490
490
 
@@ -494,11 +494,11 @@ delete_switch_event_forward_entry( uint64_t dpid, enum efi_event_type type, cons
494
494
  snprintf( switch_name, MESSENGER_SERVICE_NAME_LENGTH, "switch.%#" PRIx64 ".m", dpid );
495
495
  list_element service_list;
496
496
  service_list.next = NULL;
497
- #pragma GCC diagnostic push
498
- #pragma GCC diagnostic ignored "-Wcast-qual"
499
- service_list.data = ( void * ) service_name;
500
- #pragma GCC diagnostic pop
501
- return send_efi_event_config_request( switch_name, EVENT_FORWARD_ENTRY_DELETE, type, &service_list, callback, user_data );
497
+ // Copying only to avoid const_cast warnings. Will not modify in callee.
498
+ service_list.data = xstrdup( service_name );
499
+ bool sent_ok = send_efi_event_config_request( switch_name, EVENT_FORWARD_ENTRY_DELETE, type, &service_list, callback, user_data );
500
+ xfree( service_list.data );
501
+ return sent_ok;
502
502
  }
503
503
 
504
504
 
data/trema.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do | gem |
28
28
 
29
29
  gem.add_dependency "bundler"
30
30
  gem.add_dependency "gli", "~> 2.5.5"
31
- gem.add_dependency "popen4", "~> 0.1.2"
31
+ gem.add_dependency "paper-house", "~> 0.1.13"
32
32
  gem.add_dependency "rake", "~> 10.0.3"
33
33
  gem.add_dependency "rdoc", "~> 4.0.0"
34
34
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trema
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.18
4
+ version: 0.3.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasuhito Takamiya
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: .
10
10
  cert_chain: []
11
11
 
12
- date: 2013-03-22 00:00:00 Z
12
+ date: 2013-03-29 00:00:00 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -33,13 +33,13 @@ dependencies:
33
33
  prerelease: false
34
34
  version_requirements: *id002
35
35
  - !ruby/object:Gem::Dependency
36
- name: popen4
36
+ name: paper-house
37
37
  type: :runtime
38
38
  requirement: &id003 !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ~>
41
41
  - !ruby/object:Gem::Version
42
- version: 0.1.2
42
+ version: 0.1.13
43
43
  prerelease: false
44
44
  version_requirements: *id003
45
45
  - !ruby/object:Gem::Dependency
@@ -144,10 +144,6 @@ files:
144
144
  - ruby/.gitignore
145
145
  - ruby/blocker.rb
146
146
  - ruby/extconf.rb
147
- - ruby/rake/c/dependency.rb
148
- - ruby/rake/c/library-task.rb
149
- - ruby/rake/c/shared-library-task.rb
150
- - ruby/rake/c/static-library-task.rb
151
147
  - ruby/sub-process.rb
152
148
  - ruby/trema/action-common.c
153
149
  - ruby/trema/action-common.h
@@ -1,42 +0,0 @@
1
- require "pstore"
2
- require "trema/path"
3
-
4
-
5
- module Rake
6
- module C
7
- module Dependency
8
- @@store = {}
9
-
10
-
11
- def self.read name, file
12
- dump_of( name ).transaction( true ) do | store |
13
- store[ file ]
14
- end || []
15
- end
16
-
17
-
18
- def self.write name, file, dependency
19
- dump_of( name ).transaction( false ) do | store |
20
- store[ file ] = dependency
21
- end
22
- end
23
-
24
-
25
- def self.dump_of name
26
- @@store[ name ] ||= PStore.new( path( name ) )
27
- end
28
-
29
-
30
- def self.path name
31
- File.join Trema.home, ".#{ name }.depends"
32
- end
33
- end
34
- end
35
- end
36
-
37
-
38
- ### Local variables:
39
- ### mode: Ruby
40
- ### coding: utf-8-unix
41
- ### indent-tabs-mode: nil
42
- ### End:
@@ -1,142 +0,0 @@
1
- require "popen4"
2
- require "rake/c/dependency"
3
- require "rake/clean"
4
- require "rake/tasklib"
5
-
6
-
7
- module Rake
8
- module C
9
- class LibraryTask < TaskLib
10
- attr_accessor :cflags
11
- attr_accessor :includes
12
- attr_accessor :library_name
13
- attr_accessor :name
14
- attr_accessor :target_directory
15
- attr_writer :sources
16
-
17
-
18
- def initialize name, &block
19
- init name
20
- block.call self
21
- define
22
- end
23
-
24
-
25
- def sources
26
- FileList.new @sources
27
- end
28
-
29
-
30
- ##########################################################################
31
- private
32
- ##########################################################################
33
-
34
-
35
- def init name
36
- @name = name
37
- @includes = []
38
- end
39
-
40
-
41
- def define
42
- CLEAN.include objects
43
- CLOBBER.include target_directory
44
- CLOBBER.include Dependency.path( @library_name )
45
-
46
- task name => [ target_directory, target_path ]
47
- directory target_directory
48
-
49
- sources.zip( objects ) do | source, object |
50
- task object => source do | task |
51
- compile task.name, task.prerequisites[ 0 ]
52
- end
53
- end
54
-
55
- file target_path => objects do | task |
56
- generate_library
57
- end
58
- end
59
-
60
-
61
- def generate_library
62
- raise NotImplementedError, "Override this!"
63
- end
64
-
65
-
66
- def target_file_name
67
- raise NotImplementedError, "Override this!"
68
- end
69
-
70
-
71
- def target_path
72
- File.join @target_directory, target_file_name
73
- end
74
-
75
-
76
- def objects
77
- sources.collect do | each |
78
- File.join @target_directory, File.basename( each ).ext( ".o" )
79
- end
80
- end
81
-
82
-
83
- def compile o_file, c_file
84
- return if uptodate?( o_file, [ c_file ] + Dependency.read( library_name, o_file ) )
85
- autodepends = run_gcc_H( "gcc -H #{ gcc_cflags } -fPIC #{ gcc_I_options } -c #{ c_file } -o #{ o_file }" )
86
- Dependency.write( library_name, o_file, autodepends )
87
- end
88
-
89
-
90
- def run_gcc_H command
91
- autodepends = []
92
-
93
- puts command
94
- status = POpen4.popen4( command ) do | stdout, stderr, stdin, pid |
95
- stdin.close
96
- stderr.each do | line |
97
- case line
98
- when /^\./
99
- autodepends << line.sub( /^\.+\s+/, "" ).strip
100
- when /Multiple include guards/
101
- # Filter out include guards warnings.
102
- stderr.each do | line |
103
- if line =~ /:$/
104
- puts line
105
- break
106
- end
107
- end
108
- else
109
- puts line
110
- end
111
- end
112
- end
113
- fail "gcc failed" if status.exitstatus != 0
114
-
115
- autodepends
116
- end
117
-
118
-
119
- def gcc_cflags
120
- @cflags.join " "
121
- end
122
-
123
-
124
- def gcc_I_options
125
- @includes.collect do | each |
126
- "-I#{ each }"
127
- end.join( " " )
128
- end
129
- end
130
- end
131
- end
132
-
133
-
134
- require "rake/c/shared-library-task"
135
- require "rake/c/static-library-task"
136
-
137
-
138
- ### Local variables:
139
- ### mode: Ruby
140
- ### coding: utf-8-unix
141
- ### indent-tabs-mode: nil
142
- ### End:
@@ -1,38 +0,0 @@
1
- require "rake/c/library-task"
2
-
3
-
4
- module Rake
5
- module C
6
- class SharedLibraryTask < LibraryTask
7
- attr_accessor :version
8
-
9
-
10
- ##########################################################################
11
- private
12
- ##########################################################################
13
-
14
-
15
- def generate_library
16
- return if uptodate?( target_path, objects )
17
- sh "gcc -shared -Wl,-soname=#{ soname } -o #{ target_path } #{ objects.to_s }"
18
- end
19
-
20
-
21
- def soname
22
- File.basename( target_file_name ).sub( /\.\d+\.\d+\Z/, "" )
23
- end
24
-
25
-
26
- def target_file_name
27
- @library_name + ".so." + @version
28
- end
29
- end
30
- end
31
- end
32
-
33
-
34
- ### Local variables:
35
- ### mode: Ruby
36
- ### coding: utf-8-unix
37
- ### indent-tabs-mode: nil
38
- ### End:
@@ -1,32 +0,0 @@
1
- require "rake/c/library-task"
2
-
3
-
4
- module Rake
5
- module C
6
- class StaticLibraryTask < LibraryTask
7
- ##########################################################################
8
- private
9
- ##########################################################################
10
-
11
-
12
- def generate_library
13
- if not uptodate?( target_path, objects )
14
- sh "ar -cq #{ target_path } #{ objects.join ' ' }"
15
- sh "ranlib #{ target_path }"
16
- end
17
- end
18
-
19
-
20
- def target_file_name
21
- @library_name + ".a"
22
- end
23
- end
24
- end
25
- end
26
-
27
-
28
- ### Local variables:
29
- ### mode: Ruby
30
- ### coding: utf-8-unix
31
- ### indent-tabs-mode: nil
32
- ### End: