fully parallelize the Disassemble builder
This commit is contained in:
parent
a11fab43cb
commit
145d51c825
@ -2,6 +2,7 @@ module Rscons
|
|||||||
module Builders
|
module Builders
|
||||||
# The Disassemble builder produces a disassembly listing of a source file.
|
# The Disassemble builder produces a disassembly listing of a source file.
|
||||||
class Disassemble < Builder
|
class Disassemble < Builder
|
||||||
|
|
||||||
# Return default construction variables for the builder.
|
# Return default construction variables for the builder.
|
||||||
#
|
#
|
||||||
# @param env [Environment] The Environment using the builder.
|
# @param env [Environment] The Environment using the builder.
|
||||||
@ -28,13 +29,28 @@ module Rscons
|
|||||||
def run(target, sources, cache, env, vars)
|
def run(target, sources, cache, env, vars)
|
||||||
vars = vars.merge("_SOURCES" => sources)
|
vars = vars.merge("_SOURCES" => sources)
|
||||||
command = env.build_command("${DISASM_CMD}", vars)
|
command = env.build_command("${DISASM_CMD}", vars)
|
||||||
unless cache.up_to_date?(target, command, sources, env)
|
if cache.up_to_date?(target, command, sources, env)
|
||||||
|
target
|
||||||
|
else
|
||||||
cache.mkdir_p(File.dirname(target))
|
cache.mkdir_p(File.dirname(target))
|
||||||
return false unless env.execute("Disassemble #{target}", command, options: {out: target})
|
ThreadedCommand.new(
|
||||||
cache.register_build(target, command, sources, env)
|
command,
|
||||||
|
short_description: "Disassemble #{target}",
|
||||||
|
system_options: {out: target})
|
||||||
end
|
end
|
||||||
target
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Finalize a build.
|
||||||
|
#
|
||||||
|
# @param options [Hash]
|
||||||
|
# Finalize options.
|
||||||
|
#
|
||||||
|
# @return [String, nil]
|
||||||
|
# The target name on success or nil on failure.
|
||||||
|
def finalize(options)
|
||||||
|
standard_finalize(options)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -439,10 +439,15 @@ EOF
|
|||||||
|
|
||||||
it "supports disassembling object files" do
|
it "supports disassembling object files" do
|
||||||
test_dir("simple")
|
test_dir("simple")
|
||||||
|
|
||||||
result = run_test(rsconsfile: "disassemble.rb")
|
result = run_test(rsconsfile: "disassemble.rb")
|
||||||
expect(result.stderr).to eq ""
|
expect(result.stderr).to eq ""
|
||||||
expect(File.exists?("simple.txt")).to be_truthy
|
expect(File.exists?("simple.txt")).to be_truthy
|
||||||
expect(File.read("simple.txt")).to match /Disassembly of section .text:/
|
expect(File.read("simple.txt")).to match /Disassembly of section .text:/
|
||||||
|
|
||||||
|
result = run_test(rsconsfile: "disassemble.rb")
|
||||||
|
expect(result.stderr).to eq ""
|
||||||
|
expect(result.stdout).to eq ""
|
||||||
end
|
end
|
||||||
|
|
||||||
it "supports preprocessing C sources" do
|
it "supports preprocessing C sources" do
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
module Rscons
|
|
||||||
module Builders
|
|
||||||
describe Disassemble do
|
|
||||||
let(:env) {Environment.new}
|
|
||||||
subject {Disassemble.new}
|
|
||||||
|
|
||||||
it "supports overriding DISASM_CMD construction variable" do
|
|
||||||
cache = "cache"
|
|
||||||
allow(cache).to receive(:up_to_date?) { false }
|
|
||||||
allow(cache).to receive(:mkdir_p) { }
|
|
||||||
allow(cache).to receive(:register_build) { }
|
|
||||||
expect(env).to receive(:execute).with("Disassemble a_file.txt", ["my_disasm", "a_file.exe"], anything).and_return(true)
|
|
||||||
subject.run("a_file.txt", ["a_file.exe"], cache, env, "DISASM_CMD" => ["my_disasm", "${_SOURCES}"])
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user