From d9603ff7aa048bfc1b9be9018d6d4788aa91f023 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Thu, 31 Mar 2016 18:42:17 -0700 Subject: [PATCH] backport: allow needles to be in nested directories (jskladan) --- needles-in-dirs.patch | 43 +++++++++++++++++++++++++++++++++++++++++++ os-autoinst.spec | 12 +++++++++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 needles-in-dirs.patch diff --git a/needles-in-dirs.patch b/needles-in-dirs.patch new file mode 100644 index 0000000..927f96c --- /dev/null +++ b/needles-in-dirs.patch @@ -0,0 +1,43 @@ +diff --git a/basetest.pm b/basetest.pm +index 8a05ceb..dac0ef1 100755 +--- a/basetest.pm ++++ b/basetest.pm +@@ -106,6 +106,7 @@ sub record_screenmatch { + screenshot => sprintf("%s-%d.png", $testname, $count), + result => 'ok', + properties => [@$properties], ++ json => $h->{json}, + }; + + # When the needle has the workaround property, +@@ -155,9 +156,10 @@ sub _serialize_match { + my $candidates; + my $diffcount = 0; + +- my $name = $cand->{needle}->{name}; ++ my $name = $cand->{needle}->{name}; ++ my $jsonfile = $cand->{needle}->{file}; + +- my $h = {name => $name, error => $cand->{error}, area => []}; ++ my $h = {name => $name, error => $cand->{error}, area => [], json => $jsonfile}; + for my $a (@{$cand->{area}}) { + my $na = {}; + for my $i (qw/x y w h result/) { +diff --git a/needle.pm b/needle.pm +index e9da38b..fdb8e85 100755 +--- a/needle.pm ++++ b/needle.pm +@@ -37,7 +37,7 @@ sub new { + my $json; + if (ref $jsonfile eq 'HASH') { + $json = $jsonfile; +- $jsonfile = join('/', $needledir, $json->{name} . '.json'); ++ $jsonfile = $json->{file} || join('/', $needledir, $json->{name} . '.json'); + } + else { + local $/; +@@ -238,4 +238,3 @@ sub all { + 1; + + # vim: set sw=4 et: +- diff --git a/os-autoinst.spec b/os-autoinst.spec index 6d1f41b..3a6ee9a 100644 --- a/os-autoinst.spec +++ b/os-autoinst.spec @@ -31,7 +31,7 @@ Name: os-autoinst Version: %{github_version} -Release: 5%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} +Release: 6%{?github_date:.%{github_date}git%{shortcommit}}%{?dist} Summary: OS-level test automation License: GPLv2+ Group: Development/System @@ -40,6 +40,13 @@ Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{gith # Fix 'format not a literal' warnings in snd2png # https://github.com/os-autoinst/os-autoinst/pull/386 Patch0: 0001-use-fputs-rather-than-fprintf-to-avoid-format-not-a-.patch +# Backport: allow needles to be in nested directories +# NOTE: rebased to 4.3 (by jskladan) +# https://github.com/os-autoinst/os-autoinst/commit/e703c755c80a244949f3dcb213d7646b28b25992 +# https://github.com/os-autoinst/os-autoinst/commit/1e4296de4c9d96ec65bbc30bb2677df7803470fe +# https://github.com/os-autoinst/os-autoinst/commit/3b8e9fe7dbcb4bdf15d9c5d291875393db190067 +Patch1: needles-in-dirs.patch + BuildRequires: autoconf BuildRequires: automake BuildRequires: gcc-c++ @@ -187,6 +194,9 @@ make check VERBOSE=1 %config(noreplace) %{_sysconfdir}/dbus-1/system.d/org.opensuse.os_autoinst.switch.conf %changelog +* Thu Mar 31 2016 Adam Williamson - 4.3-6 +- backport: allow needles to be in nested directories (jskladan) + * Thu Feb 04 2016 Fedora Release Engineering - 4.3-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild