add -j and -m flags to control VM processors, make procs and VM memory

git-archive
devrandom 13 years ago
parent 1307161541
commit d60397616d

@ -5,7 +5,7 @@ require 'yaml'
require 'fileutils'
require 'pathname'
@options = {}
@options = {:num_procs => 2, :memory => 2000}
@bitness = {
'i386' => 32,
@ -83,7 +83,7 @@ def build_one_configuration(suite, arch, build_desc, reference_datetime)
script.puts "set -e"
script.puts "export OUTDIR=$HOME/out"
script.puts "GBUILD_BITS=#{bits}"
script.puts "MAKEOPTS=(-j2)"
script.puts "MAKEOPTS=(-j#{@options[:num_procs]})"
(ref_date, ref_time) = reference_datetime.split
script.puts "REFERENCE_DATETIME='#{reference_datetime}'"
script.puts "REFERENCE_DATE='#{ref_date}'"
@ -112,6 +112,12 @@ OptionParser.new do |opts|
opts.on("-q", "--quiet", "be quiet") do |v|
@options[:quiet] = v
end
opts.on("-j PROCS", "--num-make PROCS", "number of processes to use") do |v|
@options[:num_procs] = v
end
opts.on("-m MEM", "--memory MEM", "memory to allocate in MiB") do |v|
@options[:memory] = v
end
opts.on("-c PAIRS", "--commit PAIRS", "comma separated list of DIRECTORY=COMMIT pairs") do |v|
@options[:commit] = v
end
@ -126,6 +132,8 @@ libexec_dir = base_dir + 'libexec'
ENV['PATH'] = libexec_dir.to_s + ":" + ENV['PATH']
ENV['GITIAN_BASE'] = base_dir.to_s
ENV['NPROCS'] = @options[:num_procs].to_s
ENV['VMEM'] = @options[:memory].to_s
build_desc_file = ARGV.shift or raise "must supply YAML build description file"

@ -5,7 +5,7 @@
ARCH=qemu$1
SUFFIX=$2
kvm -cpu $ARCH -m 2000 -smp 2 -drive file=target-$SUFFIX.qcow2 -net nic,model=virtio -net user,hostfwd=tcp::$VM_SSH_PORT-:22 -vnc :16 > var/target.log 2>&1 &
kvm -cpu $ARCH -m ${VMEM:-2000} -smp ${NPROCS:-2} -drive file=target-$SUFFIX.qcow2 -net nic,model=virtio -net user,hostfwd=tcp::$VM_SSH_PORT-:22 -vnc :16 > var/target.log 2>&1 &
echo $! > var/target.pid
wait

Loading…
Cancel
Save