else
@kernels[c.kernel]
end
+ c.masterfs = File.expand_path(c.masterfs) if c.masterfs
h.masterfs = c.masterfs if c.masterfs && (Testing.tarball?(c.masterfs) || File.directory?(c.masterfs))
- h.templates = c.templates if c.templates && (c.templates.empty? || File.directory?(c.templates))
+ c.templates = File.expand_path(c.templates) if c.templates
+ h.templates = c.templates if c.templates && File.directory?(c.templates)
h.mem = c.mem.to_i if c.mem
h.consoles = c.consoles.select { |c| c =~ /^(xterm|pts)$/ } if c.consoles
h.marshal_dump
args << " con#{i.next}=#{con}"
end
# TODO if the masterfs is a tarball, extract that first
- #Dir.chdir(Testing.root) do
- # Guest.new @name, @kernel.path || "/home/tbrunner/tbrunner/testing/umlbuild/linux-uml-2.6.21.1", @masterfs, args
- #end
+
+ # Creating the guests using Guest.new does not work because the union
+ # filesystem doesn't like us copying lots of files to the union directly
+ # when it's mounted. So we have to create the guests manually.
+ # Dir.chdir(Testing.root) do
+ # Guest.new @name, @kernel.path, @masterfs, args
+ # end
Dir.chdir(Testing.guests_dir) do
Dir.mkdir(name, 0775)
Dir.chdir(name) do
end
end
@root = File.join(Testing.guests_dir, name, 'diff')
- tmpl = File.join(@templates, name)
- if File.directory?(tmpl)
- FileUtils.cp_r(tmpl + '/.', @root) # '/.' is required to copy the contents of tmpl and not tmpl itself
+
+ if @templates
+ tmpl = File.join(@templates, name)
+ if File.directory?(tmpl)
+ # '/.' is required to copy the contents of tmpl and not tmpl itself
+ FileUtils.cp_r(tmpl + '/.', @root)
+ end
end
+
@needs_build = false
end
@name = name
@needs_build = true
@source = (config.source || "none").to_sym
+ config.path = File.expand_path(config.path) if config.path
+ config.config = File.expand_path(config.config) if config.config
@config = config.config if File.file?(config.config || "")
config.patches ||= []
- @patches = config.patches.select { |p| File.exists?(p) && p =~ /\.patch(\.(bz2|gz))?$/ }
+ @patches = config.patches.map { |p| File.expand_path(p) }.select{ |p|
+ File.exists?(p) && p =~ /\.patch(\.(bz2|gz))?$/ }
case @source
when :git, :dir
unless File.directory?(config.path)
@needs_build = true
@options = config.options
@source = (config.source || "none").to_sym
+ config.path = File.expand_path(config.path) if config.path
case @source
when :git, :dir
- unless File.directory?(config.path)
+ unless config.path && File.directory?(config.path)
raise "Path '#{config.path}' not found!"
end
@source_path = config.path
@checkout = config.checkout if Testing.git_tree?(@source_path, config.checkout)
end
when :tar
- raise "Tarball '#{config.path}' not found!" unless Testing.tarball?(config.path)
+ raise "Tarball '#{config.path}' not found!" unless config.path && Testing.tarball?(config.path)
@source_path = config.path
else
raise "Specify the source type of strongSwan config '#{name}'"
# Sets root to TESTING_ROOT and canonalizes it. Also sets the build
# and guest dir based on the root.
def set_directories!
- require 'pathname'
raise 'TESTING_ROOT is not set' unless defined?(::TESTING_ROOT)
raise 'TESTING_ROOT is not a directory' unless File.directory?(::TESTING_ROOT)
- @root = Pathname.new(::TESTING_ROOT).realpath.to_s
+ @root = File.expand_path(::TESTING_ROOT)
::TESTING_ROOT.replace @root
@build_dir = File.join(@root, 'build')
@guests_dir = File.join(@root, 'guests')