diff options
Diffstat (limited to 'features/support')
-rw-r--r-- | features/support/config.rb | 12 | ||||
-rw-r--r-- | features/support/helpers/exec_helper.rb | 34 | ||||
-rw-r--r-- | features/support/hooks.rb | 2 |
3 files changed, 28 insertions, 20 deletions
diff --git a/features/support/config.rb b/features/support/config.rb index 9db15929..607969ab 100644 --- a/features/support/config.rb +++ b/features/support/config.rb @@ -54,9 +54,9 @@ DEBUG_LOG_PSEUDO_FIFO = "#{$config["TMPDIR"]}/debug_log_pseudo_fifo" DISPLAY = ENV['DISPLAY'] GIT_DIR = ENV['PWD'] KEEP_SNAPSHOTS = !ENV['KEEP_SNAPSHOTS'].nil? -LIVE_USER = cmd_helper(". config/chroot_local-includes/etc/live/config.d/username.conf; echo ${LIVE_USERNAME}").chomp -TAILS_ISO = ENV['TAILS_ISO'] -OLD_TAILS_ISO = ENV['OLD_TAILS_ISO'] || TAILS_ISO +LIVE_USER = "live_user" +TAILS_ISO = ENV['ISO'] +OLD_TAILS_ISO = ENV['OLD_ISO'] || TAILS_ISO TIME_AT_START = Time.now loop do ARTIFACTS_DIR = $config['TMPDIR'] + "/run-" + @@ -76,9 +76,9 @@ end # Constants that are statically initialized. CONFIGURED_KEYSERVER_HOSTNAME = 'hkps.pool.sks-keyservers.net' -LIBVIRT_DOMAIN_NAME = "TailsToaster" +LIBVIRT_DOMAIN_NAME = "DebianToaster" LIBVIRT_DOMAIN_UUID = "203552d5-819c-41f3-800e-2c8ef2545404" -LIBVIRT_NETWORK_NAME = "TailsToasterNet" +LIBVIRT_NETWORK_NAME = "DebianToasterNet" LIBVIRT_NETWORK_UUID = "f2305af3-2a64-4f16-afe6-b9dbf02a597e" MISC_FILES_DIR = "#{Dir.pwd}/features/misc_files" SERVICES_EXPECTED_ON_ALL_IFACES = @@ -104,5 +104,5 @@ TOR_AUTHORITIES = ] VM_XML_PATH = "#{Dir.pwd}/features/domains" -TAILS_SIGNING_KEY = cmd_helper(". #{Dir.pwd}/config/amnesia; echo ${AMNESIA_DEV_KEYID}").tr(' ', '').chomp +#TAILS_SIGNING_KEY = cmd_helper(". #{Dir.pwd}/config/amnesia; echo ${AMNESIA_DEV_KEYID}").tr(' ', '').chomp TAILS_DEBIAN_REPO_KEY = "221F9A3C6FA3E09E182E060BC7988EA7A358D82E" diff --git a/features/support/helpers/exec_helper.rb b/features/support/helpers/exec_helper.rb index 42f6532a..14e12269 100644 --- a/features/support/helpers/exec_helper.rb +++ b/features/support/helpers/exec_helper.rb @@ -1,5 +1,6 @@ require 'json' require 'socket' +require 'io/wait' class VMCommand @@ -12,8 +13,9 @@ class VMCommand def VMCommand.wait_until_remote_shell_is_up(vm, timeout = 90) try_for(timeout, :msg => "Remote shell seems to be down") do - Timeout::timeout(3) do - VMCommand.execute(vm, "echo 'hello?'") + sleep(20) + Timeout::timeout(10) do + VMCommand.execute(vm, "echo 'true'") end end end @@ -34,20 +36,26 @@ class VMCommand socket = TCPSocket.new("127.0.0.1", vm.get_remote_shell_port) debug_log("#{type}ing as #{options[:user]}: #{cmd}") begin - socket.puts(JSON.dump([type, options[:user], cmd])) - s = socket.readline(sep = "\0").chomp("\0") + #socket.puts(JSON.dump([type, options[:user], cmd])) + socket.puts( "\n") + sleep(1) + socket.puts( "\003") + sleep(1) + socket.puts( cmd + "\n") + sleep(1) + while socket.ready? + s = socket.readline(sep = "\n").chomp("\n") + debug_log("#{type} read: #{s}") if not(options[:spawn]) + if ('true' == s) then + break + end + end ensure socket.close end - debug_log("#{type} returned: #{s}") if not(options[:spawn]) - begin - return JSON.load(s) - rescue JSON::ParserError - # The server often returns something unparsable for the very - # first execute() command issued after a VM start/restore - # (generally from wait_until_remote_shell_is_up()) presumably - # because the TCP -> serial link isn't properly setup yet. All - # will be well after that initial hickup, so we just retry. + if ('true' == s) + return true + else return VMCommand.execute(vm, cmd, options) end end diff --git a/features/support/hooks.rb b/features/support/hooks.rb index be8a0235..b3bdecef 100644 --- a/features/support/hooks.rb +++ b/features/support/hooks.rb @@ -129,7 +129,7 @@ end BeforeFeature('@product') do |feature| if TAILS_ISO.nil? - raise "No Tails ISO image specified, and none could be found in the " + + raise "No ISO image specified, and none could be found in the " + "current directory" end if File.exist?(TAILS_ISO) |