lib/uttk/strategies/Configure.rb in uttk-0.3.6.1 vs lib/uttk/strategies/Configure.rb in uttk-0.4.5.0
- old
+ new
@@ -1,50 +1,59 @@
# Author:: Nicolas Pouillard <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License:: LGPL
-# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Configure.rb 22112 2006-02-22T08:30:11.236459Z pouillar $
+# $Id: /w/fey/uttk/trunk/lib/uttk/strategies/Configure.rb 24394 2006-07-10T07:38:58.276210Z ertai $
module Uttk
module Strategies
# I run then check whether the configure stage of a compilation process fail.
# I used in the _Package_ strategy to handle the configuration stage.
- class Configure < Proxy
+ class Configure < Strategy
include Concrete
CONFIGURE = /^configure(\.sh)?$/
CONFIGURE_INPUT = /^configure\.(ac|in)$/
- def mk_command ( script )
- cmd = script.to_s
- cmd += " --prefix=#@prefix" if @prefix
- if @flags.is_a? Array
- @flags = @flags.join(' ')
- else
- @flags = @flags.to_s
- end
- symtbl_configure_flags = @symtbl[:configure_flags]
- @flags += ' ' + symtbl_configure_flags unless symtbl_configure_flags.nil?
- @symtbl[:configure_flags] = @flags
- cmd + ' ' + @flags
- end
-
def prologue
super
- @dir = Pathname.new(@dir)
+ @runner = mk_system_runner
+ @dir = @dir.to_path
if script = self.class.have_configure?(@dir)
- create(Cmd) do |test|
- test.name = 'command'
- test.exit = 0
- test.dir = @dir
- test.command = mk_command(script)
- test.verbose_print = true
- test.reject :strategy, :dir
- end
+ flags = @flags.to_ocmd_args + @symtbl[:configure_flags].to_ocmd_args
+ flags << "--prefix=#@prefix" if @prefix
+ @symtbl[:configure_flags] = flags
+ @configure = script.to_ocmd + @flags
+ @configure.dir = @dir
end
end
+ protected :prologue
+
+ def run_impl
+ @my_data = @configure.run @runner
+ end
+ protected :run_impl
+
+ def assertion
+ assert_cmd UM::StreamMatcher, @my_data,
+ :exit => 0, :error => nil, :output => nil
+ pass
+ end
+ protected :assertion
+
+ def abort_hook
+ @runner.abort @my_data if @runner and defined? @my_data
+ super
+ end
+ protected :abort_hook
+
+ def epilogue
+ @my_data.clean if defined? @my_data
+ super
+ end
+ protected :epilogue
def self.have_configure_input? ( dir=Pathname.new('.') )
res = dir.entries.find { |ent| ent.to_s =~ CONFIGURE_INPUT }
(res.nil?) ? nil : dir + res
end