ruby-yasm 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +3 -0
- data/.gemtest +0 -0
- data/.github/workflows/ruby.yml +30 -0
- data/.gitignore +9 -0
- data/.rspec +1 -0
- data/.specopts +1 -0
- data/.yardopts +1 -0
- data/ChangeLog.md +31 -0
- data/Gemfile +16 -0
- data/LICENSE.txt +20 -0
- data/README.md +83 -0
- data/Rakefile +8 -25
- data/gemspec.yml +18 -0
- data/lib/yasm/command.rb +272 -0
- data/lib/yasm/program.rb +58 -58
- data/lib/yasm/version.rb +1 -1
- data/lib/yasm.rb +1 -0
- data/ruby-yasm.gemspec +58 -0
- data/spec/command_spec.rb +91 -0
- data/spec/program_spec.rb +86 -20
- data/spec/spec_helper.rb +3 -4
- data/spec/yasm_spec.rb +1 -1
- metadata +78 -120
- data/History.rdoc +0 -4
- data/Manifest.txt +0 -17
- data/README.rdoc +0 -85
- data/lib/yasm/task.rb +0 -161
- data/lib/yasm/yasm.rb +0 -142
- data/spec/task_spec.rb +0 -182
- data/tasks/spec.rb +0 -10
- data/tasks/yard.rb +0 -13
- data.tar.gz.sig +0 -0
- metadata.gz.sig +0 -0
data/Manifest.txt
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
History.rdoc
|
2
|
-
Manifest.txt
|
3
|
-
README.rdoc
|
4
|
-
Rakefile
|
5
|
-
lib/yasm.rb
|
6
|
-
lib/yasm/task.rb
|
7
|
-
lib/yasm/program.rb
|
8
|
-
lib/yasm/yasm.rb
|
9
|
-
lib/yasm/version.rb
|
10
|
-
tasks/spec.rb
|
11
|
-
tasks/yard.rb
|
12
|
-
spec/spec_helper.rb
|
13
|
-
spec/helpers/files.rb
|
14
|
-
spec/helpers/files/gas.S
|
15
|
-
spec/task_spec.rb
|
16
|
-
spec/program_spec.rb
|
17
|
-
spec/yasm_spec.rb
|
data/README.rdoc
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
= ruby-yasm
|
2
|
-
|
3
|
-
* http://www.tortall.net/projects/yasm/
|
4
|
-
* http://www.sophsec.com/
|
5
|
-
* Postmodern (postmodern.mod3 at gmail.com)
|
6
|
-
|
7
|
-
== DESCRIPTION:
|
8
|
-
|
9
|
-
A Ruby interface to YASM.
|
10
|
-
|
11
|
-
YASM is a complete rewrite of the NASM assembler, YASM currently supports
|
12
|
-
the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes,
|
13
|
-
outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32,
|
14
|
-
and Win64 object formats, and generates source debugging information in
|
15
|
-
STABS, DWARF 2, and CodeView 8 formats.
|
16
|
-
|
17
|
-
== FEATURES:
|
18
|
-
|
19
|
-
* Supports all of the +yasm+ command-line options.
|
20
|
-
|
21
|
-
== EXAMPLES:
|
22
|
-
|
23
|
-
* Assemble a binary file:
|
24
|
-
|
25
|
-
YASM::Program.assemble do |yasm|
|
26
|
-
yasm.syntax = :gas
|
27
|
-
yasm.file = 'hello_world.S'
|
28
|
-
yasm.output = 'hello_world.o'
|
29
|
-
end
|
30
|
-
|
31
|
-
* Assemble a binary file, and write the output to a temporary file:
|
32
|
-
|
33
|
-
YASM::Program.assemble_temp do |yasm|
|
34
|
-
yasm.syntax = :gas
|
35
|
-
yasm.file = 'hello_world.S'
|
36
|
-
end
|
37
|
-
# => "/tmp/yasm.3386.0"
|
38
|
-
|
39
|
-
* Assemble amd64 assembly, in GAS syntax, into an ELF64 file with
|
40
|
-
debugging information:
|
41
|
-
|
42
|
-
YASM::Program.assemble do |yasm|
|
43
|
-
yasm.target! :amd64
|
44
|
-
|
45
|
-
yasm.syntax = :gas
|
46
|
-
yasm.file = 'hello_world.S'
|
47
|
-
|
48
|
-
yasm.output = 'hello_world.o'
|
49
|
-
yasm.output_format = :elf64
|
50
|
-
yasm.debug_format = :stabs
|
51
|
-
end
|
52
|
-
|
53
|
-
== REQUIREMENTS:
|
54
|
-
|
55
|
-
* {yasm}[http://www.tortall.net/projects/yasm/] >= 0.8.0.
|
56
|
-
* {rprogram}[http://rprogram.rubyforge.org/] >= 0.1.8.
|
57
|
-
|
58
|
-
== INSTALL:
|
59
|
-
|
60
|
-
$ sudo gem install ruby-yasm
|
61
|
-
|
62
|
-
== LICENSE:
|
63
|
-
|
64
|
-
(The MIT License)
|
65
|
-
|
66
|
-
Copyright (c) 2009 Hal Brodigan
|
67
|
-
|
68
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
69
|
-
a copy of this software and associated documentation files (the
|
70
|
-
'Software'), to deal in the Software without restriction, including
|
71
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
72
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
73
|
-
permit persons to whom the Software is furnished to do so, subject to
|
74
|
-
the following conditions:
|
75
|
-
|
76
|
-
The above copyright notice and this permission notice shall be
|
77
|
-
included in all copies or substantial portions of the Software.
|
78
|
-
|
79
|
-
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
80
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
81
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
82
|
-
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
83
|
-
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
84
|
-
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
85
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/lib/yasm/task.rb
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
require 'yasm/yasm'
|
2
|
-
|
3
|
-
require 'rprogram/task'
|
4
|
-
|
5
|
-
module YASM
|
6
|
-
#
|
7
|
-
# == YASM options:
|
8
|
-
#
|
9
|
-
# <tt>--version</tt>:: <tt>yasm.version</tt>
|
10
|
-
# <tt>--license</tt>:: <tt>yasm.license</tt>
|
11
|
-
# <tt>--help</tt>:: <tt>yasm.help</tt>
|
12
|
-
#
|
13
|
-
# <tt>--arch</tt>:: <tt>yasm.arch</tt>
|
14
|
-
# <tt>--parser</tt>:: <tt>yasm.parser</tt>
|
15
|
-
# <tt>--preproc</tt>:: <tt>yasm.preprocessor</tt>
|
16
|
-
# <tt>--oformat</tt>:: <tt>yasm.output_format</tt>
|
17
|
-
# <tt>--dformat</tt>:: <tt>yasm.debug_format</tt>
|
18
|
-
# <tt>--lformat</tt>:: <tt>yasm.list_format</tt>
|
19
|
-
#
|
20
|
-
# <tt>--list</tt>:: <tt>yasm.list_file</tt>
|
21
|
-
# <tt>--objfile</tt>:: <tt>yasm.output</tt>
|
22
|
-
# <tt>--mapfile</tt>:: <tt>yasm.map_file</tt>
|
23
|
-
#
|
24
|
-
# <tt>--machine</tt>:: <tt>yasm.machine</tt>
|
25
|
-
# <tt>--force-strict</tt>:: <tt>yasm.force_strict</tt>
|
26
|
-
# <tt>-w</tt>:: <tt>yasm.inhibit_warnings</tt>
|
27
|
-
# <tt>-W</tt>:: <tt>yasm.toggle_warnings</tt>
|
28
|
-
# <tt>-M</tt>:: <tt>yasm.gen_makefile_deps</tt>
|
29
|
-
# <tt>-E</tt>:: <tt>yasm.redirect_errors_to</tt>
|
30
|
-
# <tt>-e</tt>:: <tt>yasm.redirect_errors</tt>
|
31
|
-
# <tt>--preproc-only</tt>:: <tt>yasm.preprocessor_only</tt>
|
32
|
-
# <tt>-I</tt>:: <tt>yasm.include</tt>
|
33
|
-
# <tt>-P</tt>:: <tt>yasm.pre_include</tt>
|
34
|
-
# <tt>-D</tt>:: <tt>yasm.define</tt>
|
35
|
-
# <tt>-U</tt>:: <tt>yasm.undefine</tt>
|
36
|
-
# <tt>-X</tt>:: <tt>yasm.message_style</tt>
|
37
|
-
# <tt>--prefix</tt>:: <tt>yasm.prefix</tt>
|
38
|
-
# <tt>--suffix</tt>:: <tt>yasm.suffix</tt>
|
39
|
-
#
|
40
|
-
# <tt>file</tt>:: <tt>yasm.file</tt>
|
41
|
-
#
|
42
|
-
class Task < RProgram::Task
|
43
|
-
|
44
|
-
# The known YASM targets
|
45
|
-
TARGETS = {
|
46
|
-
:x86 => {:arch => :x86, :machine => :x86},
|
47
|
-
:amd64 => {:arch => :x86, :machine => :amd64},
|
48
|
-
:lc3b => {:arch => :lc3b, :machine => :lc3b}
|
49
|
-
}
|
50
|
-
|
51
|
-
long_option :flag => '--version'
|
52
|
-
long_option :flag => '--license'
|
53
|
-
long_option :flag => '--help'
|
54
|
-
|
55
|
-
long_option :flag => '--arch', :equals => true
|
56
|
-
long_option :flag => '--parser', :equals => true
|
57
|
-
long_option :flag => '--preproc',
|
58
|
-
:equals => true,
|
59
|
-
:name => :preprocessor
|
60
|
-
long_option :flag => '--oformat',
|
61
|
-
:equals => true,
|
62
|
-
:name => :output_format
|
63
|
-
long_option :flag => '--dformat',
|
64
|
-
:equals => true,
|
65
|
-
:name => :debug_format
|
66
|
-
long_option :flag => '--lformat',
|
67
|
-
:equals => true,
|
68
|
-
:name => :list_format
|
69
|
-
|
70
|
-
long_option :flag => '--list',
|
71
|
-
:equals => true,
|
72
|
-
:name => :list_file
|
73
|
-
long_option :flag => '--objfile',
|
74
|
-
:equals => true,
|
75
|
-
:name => :output
|
76
|
-
long_option :flag => '--mapfile',
|
77
|
-
:equals => true,
|
78
|
-
:name => :map_file
|
79
|
-
|
80
|
-
long_option :flag => '--machine', :equals => true
|
81
|
-
long_option :flag => '--force-strict'
|
82
|
-
short_option :flag => '-w', :name => :inhibit_warnings
|
83
|
-
short_option :flag => '-W', :name => :toggle_warnings
|
84
|
-
short_option :flag => '-M', :name => :gen_makefile_deps
|
85
|
-
short_option :flag => '-E', :name => :redirect_errors_to
|
86
|
-
short_option :flag => '-s', :name => :redirect_errors
|
87
|
-
long_option :flag => '--preproc-only', :name => :preprocessor_only
|
88
|
-
short_option :flag => '-I', :name => :include, :multiple => true
|
89
|
-
short_option :flag => '-P', :name => :pre_include, :multiple => true
|
90
|
-
short_option :flag => '-D', :name => :define, :multiple => true
|
91
|
-
short_option :flag => '-U', :name => :undefine, :multiple => true
|
92
|
-
short_option :flag => '-X', :name => :message_style
|
93
|
-
long_option :flag => '--prefix'
|
94
|
-
long_option :flag => '--suffix'
|
95
|
-
|
96
|
-
non_option :tailing => true, :name => :file
|
97
|
-
|
98
|
-
#
|
99
|
-
# Creates a new Task object.
|
100
|
-
#
|
101
|
-
# @param [Hash{Symbol => Object}] options
|
102
|
-
# Additional options for the task.
|
103
|
-
#
|
104
|
-
# @option options [String, Symbol] :target
|
105
|
-
# The arch/machine to target.
|
106
|
-
#
|
107
|
-
# @yield [task]
|
108
|
-
# If a block is given, it will be passed the newly created task
|
109
|
-
# object.
|
110
|
-
#
|
111
|
-
# @yieldparam [Task] task
|
112
|
-
# The new task object.
|
113
|
-
#
|
114
|
-
# @see Task#target!
|
115
|
-
#
|
116
|
-
def initialize(options={},&block)
|
117
|
-
target = options.delete(:target)
|
118
|
-
|
119
|
-
super(options,&block)
|
120
|
-
|
121
|
-
self.target!(target) if target
|
122
|
-
|
123
|
-
self.parser ||= YASM.parser
|
124
|
-
self.arch ||= YASM.arch
|
125
|
-
self.machine ||= YASM.machine
|
126
|
-
self.debug_format ||= YASM.debug_format
|
127
|
-
self.output_format ||= YASM.output_format
|
128
|
-
end
|
129
|
-
|
130
|
-
#
|
131
|
-
# Sets the YASM +arch+ and +machine+.
|
132
|
-
#
|
133
|
-
# @param [String, Symbol] name
|
134
|
-
# The target name.
|
135
|
-
#
|
136
|
-
# @raise [RuntimeError]
|
137
|
-
# The specified target is unknown.
|
138
|
-
#
|
139
|
-
# @return [true]
|
140
|
-
# The YASM +arch+ and +machine+ options were set successfully.
|
141
|
-
#
|
142
|
-
# @example
|
143
|
-
# yasm.target! :amd64
|
144
|
-
#
|
145
|
-
def target!(name)
|
146
|
-
target = TARGETS[name.to_sym]
|
147
|
-
|
148
|
-
unless target
|
149
|
-
raise(RuntimeError,"unknown YASM target #{name.inspect}",caller)
|
150
|
-
end
|
151
|
-
|
152
|
-
self.arch = target[:arch]
|
153
|
-
self.machine = target[:machine]
|
154
|
-
return true
|
155
|
-
end
|
156
|
-
|
157
|
-
alias syntax parser
|
158
|
-
alias syntax= parser=
|
159
|
-
|
160
|
-
end
|
161
|
-
end
|
data/lib/yasm/yasm.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
module YASM
|
2
|
-
@@yasm_parser = nil
|
3
|
-
@@yasm_arch = nil
|
4
|
-
@@yasm_machine = nil
|
5
|
-
@@yasm_debug_format = nil
|
6
|
-
@@yasm_output_format = nil
|
7
|
-
|
8
|
-
#
|
9
|
-
# The default YASM parser to use.
|
10
|
-
#
|
11
|
-
# @return [Symbol]
|
12
|
-
# The YASM parser.
|
13
|
-
#
|
14
|
-
def YASM.parser
|
15
|
-
@@yasm_parser
|
16
|
-
end
|
17
|
-
|
18
|
-
#
|
19
|
-
# Sets the default YASM parser to use.
|
20
|
-
#
|
21
|
-
# @param [Symbol, String] new_parser
|
22
|
-
# The new YASM parser to use.
|
23
|
-
#
|
24
|
-
# @return [Symbol]
|
25
|
-
# The new YASM parser to use.
|
26
|
-
#
|
27
|
-
def YASM.parser=(new_parser)
|
28
|
-
@@yasm_parser = if new_parser.nil?
|
29
|
-
nil
|
30
|
-
else
|
31
|
-
new_parser.to_sym
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
#
|
36
|
-
# The default YASM architecture to assemble for.
|
37
|
-
#
|
38
|
-
# @return [Symbol]
|
39
|
-
# The YASM architecture.
|
40
|
-
#
|
41
|
-
def YASM.arch
|
42
|
-
@@yasm_arch
|
43
|
-
end
|
44
|
-
|
45
|
-
#
|
46
|
-
# Sets the default YASM architecture to assemble for.
|
47
|
-
#
|
48
|
-
# @param [Symbol, String] new_arch
|
49
|
-
# The new YASM architecture to assemble for.
|
50
|
-
#
|
51
|
-
# @return [Symbol]
|
52
|
-
# The new YASM architecture to assemble for.
|
53
|
-
#
|
54
|
-
def YASM.arch=(new_arch)
|
55
|
-
if new_arch.nil?
|
56
|
-
@@yasm_arch = nil
|
57
|
-
else
|
58
|
-
@@yasm_arch = new_arch.to_sym
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
#
|
63
|
-
# The default YASM machine to assemble for.
|
64
|
-
#
|
65
|
-
# @return [Symbol]
|
66
|
-
# The YASM machine.
|
67
|
-
#
|
68
|
-
def YASM.machine
|
69
|
-
@@yasm_machine ||= nil
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Sets the default YASM machine to assemble for.
|
74
|
-
#
|
75
|
-
# @param [Symbol, String] new_machine
|
76
|
-
# The new YASM machine to assemble for.
|
77
|
-
#
|
78
|
-
# @return [Symbol]
|
79
|
-
# The new YASM machine to assemble for.
|
80
|
-
#
|
81
|
-
def YASM.machine=(new_machine)
|
82
|
-
@@yasm_machine = if new_machine.nil?
|
83
|
-
nil
|
84
|
-
else
|
85
|
-
new_machine.to_sym
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
#
|
90
|
-
# The default YASM debugging format to use.
|
91
|
-
#
|
92
|
-
# @return [Symbol]
|
93
|
-
# The YASM debugging format.
|
94
|
-
#
|
95
|
-
def YASM.debug_format
|
96
|
-
@@yasm_debug_format
|
97
|
-
end
|
98
|
-
|
99
|
-
#
|
100
|
-
# Sets the default YASM debugging format to use.
|
101
|
-
#
|
102
|
-
# @param [Symbol, String] new_format
|
103
|
-
# The new YASM debugging format to use.
|
104
|
-
#
|
105
|
-
# @return [Symbol]
|
106
|
-
# The new YASM debugging format to use.
|
107
|
-
#
|
108
|
-
def YASM.debug_format=(new_format)
|
109
|
-
@@yasm_debug_format = if new_format.nil?
|
110
|
-
nil
|
111
|
-
else
|
112
|
-
new_format.to_sym
|
113
|
-
end
|
114
|
-
end
|
115
|
-
|
116
|
-
#
|
117
|
-
# The default YASM output format to use.
|
118
|
-
#
|
119
|
-
# @return [Symbol]
|
120
|
-
# The YASM output format.
|
121
|
-
#
|
122
|
-
def YASM.output_format
|
123
|
-
@@yasm_output_format
|
124
|
-
end
|
125
|
-
|
126
|
-
#
|
127
|
-
# Sets the default YASM output format to use.
|
128
|
-
#
|
129
|
-
# @param [Symbol, String] new_format
|
130
|
-
# The new YASM output format to use.
|
131
|
-
#
|
132
|
-
# @return [Symbol]
|
133
|
-
# The new YASM output format to use.
|
134
|
-
#
|
135
|
-
def YASM.output_format=(new_format)
|
136
|
-
@@yasm_output_format = if new_format.nil?
|
137
|
-
nil
|
138
|
-
else
|
139
|
-
new_format.to_sym
|
140
|
-
end
|
141
|
-
end
|
142
|
-
end
|
data/spec/task_spec.rb
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
require 'yasm/task'
|
2
|
-
|
3
|
-
require 'spec_helper'
|
4
|
-
|
5
|
-
describe Task do
|
6
|
-
it "should support a :target option" do
|
7
|
-
task = Task.new(:target => :amd64)
|
8
|
-
|
9
|
-
task.arch.should == :x86
|
10
|
-
task.machine.should == :amd64
|
11
|
-
end
|
12
|
-
|
13
|
-
describe "default" do
|
14
|
-
describe "parser" do
|
15
|
-
before(:all) do
|
16
|
-
@old_parser = YASM.parser
|
17
|
-
|
18
|
-
YASM.parser = :tasm
|
19
|
-
end
|
20
|
-
|
21
|
-
it "should have a default parser value" do
|
22
|
-
task = Task.new
|
23
|
-
task.parser.should == :tasm
|
24
|
-
end
|
25
|
-
|
26
|
-
it "should allow overriding the default parser" do
|
27
|
-
task = Task.new(:parser => :gas)
|
28
|
-
task.parser.should == :gas
|
29
|
-
end
|
30
|
-
|
31
|
-
after(:all) do
|
32
|
-
YASM.parser = @old_parser
|
33
|
-
end
|
34
|
-
end
|
35
|
-
|
36
|
-
describe "arch" do
|
37
|
-
before(:all) do
|
38
|
-
@old_arch = YASM.arch
|
39
|
-
|
40
|
-
YASM.arch = :lc3b
|
41
|
-
end
|
42
|
-
|
43
|
-
it "should have a default arch value" do
|
44
|
-
task = Task.new
|
45
|
-
task.arch.should == :lc3b
|
46
|
-
end
|
47
|
-
|
48
|
-
it "should allow overriding the default arch" do
|
49
|
-
task = Task.new(:arch => :x86)
|
50
|
-
task.arch.should == :x86
|
51
|
-
end
|
52
|
-
|
53
|
-
after(:all) do
|
54
|
-
YASM.arch = @old_arch
|
55
|
-
end
|
56
|
-
end
|
57
|
-
|
58
|
-
describe "machine" do
|
59
|
-
before(:all) do
|
60
|
-
@old_machine = YASM.machine
|
61
|
-
|
62
|
-
YASM.machine = :amd64
|
63
|
-
end
|
64
|
-
|
65
|
-
it "should have a default machine value" do
|
66
|
-
task = Task.new
|
67
|
-
task.machine.should == :amd64
|
68
|
-
end
|
69
|
-
|
70
|
-
it "should allow overriding the default machine" do
|
71
|
-
task = Task.new(:machine => :x86)
|
72
|
-
task.machine.should == :x86
|
73
|
-
end
|
74
|
-
|
75
|
-
after(:all) do
|
76
|
-
YASM.machine = @old_machine
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe "debug_format" do
|
81
|
-
before(:all) do
|
82
|
-
@old_debug_format = YASM.debug_format
|
83
|
-
|
84
|
-
YASM.debug_format = :stabs
|
85
|
-
end
|
86
|
-
|
87
|
-
it "should have a default debug_format value" do
|
88
|
-
task = Task.new
|
89
|
-
task.debug_format.should == :stabs
|
90
|
-
end
|
91
|
-
|
92
|
-
it "should allow overriding the default debug_format" do
|
93
|
-
task = Task.new(:debug_format => :null)
|
94
|
-
task.debug_format.should == :null
|
95
|
-
end
|
96
|
-
|
97
|
-
after(:all) do
|
98
|
-
YASM.debug_format = @old_debug_format
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "output_format" do
|
103
|
-
before(:all) do
|
104
|
-
@old_output_format = YASM.output_format
|
105
|
-
|
106
|
-
YASM.output_format = :elf64
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should have a default output_format value" do
|
110
|
-
task = Task.new
|
111
|
-
task.output_format.should == :elf64
|
112
|
-
end
|
113
|
-
|
114
|
-
it "should allow overriding the default output_format" do
|
115
|
-
task = Task.new(:output_format => :bin)
|
116
|
-
task.output_format.should == :bin
|
117
|
-
end
|
118
|
-
|
119
|
-
after(:all) do
|
120
|
-
YASM.output_format = @old_output_format
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
|
125
|
-
describe "target!" do
|
126
|
-
it "should return true for valid targets" do
|
127
|
-
task = Task.new
|
128
|
-
|
129
|
-
task.target!(:amd64).should == true
|
130
|
-
end
|
131
|
-
|
132
|
-
it "should raise RuntimeError when passed unknown targets" do
|
133
|
-
task = Task.new
|
134
|
-
|
135
|
-
lambda {
|
136
|
-
task.target! :lol
|
137
|
-
}.should raise_error(RuntimeError)
|
138
|
-
end
|
139
|
-
|
140
|
-
describe "x86" do
|
141
|
-
before(:all) do
|
142
|
-
@task = Task.new { |task| task.target! :x86 }
|
143
|
-
end
|
144
|
-
|
145
|
-
it "should set the arch value" do
|
146
|
-
@task.arch.should == :x86
|
147
|
-
end
|
148
|
-
|
149
|
-
it "should set the machine value" do
|
150
|
-
@task.machine.should == :x86
|
151
|
-
end
|
152
|
-
end
|
153
|
-
|
154
|
-
describe "amd64" do
|
155
|
-
before(:all) do
|
156
|
-
@task = Task.new { |task| task.target! :amd64 }
|
157
|
-
end
|
158
|
-
|
159
|
-
it "should set the arch value" do
|
160
|
-
@task.arch.should == :x86
|
161
|
-
end
|
162
|
-
|
163
|
-
it "should set the machine value" do
|
164
|
-
@task.machine.should == :amd64
|
165
|
-
end
|
166
|
-
end
|
167
|
-
|
168
|
-
describe "lc3b" do
|
169
|
-
before(:all) do
|
170
|
-
@task = Task.new { |task| task.target! :lc3b }
|
171
|
-
end
|
172
|
-
|
173
|
-
it "should set the arch value" do
|
174
|
-
@task.arch.should == :lc3b
|
175
|
-
end
|
176
|
-
|
177
|
-
it "should set the machine value" do
|
178
|
-
@task.machine.should == :lc3b
|
179
|
-
end
|
180
|
-
end
|
181
|
-
end
|
182
|
-
end
|
data/tasks/spec.rb
DELETED
data/tasks/yard.rb
DELETED
data.tar.gz.sig
DELETED
Binary file
|
metadata.gz.sig
DELETED
Binary file
|