Unverified Commit 9e3de228 authored by intrigeri's avatar intrigeri
Browse files

Test suite: drop workarounds for running on Stretch

parent ce674af9
#!/usr/bin/env python3
# XXX:Buster: when we drop support for Stretch we can remove this
# import.
from __future__ import print_function
import cv2
import os
import sys
......
......@@ -226,10 +226,8 @@ When /^I fill a (\d+) MiB file with a known pattern on the (persistent|root) fil
end
# Note that `yes` prints its own newline, so we have to skip it in
# `pattern` below.
# XXX:Stretch: once we drop support < Buster we can improve the
# expression below to `pattern[..-2]`.
$vm.execute_successfully(
"yes #{pattern[0, pattern.length - 1]} | " \
"yes #{pattern[0..-2]} | " \
"dd of=#{dest_file} bs=#{pattern.size} count=#{pattern_nb}"
)
end
......
......@@ -104,14 +104,7 @@ end
When /^I hotplug a network device( and wait for it to be initialized)?$/ do |wait|
initial_nr_nics = wait ? all_ethernet_nics.size : nil
# XXX:Buster: when we stop supporting the test suite on Stretch
# hosts, let's remove this workaround related to #14819 and just
# settle on a device that works on all supported platforms.
device = if cmd_helper('lsb_release --short --codename').chomp == 'stretch'
'virtio'
else
'pcnet'
end
device = 'pcnet'
debug_log("Hotplugging a '#{device}' network device")
xml = <<-XML
<interface type='network'>
......
......@@ -113,9 +113,7 @@ Given /^my XMPP friend goes online( and joins the multi-user chat)?$/ do |join_c
account['username'] + '@' + account['domain'],
account['password'],
account['otr_key'],
# XXX:Buster: once we stop supporting running our test suite on Stretch,
# replace this with: **(bot_opts.transform_keys(&:to_sym))
**(bot_opts.each_with_object({}) { |(k, v), a| a[k.to_sym] = v })
**(bot_opts.transform_keys(&:to_sym))
)
@chatbot.start
add_after_scenario_hook { @chatbot.stop }
......
......@@ -5,7 +5,7 @@ Given /^I create sample videos$/ do
@video_dir_on_host = "#{$config['TMPDIR']}/video_dir"
FileUtils.mkdir_p(@video_dir_on_host)
add_after_scenario_hook { FileUtils.rm_r(@video_dir_on_host) }
fatal_system("#{ffmpeg} -loop 1 -t 30 -f image2 " \
fatal_system('ffmpeg -loop 1 -t 30 -f image2 ' \
"-i 'features/images/USBTailsLogo.png' " \
'-an -vcodec libx264 -y ' \
'-filter:v "crop=in_w-mod(in_w\,2):in_h-mod(in_h\,2)" ' \
......
......@@ -117,8 +117,7 @@ module Dogtail
'False'
elsif value.class == String
"'#{value}'"
# XXX:Buster: drop the Fixnum line once we stop supporting Stretch
elsif [Fixnum, Integer, Float].include?(value.class) # rubocop:disable Lint/UnifiedInteger
elsif [Integer, Float].include?(value.class)
v.to_s
else
raise "#{self.class.name} does not know how to handle argument type " \
......
......@@ -35,14 +35,7 @@ end
def time_delta(start_time, now)
elapsed = now - start_time
# XXX: Drop this version check when we drop support for running the test suite
# on Debian Stretch.
if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('2.4')
format('%<elapsed>.2f', elapsed: elapsed)
.chomp('.00').chomp('.0').chomp('0')
else
elapsed.ceil(2)
end
elapsed.ceil(2)
end
# Call block (ignoring any exceptions it may throw) repeatedly with
......@@ -394,8 +387,6 @@ def dbus_send_get_shellcommand(service, object_path, method, *args, **opts)
opts ||= {}
ruby_type_to_dbus_type = {
String => 'string',
# XXX:Buster: drop the Fixnum line once we stop supporting Stretch
Fixnum => 'int32', # rubocop:disable Lint/UnifiedInteger
Integer => 'int32',
}
typed_args = args.map do |arg|
......@@ -426,14 +417,6 @@ def dbus_send(*args, **opts)
dbus_send_ret_conv(ret)
end
def ffmpeg
if cmd_helper('lsb_release --short --codename').chomp == 'stretch'
'avconv'
else
'ffmpeg'
end
end
# This is IO.popen() that ensures that we wait() for the subprocess to
# finish. Please use this instead IO.popen() when running a subprocess
# inside a try_for() or other Timeout::timeout() block!
......
......@@ -4,12 +4,6 @@ class OpenCVInternalError < StandardError
end
module OpenCV
@python = if cmd_helper('lsb_release --short --codename').chomp == 'stretch'
'python2.7'
else
'python3'
end
def self.matchTemplate(image, screen, sensitivity, show_match)
assert(sensitivity < 1.0)
# Do a deep-copy so we don't mess up the outer environment
......@@ -20,7 +14,7 @@ module OpenCV
env['DISPLAY'] = ENV['USER_DISPLAY']
end
p = popen_wait(
[env, @python, "#{GIT_DIR}/features/scripts/opencv_match_template.py",
[env, 'python3', "#{GIT_DIR}/features/scripts/opencv_match_template.py",
screen, image, sensitivity.to_s, show_match.to_s,],
err: [:child, :out]
)
......
......@@ -224,7 +224,7 @@ Before('@product') do |scenario|
if $config['CAPTURE']
video_name = sanitize_filename("#{scenario.name}.mkv")
@video_path = "#{ARTIFACTS_DIR}/#{video_name}"
capture = IO.popen([ffmpeg,
capture = IO.popen(['ffmpeg',
'-f', 'x11grab',
'-s', '1024x768',
'-r', '15',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment