trema 0.1.3.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rantfile +87 -80
- data/VERSION +1 -1
- data/cruise.rb +3 -3
- data/features/step_definitions/misc_steps.rb +2 -2
- data/features/support/env.rb +3 -3
- data/ruby/trema/command/kill.rb +1 -1
- data/ruby/trema/daemon.rb +3 -3
- data/ruby/trema/executables.rb +36 -54
- data/ruby/trema/link.rb +4 -1
- data/ruby/trema/monkey-patch/module.rb +2 -0
- data/ruby/trema/monkey-patch/module/class-method.rb +40 -0
- data/ruby/trema/open-vswitch.rb +1 -1
- data/ruby/trema/packet_in.c +96 -0
- data/ruby/trema/path.rb +42 -92
- data/ruby/trema/util.rb +6 -1
- data/spec/trema/dsl/runner_spec.rb +31 -8
- data/spec/trema/echo-request_spec.rb +1 -1
- data/spec/trema/executables_spec.rb +22 -41
- data/spec/trema/packet-in_spec.rb +375 -67
- data/spec/trema/packet-out_spec.rb +2 -1
- data/spec/trema/queue-get-config-request_spec.rb +1 -1
- data/src/lib/ipv4.h +18 -1
- data/src/lib/packet_info.h +1 -1
- data/src/lib/packet_parser.c +2 -2
- data/trema +3 -4
- data/trema.gemspec +3 -2
- data/unittests/lib/openflow_message_test.c +1 -1
- data/unittests/lib/packet_parser_test.c +1 -1
- data/unittests/lib/utility_test.c +2 -2
- metadata +5 -5
data/Rantfile
CHANGED
@@ -105,21 +105,6 @@ def dependency name
|
|
105
105
|
end
|
106
106
|
|
107
107
|
|
108
|
-
def trema_include
|
109
|
-
"#{ Trema.home }/src/lib"
|
110
|
-
end
|
111
|
-
|
112
|
-
|
113
|
-
def trema_lib
|
114
|
-
"#{ Trema.home }/objects/lib"
|
115
|
-
end
|
116
|
-
|
117
|
-
|
118
|
-
def openflow_include
|
119
|
-
"#{ Trema.home }/objects/openflow"
|
120
|
-
end
|
121
|
-
|
122
|
-
|
123
108
|
################################################################################
|
124
109
|
# !!!!!! DO NOT MODIFY !!!!!!
|
125
110
|
################################################################################
|
@@ -131,16 +116,12 @@ var :CFLAGS => "-g -std=gnu99 -D_GNU_SOURCE -fno-strict-aliasing -Werror -Wall -
|
|
131
116
|
# Run cbench benchmarks.
|
132
117
|
################################################################################
|
133
118
|
|
119
|
+
|
134
120
|
def cbench_command
|
135
121
|
File.join Trema.objects, "oflops/bin/cbench"
|
136
122
|
end
|
137
123
|
|
138
124
|
|
139
|
-
def trema_cbench_command
|
140
|
-
"./trema run ./objects/examples/cbench_switch/cbench_switch -d"
|
141
|
-
end
|
142
|
-
|
143
|
-
|
144
125
|
def cbench_latency_mode_options
|
145
126
|
"--switches 1 --loops 10 --delay 1000"
|
146
127
|
end
|
@@ -151,9 +132,9 @@ def cbench_throughput_mode_options
|
|
151
132
|
end
|
152
133
|
|
153
134
|
|
154
|
-
def cbench options
|
135
|
+
def cbench controller, options
|
155
136
|
begin
|
156
|
-
sys
|
137
|
+
sys "#{ controller }"
|
157
138
|
sys "#{ cbench_command } #{ options }"
|
158
139
|
ensure
|
159
140
|
sys "./trema killall"
|
@@ -161,12 +142,29 @@ def cbench options
|
|
161
142
|
end
|
162
143
|
|
163
144
|
|
145
|
+
def cbench_c_controller
|
146
|
+
"./trema run ./objects/examples/cbench_switch/cbench_switch -d"
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
def cbench_ruby_controller
|
151
|
+
"./trema run src/examples/cbench_switch/cbench-switch.rb -d"
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
def run_cbench controller
|
156
|
+
cbench controller, cbench_latency_mode_options
|
157
|
+
cbench controller, cbench_throughput_mode_options
|
158
|
+
end
|
159
|
+
|
160
|
+
|
164
161
|
var[ :clean ].include sys[ "callgrind.out.*" ]
|
165
162
|
|
163
|
+
|
166
164
|
def cbench_profile options
|
167
165
|
valgrind = "valgrind --tool=callgrind --trace-children=yes"
|
168
166
|
begin
|
169
|
-
sys "#{ valgrind } #{
|
167
|
+
sys "#{ valgrind } #{ cbench_c_controller }"
|
170
168
|
sys "#{ cbench_command } #{ options }"
|
171
169
|
ensure
|
172
170
|
sys "./trema killall"
|
@@ -174,10 +172,19 @@ def cbench_profile options
|
|
174
172
|
end
|
175
173
|
|
176
174
|
|
177
|
-
desc "Run cbench
|
178
|
-
task
|
179
|
-
|
180
|
-
|
175
|
+
desc "Run the c cbench switch controller to benchmark"
|
176
|
+
task "cbench" => "cbench:c"
|
177
|
+
|
178
|
+
|
179
|
+
desc "Run the c cbench switch controller to benchmark"
|
180
|
+
task "cbench:c" => :default do | t |
|
181
|
+
run_cbench cbench_c_controller
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
desc "Run the ruby cbench switch controller to benchmark"
|
186
|
+
task "cbench:ruby" => :default do | t |
|
187
|
+
run_cbench cbench_ruby_controller
|
181
188
|
end
|
182
189
|
|
183
190
|
|
@@ -219,12 +226,12 @@ gen Directory, Trema.objects
|
|
219
226
|
|
220
227
|
task "vendor:openflow" => Trema.openflow_h
|
221
228
|
file Trema.openflow_h => Trema.objects do
|
222
|
-
sys.unpack_tgz "#{ Trema
|
223
|
-
sys.cp_r "#{ Trema
|
229
|
+
sys.unpack_tgz "#{ Trema.vendor_openflow }.tar.gz", :in => Trema.vendor
|
230
|
+
sys.cp_r "#{ Trema.vendor_openflow }/include/openflow", Trema.objects
|
224
231
|
end
|
225
232
|
|
226
233
|
task "vendor:openflow:distclean" do
|
227
|
-
sys.rm_rf Trema
|
234
|
+
sys.rm_rf Trema.vendor_openflow
|
228
235
|
end
|
229
236
|
|
230
237
|
|
@@ -236,11 +243,11 @@ end
|
|
236
243
|
# from openflow.git/utilities/wireshark_dissectors/openflow directory
|
237
244
|
#
|
238
245
|
desc "Build openflow wireshark plugin"
|
239
|
-
task :openflow_wireshark_plugin => Trema
|
240
|
-
file Trema
|
241
|
-
sys.unpack_tgz "#{ t.name }.tar.gz", :in => Trema
|
246
|
+
task :openflow_wireshark_plugin => Trema.vendor_openflow_git
|
247
|
+
file Trema.vendor_openflow_git do | t |
|
248
|
+
sys.unpack_tgz "#{ t.name }.tar.gz", :in => Trema.vendor
|
242
249
|
subpath = "utilities/wireshark_dissectors/openflow"
|
243
|
-
sys.cd "#{ Trema
|
250
|
+
sys.cd "#{ Trema.vendor_openflow_git }/#{ subpath }" do
|
244
251
|
sys "make"
|
245
252
|
plugin_path = "#{ File.expand_path(" ~ ") }/.wireshark/plugins"
|
246
253
|
sys.cp "packet-openflow.so", plugin_path if File.directory?( plugin_path )
|
@@ -250,7 +257,7 @@ end
|
|
250
257
|
|
251
258
|
task "openflow_wireshark_plugin:clean" => "openflow_wireshark_plugin:distclean"
|
252
259
|
task "openflow_wireshark_plugin:distclean" do
|
253
|
-
sys.rm_rf Trema
|
260
|
+
sys.rm_rf Trema.vendor_openflow_git
|
254
261
|
end
|
255
262
|
|
256
263
|
|
@@ -260,16 +267,16 @@ end
|
|
260
267
|
|
261
268
|
task "vendor:openvswitch" => Trema::Executables.ovs_openflowd
|
262
269
|
file Trema::Executables.ovs_openflowd do
|
263
|
-
sys.unpack_tgz "#{ Trema
|
264
|
-
sys.cd Trema
|
265
|
-
sys "./configure --prefix=#{ Trema.openvswitch } --with-rundir=#{ Trema.
|
270
|
+
sys.unpack_tgz "#{ Trema.vendor_openvswitch }.tar.gz", :in => Trema.vendor
|
271
|
+
sys.cd Trema.vendor_openvswitch do
|
272
|
+
sys "./configure --prefix=#{ Trema.openvswitch } --with-rundir=#{ Trema.sock }"
|
266
273
|
sys "make install"
|
267
274
|
sys "cp ./tests/test-openflowd #{ Trema::Executables.ovs_openflowd }"
|
268
275
|
end
|
269
276
|
end
|
270
277
|
|
271
278
|
task "vendor:openvswitch:distclean" do
|
272
|
-
sys.rm_rf Trema
|
279
|
+
sys.rm_rf Trema.vendor_openvswitch
|
273
280
|
end
|
274
281
|
|
275
282
|
|
@@ -279,15 +286,15 @@ end
|
|
279
286
|
|
280
287
|
task "vendor:oflops" => cbench_command
|
281
288
|
file cbench_command => Trema.openflow_h do
|
282
|
-
sys.unpack_tgz "#{ Trema
|
283
|
-
sys.cd Trema
|
284
|
-
sys "./configure --prefix=#{ Trema.oflops } --with-openflow-src-dir=#{ Trema
|
289
|
+
sys.unpack_tgz "#{ Trema.vendor_oflops }.tar.gz", :in => Trema.vendor
|
290
|
+
sys.cd Trema.vendor_oflops do
|
291
|
+
sys "./configure --prefix=#{ Trema.oflops } --with-openflow-src-dir=#{ Trema.vendor_openflow }"
|
285
292
|
sys "make install"
|
286
293
|
end
|
287
294
|
end
|
288
295
|
|
289
296
|
task "vendor:oflops:distclean" do
|
290
|
-
sys.rm_rf Trema
|
297
|
+
sys.rm_rf Trema.vendor_oflops
|
291
298
|
end
|
292
299
|
|
293
300
|
|
@@ -296,7 +303,7 @@ end
|
|
296
303
|
#
|
297
304
|
|
298
305
|
def phost_src
|
299
|
-
File.join Trema
|
306
|
+
File.join Trema.vendor_phost, "src"
|
300
307
|
end
|
301
308
|
|
302
309
|
|
@@ -335,15 +342,15 @@ end
|
|
335
342
|
|
336
343
|
task "vendor:cmockery" => Trema.libcmockery_a
|
337
344
|
file Trema.libcmockery_a do
|
338
|
-
sys.unpack_tgz "#{ Trema
|
339
|
-
sys.cd Trema::
|
345
|
+
sys.unpack_tgz "#{ Trema.vendor_cmockery }.tar.gz", :in => Trema.vendor
|
346
|
+
sys.cd Trema::vendor_cmockery do
|
340
347
|
sys "./configure --prefix=#{ Trema.cmockery }"
|
341
348
|
sys "make install"
|
342
349
|
end
|
343
350
|
end
|
344
351
|
|
345
352
|
task "vendor:cmockery:distclean" do
|
346
|
-
sys.rm_rf Trema
|
353
|
+
sys.rm_rf Trema.vendor_cmockery
|
347
354
|
end
|
348
355
|
|
349
356
|
|
@@ -360,24 +367,24 @@ end
|
|
360
367
|
|
361
368
|
task dependency( "libtrema" ) => "vendor:openflow"
|
362
369
|
gen C::Dependencies, dependency( "libtrema" ),
|
363
|
-
:search => [
|
364
|
-
:sources => sys[ "#{
|
370
|
+
:search => [ Trema.include, objects( "openflow" ) ],
|
371
|
+
:sources => sys[ "#{ Trema.include }/*.c" ]
|
365
372
|
|
366
373
|
gen Action do
|
367
374
|
source dependency( "libtrema" )
|
368
375
|
end
|
369
376
|
|
370
377
|
|
371
|
-
gen Directory,
|
378
|
+
gen Directory, Trema.lib
|
372
379
|
gen Directory, "#{ Trema.home }/objects/unittests"
|
373
380
|
|
374
|
-
libtrema = File.join(
|
381
|
+
libtrema = File.join( Trema.lib, "libtrema.a" )
|
375
382
|
libtrema_gcov = File.join( "#{ Trema.home }/objects/unittests", "libtrema.a" )
|
376
383
|
|
377
|
-
libtrema_o = gen DirectedRule,
|
384
|
+
libtrema_o = gen DirectedRule, Trema.lib => [ Trema.include ], :o => :c do | t |
|
378
385
|
sys "gcc -I#{ objects "openflow" } #{ var :CFLAGS } -fPIC -c -o #{ t.name } #{ t.source }"
|
379
386
|
end
|
380
|
-
libtrema_gcov_o = gen DirectedRule, "#{ Trema.home }/objects/unittests" => [
|
387
|
+
libtrema_gcov_o = gen DirectedRule, "#{ Trema.home }/objects/unittests" => [ Trema.include ], :o => :c do | t |
|
381
388
|
sys "gcc --coverage -I#{ objects "openflow" } #{ var :CFLAGS } -fPIC -c -o #{ t.name } #{ t.source }"
|
382
389
|
end
|
383
390
|
|
@@ -406,7 +413,7 @@ desc "Build ruby library."
|
|
406
413
|
task :rubylib => "ruby/trema.so"
|
407
414
|
file "ruby/trema.so" => FileList[ "ruby/trema/*.c", "ruby/trema/*.h", libtrema ] do
|
408
415
|
sys.cd "ruby" do
|
409
|
-
sys "ruby extconf.rb --with-trema-include=#{
|
416
|
+
sys "ruby extconf.rb --with-trema-include=#{ Trema.include } --with-trema-lib=#{ Trema.lib } --with-openflow-include=#{ Trema.openflow }"
|
410
417
|
sys "make"
|
411
418
|
end
|
412
419
|
end
|
@@ -430,7 +437,7 @@ end
|
|
430
437
|
switch_manager_objects_dir = objects( "switch_manager" )
|
431
438
|
|
432
439
|
gen C::Dependencies, dependency( "switch_manager" ),
|
433
|
-
:search => [ "src/switch_manager",
|
440
|
+
:search => [ "src/switch_manager", Trema.include ], :sources => sys[ "src/switch_manager/*.c" ]
|
434
441
|
|
435
442
|
gen Action do
|
436
443
|
source dependency( "switch_manager" )
|
@@ -440,7 +447,7 @@ end
|
|
440
447
|
gen Directory, switch_manager_objects_dir
|
441
448
|
|
442
449
|
gen DirectedRule, switch_manager_objects_dir => [ "src/switch_manager" ], :o => :c do | t |
|
443
|
-
sys "gcc -I#{
|
450
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
444
451
|
end
|
445
452
|
|
446
453
|
|
@@ -455,7 +462,7 @@ end
|
|
455
462
|
desc "Build switch manager."
|
456
463
|
task :switch_manager => Trema::Executables.switch_manager
|
457
464
|
file Trema::Executables.switch_manager => switch_manager_objects + [ libtrema ] do | t |
|
458
|
-
sys "gcc -L#{
|
465
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
|
459
466
|
end
|
460
467
|
|
461
468
|
|
@@ -475,7 +482,7 @@ end
|
|
475
482
|
desc "Build switch."
|
476
483
|
task :switch => Trema::Executables.switch
|
477
484
|
file Trema::Executables.switch => switch_objects + [ libtrema ] do | t |
|
478
|
-
sys "gcc -L#{
|
485
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
|
479
486
|
end
|
480
487
|
|
481
488
|
|
@@ -484,7 +491,7 @@ end
|
|
484
491
|
################################################################################
|
485
492
|
|
486
493
|
gen C::Dependencies, dependency( "packetin_filter" ),
|
487
|
-
:search => [ "src/packetin_filter",
|
494
|
+
:search => [ "src/packetin_filter", Trema.include ], :sources => sys[ "src/packetin_filter/*.c" ]
|
488
495
|
|
489
496
|
gen Action do
|
490
497
|
source dependency( "packetin_filter" )
|
@@ -494,13 +501,13 @@ end
|
|
494
501
|
gen Directory, objects( "packetin_filter" )
|
495
502
|
|
496
503
|
packetin_filter_objects = gen DirectedRule, objects( "packetin_filter" ) => [ "src/packetin_filter" ], :o => :c do | t |
|
497
|
-
sys "gcc -I#{
|
504
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
498
505
|
end
|
499
506
|
|
500
507
|
desc "Build packetin filter."
|
501
508
|
task :packetin_filter => Trema::Executables.packetin_filter
|
502
509
|
file Trema::Executables.packetin_filter => packetin_filter_objects.candidates + [ libtrema ] do | t |
|
503
|
-
sys "gcc -L#{
|
510
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
|
504
511
|
end
|
505
512
|
|
506
513
|
|
@@ -511,7 +518,7 @@ end
|
|
511
518
|
tremashark_objects_dir = objects( "tremashark" )
|
512
519
|
|
513
520
|
gen C::Dependencies, dependency( "tremashark" ),
|
514
|
-
:search => [ "src/tremashark",
|
521
|
+
:search => [ "src/tremashark", Trema.include ], :sources => sys[ "src/tremashark/*.c" ]
|
515
522
|
|
516
523
|
gen Action do
|
517
524
|
source dependency( "tremashark" )
|
@@ -521,7 +528,7 @@ end
|
|
521
528
|
gen Directory, tremashark_objects_dir
|
522
529
|
|
523
530
|
gen DirectedRule, tremashark_objects_dir => [ "src/tremashark" ], :o => :c do | t |
|
524
|
-
sys "gcc -I#{
|
531
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
525
532
|
end
|
526
533
|
|
527
534
|
|
@@ -536,7 +543,7 @@ end
|
|
536
543
|
desc "Build tremashark."
|
537
544
|
task :tremashark => Trema::Executables.tremashark
|
538
545
|
file Trema::Executables.tremashark => tremashark_objects + [ libtrema ] do | t |
|
539
|
-
sys "gcc -L#{
|
546
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
|
540
547
|
end
|
541
548
|
|
542
549
|
|
@@ -550,7 +557,7 @@ end
|
|
550
557
|
desc "Build packet_capture."
|
551
558
|
task :packet_capture => Trema::Executables.packet_capture
|
552
559
|
file Trema::Executables.packet_capture => packet_capture_objects + [ libtrema ] do | t |
|
553
|
-
sys "gcc -L#{
|
560
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
|
554
561
|
end
|
555
562
|
|
556
563
|
|
@@ -563,7 +570,7 @@ end
|
|
563
570
|
desc "Build syslog_relay."
|
564
571
|
task :syslog_relay => Trema::Executables.syslog_relay
|
565
572
|
file Trema::Executables.syslog_relay => syslog_relay_objects + [ libtrema ] do | t |
|
566
|
-
sys "gcc -L#{
|
573
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
|
567
574
|
end
|
568
575
|
|
569
576
|
|
@@ -576,7 +583,7 @@ end
|
|
576
583
|
desc "Build stdin_relay."
|
577
584
|
task :stdin_relay => Trema::Executables.stdin_relay
|
578
585
|
file Trema::Executables.stdin_relay => stdin_relay_objects + [ libtrema ] do | t |
|
579
|
-
sys "gcc -L#{
|
586
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt -lpcap"
|
580
587
|
end
|
581
588
|
|
582
589
|
|
@@ -603,7 +610,7 @@ standalone_examples.each do | each |
|
|
603
610
|
target = objects( "examples/#{ each }/#{ each }" )
|
604
611
|
|
605
612
|
gen C::Dependencies, dependency( each ),
|
606
|
-
:search => [ "src/examples/#{ each }",
|
613
|
+
:search => [ "src/examples/#{ each }", Trema.include ], :sources => sys[ "src/examples/#{ each }/*.c" ]
|
607
614
|
|
608
615
|
gen Action do
|
609
616
|
source dependency( each )
|
@@ -613,14 +620,14 @@ standalone_examples.each do | each |
|
|
613
620
|
gen Directory, objects_dir
|
614
621
|
|
615
622
|
objects = gen DirectedRule, objects_dir => [ "src/examples/#{ each }" ], :o => :c do | t |
|
616
|
-
sys "gcc -I#{
|
623
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
617
624
|
end
|
618
625
|
|
619
626
|
|
620
627
|
desc "Build #{ each } example."
|
621
628
|
task "examples:#{ each }" => target
|
622
629
|
file target => objects.candidates + [ libtrema ] do | t |
|
623
|
-
sys "gcc -L#{
|
630
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ sys.sp t.prerequisites } -ltrema -lsqlite3 -ldl -lrt"
|
624
631
|
end
|
625
632
|
end
|
626
633
|
|
@@ -641,7 +648,7 @@ openflow_message_source_dir = "src/examples/openflow_message"
|
|
641
648
|
openflow_message_objects_dir = objects( "examples/openflow_message" )
|
642
649
|
|
643
650
|
gen C::Dependencies, dependency( "openflow_message" ),
|
644
|
-
:search => [
|
651
|
+
:search => [ Trema.include ], :sources => sys[ "#{ openflow_message_source_dir }/*.c" ]
|
645
652
|
|
646
653
|
gen Action do
|
647
654
|
source dependency( "openflow_message" )
|
@@ -651,7 +658,7 @@ gen Directory, openflow_message_objects_dir
|
|
651
658
|
|
652
659
|
|
653
660
|
gen DirectedRule, openflow_message_objects_dir => [ openflow_message_source_dir ], :o => :c do | t |
|
654
|
-
sys "gcc -I#{
|
661
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
655
662
|
end
|
656
663
|
|
657
664
|
|
@@ -659,7 +666,7 @@ openflow_messages.each do | each |
|
|
659
666
|
target = File.join( openflow_message_objects_dir, each )
|
660
667
|
task "examples:openflow_message" => target
|
661
668
|
file target => [ File.join( openflow_message_objects_dir, "#{ each }.o" ), libtrema ] do | t |
|
662
|
-
sys "gcc -L#{
|
669
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } -ltrema -lsqlite3 -ldl -lrt"
|
663
670
|
end
|
664
671
|
end
|
665
672
|
|
@@ -680,7 +687,7 @@ packetin_filter_config_source_dir = "src/examples/packetin_filter_config"
|
|
680
687
|
packetin_filter_config_objects_dir = objects( "examples/packetin_filter_config" )
|
681
688
|
|
682
689
|
gen C::Dependencies, dependency( "packetin_filter_config" ),
|
683
|
-
:search => [
|
690
|
+
:search => [ Trema.include ], :sources => sys[ "#{ packetin_filter_config_source_dir }/*.c" ]
|
684
691
|
|
685
692
|
gen Action do
|
686
693
|
source dependency( "packetin_filter_config" )
|
@@ -690,7 +697,7 @@ gen Directory, packetin_filter_config_objects_dir
|
|
690
697
|
|
691
698
|
|
692
699
|
gen DirectedRule, packetin_filter_config_objects_dir => [ packetin_filter_config_source_dir ], :o => :c do | t |
|
693
|
-
sys "gcc -I#{
|
700
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
694
701
|
end
|
695
702
|
|
696
703
|
|
@@ -703,7 +710,7 @@ packetin_filter_config.each do | each |
|
|
703
710
|
packetin_filter_config_utils_o,
|
704
711
|
libtrema
|
705
712
|
] do | t |
|
706
|
-
sys "gcc -L#{
|
713
|
+
sys "gcc -L#{ Trema.lib } -o #{ t.name } #{ t.source } #{ packetin_filter_config_utils_o } -ltrema -lsqlite3 -ldl -lrt"
|
707
714
|
end
|
708
715
|
end
|
709
716
|
|
@@ -743,7 +750,7 @@ end
|
|
743
750
|
|
744
751
|
|
745
752
|
gen C::Dependencies, dependency( "unittests" ),
|
746
|
-
:search => [
|
753
|
+
:search => [ Trema.include, "unittests" ], :sources => sys[ "unittests/lib/*.c", "src/lib/*.c" ]
|
747
754
|
|
748
755
|
gen Action do
|
749
756
|
source dependency( "unittests" )
|
@@ -754,7 +761,7 @@ gen Directory, "unittests/objects"
|
|
754
761
|
gen Directory, "objects/unittests"
|
755
762
|
|
756
763
|
gen DirectedRule, "unittests/objects" => [ "unittests", "unittests/lib", "src/lib" ], :o => :c do | t |
|
757
|
-
sys "gcc -I#{
|
764
|
+
sys "gcc -I#{ Trema.include } -I#{ Trema.openflow } -I#{ File.dirname Trema.cmockery_h } -Iunittests -DUNIT_TESTING --coverage #{ var :CFLAGS } -c -o #{ t.name } #{ t.source }"
|
758
765
|
end
|
759
766
|
|
760
767
|
|
@@ -790,7 +797,7 @@ tests = [
|
|
790
797
|
|
791
798
|
|
792
799
|
file "objects/unittests/cmockery_trema.o" do | t |
|
793
|
-
sys "gcc --coverage -c unittests/#{ File.basename t.name, ".o" }.c -o #{ t.name } #{ var :CFLAGS } -I#{
|
800
|
+
sys "gcc --coverage -c unittests/#{ File.basename t.name, ".o" }.c -o #{ t.name } #{ var :CFLAGS } -I#{ Trema.include } -I#{ File.dirname Trema.cmockery_h } -Iunittests"
|
794
801
|
end
|
795
802
|
|
796
803
|
|
@@ -798,7 +805,7 @@ tests.each do | each |
|
|
798
805
|
task :build_unittests => [ "coverage:libtrema", each ]
|
799
806
|
task each => [ "coverage:libtrema", "vendor:cmockery", "objects/unittests/cmockery_trema.o", "#{ Trema.home }/objects/unittests" ]
|
800
807
|
file each => "unittests/lib/#{ File.basename each }.c" do | t |
|
801
|
-
sys "gcc --coverage -c unittests/lib/#{ File.basename t.name }.c -o #{ each }.o #{ var :CFLAGS } -I#{
|
808
|
+
sys "gcc --coverage -c unittests/lib/#{ File.basename t.name }.c -o #{ each }.o #{ var :CFLAGS } -I#{ Trema.include } -I#{ Trema.openflow } -I#{ File.dirname Trema.cmockery_h } -Iunittests"
|
802
809
|
sys "gcc --coverage -o #{ t.name } #{ each }.o objects/unittests/cmockery_trema.o -Lobjects/unittests -L#{ File.dirname Trema.libcmockery_a } -ltrema -lrt -lcmockery -lsqlite3 -ldl -lpthread --static"
|
803
810
|
end
|
804
811
|
end
|