Changeset 597
- Timestamp:
- 03/29/07 15:30:13 (2 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bin/applications/nightly_build_test_infrastructure/chroot.rb
r595 r597 60 60 @logger.info " release: #{@release}" 61 61 @logger.info " architecture: #{@arch}" 62 @logger.info " log_file: #{@log_file}" 62 63 63 64 run "#{@sudo}mkdir #{@complete_path}" 64 run "#{@sudo}debootstrap #{@release} #{@complete_path} http://ftp.debian.org/debian/ >> #{@log_file}" 65 run "#{@sudo}touch \"#{@log_file}\"" 66 run "#{@sudo}chmod 777 \"#{@log_file}\"" 67 run "#{@sudo}debootstrap #{@release} #{@complete_path} http://ftp.debian.org/debian/ >> \"#{@log_file}\"" 65 68 run "#{@sudo}cp /etc/fstab /root/fstab.orig" 66 69 run "#{@sudo}echo \"/proc #{@complete_path}/proc proc defaults 0 0\" >> /etc/fstab" … … 80 83 # to ask for trusting the certificate). 81 84 def install_subversion_and_add_ssl_certificate havanawave_certificate 82 run "#{@sudo}chroot #{@complete_path} apt-get update >> #{@log_file}"83 run "#{@sudo}chroot #{@complete_path} apt-get -y install subversion >> #{@log_file}"85 run "#{@sudo}chroot #{@complete_path} apt-get update >> \"#{@log_file}\"" 86 run "#{@sudo}chroot #{@complete_path} apt-get -y install subversion >> \"#{@log_file}\"" 84 87 run "#{@sudo}cp #{havanawave_certificate} #{@complete_path}/root/" 85 88 run "#{@sudo}echo \"ssl-authority-files = /root/#{File.basename havanawave_certificate}\" >> #{@complete_path}/etc/subversion/servers" … … 88 91 # This method copies the HefeWeizen installation script 89 92 def get_hefeweizen_installation_script command 90 run "#{@sudo}chroot #{@complete_path} #{command} >> #{@log_file}"93 run "#{@sudo}chroot #{@complete_path} #{command} >> \"#{@log_file}\"" 91 94 end 92 95 93 96 # This method runs the HefeWeizen installation inside the chroot. 94 97 def run_hefeweizen_installation 95 run "#{@sudo}chroot #{@complete_path} sh hefeweizen-installation.sh >> #{@log_file}"98 run "#{@sudo}chroot #{@complete_path} sh hefeweizen-installation.sh >> \"#{@log_file}\"" 96 99 end 97 100 … … 104 107 # This mehtod starts the HefeWeizen system 105 108 def start_hefeweizen 106 run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-hefeweizen.sh & >> #{@log_file}"109 run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-hefeweizen.sh & >> \"#{@log_file}\"" 107 110 end 108 111 109 112 # This method starts the HefeWeizen Test system 110 113 def start_tester 111 run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-tester.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin >> #{@log_file}"114 run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/run-tester.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin >> \"#{@log_file}\"" 112 115 end 113 116 114 117 # This method stops the HefeWeizen sytem. 115 118 def stop_hefeweizen 116 run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/stop-hefeweizen.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/ >> #{@log_file}"119 run "#{@sudo}chroot #{@complete_path} sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/bin/stop-hefeweizen.sh /usr/local/src/HefeWeizenProject/HefeWeizen/trunk/ >> \"#{@log_file}\"" 117 120 end 118 121 … … 138 141 system command 139 142 if $? != 0 then 140 raise Exception.new "Error executing command '#{command}'"143 raise Exception.new( "Error executing command '#{command}'" ) 141 144 end 142 145 end trunk/bin/applications/nightly_build_test_infrastructure/hefeweizen-test-system.rb
r596 r597 62 62 @use_sudo = sudo 63 63 @target_path = target_path 64 FileUtils.mkdir_p "#{@target_path}/#{CHROOT_PATH}" unless FileTest.exists? "#{@target_path}/#{CHROOT_PATH}"65 FileUtils.mkdir_p "#{@target_path}/#{RESULTS_PATH}" unless FileTest.exists? "#{@target_path}/#{RESULTS_PATH}"66 64 end 67 65 … … 82 80 path = chroot.create 83 81 @logger.info "Created new chroot with the name '#{chroot_name}' at the following path: #{path}" 84 85 86 87 82 @logger.info "Installing subversion and setting up ssl certificate" 88 83 if FileTest.exists? "./havanawave.pem" then 89 84 chroot.install_subversion_and_add_ssl_certificate "./havanawave.pem" # "/home/sacha/project/havanawave.pem" 90 85 else 91 raise Exception.new "Unable to locate 'havanawave.pem' public server certificate"86 raise Exception.new( "Unable to locate 'havanawave.pem' public server certificate" ) 92 87 end 93 88 … … 157 152 158 153 time_start = Time.now 159 log_file = "#{options.path}/#{RESULTS_PATH}/hefeweizen-test-system-#{time_start.to_f}_#{time_start.to_s.gsub(/ /, "_")}.log"160 @logger = Logger.new(log_file)161 @logger.level = Logger::DEBUG162 154 163 @logger.info "HefeWeizen CHROOT Test System" 164 @logger.info "Path to install: #{options.path}" 155 begin 156 sudo = options.sudo == true ? "sudo " : "" 157 system "#{sudo}mkdir -p \"#{options.path}/#{CHROOT_PATH}\"" unless FileTest.exists? "#{options.path}/#{CHROOT_PATH}" 158 system "#{sudo}mkdir -p \"#{options.path}/#{RESULTS_PATH}\"" unless FileTest.exists? "#{options.path}/#{RESULTS_PATH}" 159 log_file = "#{options.path}/#{RESULTS_PATH}/hefeweizen-test-system-#{time_start.to_f}_#{time_start.to_s.gsub(/ /, "_")}.log" 160 system "#{sudo}touch \"#{log_file}\"" 161 system "#{sudo}chmod 777 \"#{log_file}\"" 165 162 166 time_start = Time.now 167 @logger.info "Time start: #{time_start}" 168 result = HefeWeizenTester.new(options.path, options.sudo, @logger).run 169 time_end = Time.now 170 @logger.info "Time end: #{time_end}" 171 @logger.info "-> total time: #{time_end - time_start}" 163 @logger = Logger.new(log_file) 164 @logger.level = Logger::DEBUG 165 @logger.info "HefeWeizen CHROOT Test System" 166 @logger.info "Path to install: #{options.path}" 167 168 time_start = Time.now 169 @logger.info "Time start: #{time_start}" 170 result = HefeWeizenTester.new(options.path, options.sudo, @logger).run 171 time_end = Time.now 172 @logger.info "Time end: #{time_end}" 173 @logger.info "-> total time: #{time_end - time_start}" 174 175 @logger.error "Error" if result != 0 176 177 exit result 178 179 rescue Exception => e 180 $stderr.puts "Exception: #{e.to_s}" 181 $stderr.puts "Exception details: #{e.inspect}" 182 exit -1 183 end 172 184 173 @logger.error "Error" if result != 0174 175 exit result
