Update to latest git, re-enable OCR tests, backport a patch

f38
Adam Williamson 2 years ago
parent 953d918fb7
commit ce0202fe5a

1
.gitignore vendored

@ -58,3 +58,4 @@
/os-autoinst-d3d433bda958b473ba7c60bb434760566c0d356b.tar.gz /os-autoinst-d3d433bda958b473ba7c60bb434760566c0d356b.tar.gz
/os-autoinst-436f134262416559c5b7248d4246cbfed67ae835.tar.gz /os-autoinst-436f134262416559c5b7248d4246cbfed67ae835.tar.gz
/os-autoinst-5a76fb8e636ccc4fdf22b7738caae6aa40895920.tar.gz /os-autoinst-5a76fb8e636ccc4fdf22b7738caae6aa40895920.tar.gz
/os-autoinst-6802f4479120a2954adbfba6dbe2779842c5ac91.tar.gz

@ -0,0 +1,34 @@
From 9ad6aff94093ee4fcc9231cd3eadd4c0934e2216 Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Wed, 19 Apr 2023 16:12:15 -0700
Subject: [PATCH] Drop setting of TESSDATA_PREFIX in invoke-tests
It's not appropriate to do this here. This is not the right path
on all distros. Forcing this path here makes it impossible to run
the tests successfully on e.g. Fedora, where the tesseract data
is in /usr/share/tesseract/tessdata (and there is no need to
explicitly specify this, as tesseract is built to find it there
without any such specification).
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
tools/invoke-tests | 3 ---
1 file changed, 3 deletions(-)
diff --git a/tools/invoke-tests b/tools/invoke-tests
index 15e6593b..8f7de0cc 100755
--- a/tools/invoke-tests
+++ b/tools/invoke-tests
@@ -52,9 +52,6 @@ fi
export OS_AUTOINST_BUILD_DIRECTORY=$build_directory
export OS_AUTOINST_MAKE_TOOL=$make_path
-# set TESSDATA_PREFIX for 02-test_ocr.t
-export TESSDATA_PREFIX='/usr/share/tessdata/'
-
args=()
# use unbuffer if it was found so e.g. timestamps on OBS builds will be useful
# note: When executing tests with prove it seems that the output is only flushed after one test has finished unless there's a terminal.
--
2.40.0

@ -1,118 +0,0 @@
From 9a861cb3e5e7bd58dc0d4aa549c6d3df25f8b24d Mon Sep 17 00:00:00 2001
From: Marius Kittler <mkittler@suse.de>
Date: Fri, 17 Jun 2022 17:29:20 +0200
Subject: [PATCH] Fix using little-endian VNC server on big-endian
* Fix connecting to a little-endian VNC server from a big-endian
system
* Use byte swap functions instead of custom code to swap the
byte order
* The bswap_32()/bswap_16() functions have the same
behavior as our custom code on little-endian systems and
therefore this change should not do anything on
little-endian systems.
* The bswap_32()/bswap_16() functions change the byte order
also on big-endian systems (in contrast to our custom
code).
* The VNC consoles test has been updated to test both cases
(byte order swap necassary and not necassary). Before it
only tested the case of a little-endian VNC server (and was
therefore only failing on bit-endian systems before this
change).
* Tested the behavior on x86_64 and also on a Tumbleweed
ppc64 VM.
* See https://progress.opensuse.org/issues/111608.
---
ppmclibs/tinycv_impl.cc | 23 +++++++----------------
t/27-consoles-vnc.t | 14 +++++++++++++-
2 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/ppmclibs/tinycv_impl.cc b/ppmclibs/tinycv_impl.cc
index c987127d5d..93f40571e8 100644
--- a/ppmclibs/tinycv_impl.cc
+++ b/ppmclibs/tinycv_impl.cc
@@ -10,6 +10,7 @@
#include <cstdint>
#include <cstdio>
#include <sys/time.h>
+#include <byteswap.h>
#include <algorithm> // std::min
#include <vector>
@@ -647,13 +648,10 @@ void image_map_raw_data_rgb555(Image* a, const unsigned char* data)
static uint16_t read_u16(const unsigned char* data, size_t& offset,
bool do_endian_conversion)
{
- uint16_t pixel;
+ uint16_t pixel = *(uint16_t*)(data + offset);
+ offset += 2;
if (do_endian_conversion) {
- pixel = data[offset++] * 256;
- pixel += data[offset++];
- } else {
- pixel = data[offset++];
- pixel += data[offset++] * 256;
+ pixel = bswap_16(pixel);
}
return pixel;
}
@@ -668,17 +666,10 @@ Vec3b VNCInfo::read_pixel(const unsigned char* data, size_t& offset)
if (bytes_per_pixel == 2) {
pixel = read_u16(data, offset, do_endian_conversion);
} else if (bytes_per_pixel == 4) {
+ pixel = *(uint32_t*)(data + offset);
+ offset += 4;
if (do_endian_conversion) {
- pixel = data[offset++];
- pixel <<= 8;
- pixel |= data[offset++];
- pixel <<= 8;
- pixel |= data[offset++];
- pixel <<= 8;
- pixel |= data[offset++];
- } else {
- pixel = *(uint32_t*)(data + offset);
- offset += 4;
+ pixel = bswap_32(pixel);
}
} else if (bytes_per_pixel == 1) {
pixel = data[offset++];
diff --git a/t/27-consoles-vnc.t b/t/27-consoles-vnc.t
index 455afc0646..be0731c9d6 100755
--- a/t/27-consoles-vnc.t
+++ b/t/27-consoles-vnc.t
@@ -41,7 +41,6 @@ is_deeply \@printed, ['RFB 003.006', pack('C', 1)], 'protocol version and securi
# ensure endian conversion is setup correctly (despite initially mocking _server_initialization)
my $machine_is_big_endian = unpack('h*', pack('s', 1)) =~ /01/ ? 1 : 0;
-$c->_do_endian_conversion($machine_is_big_endian);
subtest 'send update request' => sub {
$c->width(1024);
@@ -161,6 +160,7 @@ subtest 'update framebuffer' => sub {
ok $logged_in, 'relogin on protocol error';
# test with full data (just one pixel, though) and vncinfo present (defines endianness and chroma subsampling)
+ $c->_do_endian_conversion($machine_is_big_endian); # assume server is little-endian
my $vncinfo = tinycv::new_vncinfo($c->_do_endian_conversion, $c->_true_colour, $c->_bpp / 8, 255, 0, 255, 8, 255, 16);
my $gray_pixel = pack(CCCC => 31, 37, 41, 0); # dark prime grey
my $of_type_raw_with_coordinates_43_47_1_1 = pack(nnnnN => 43, 47, 1, 1, 0);
@@ -181,6 +181,18 @@ subtest 'update framebuffer' => sub {
throws_ok { $c->update_framebuffer } qr/unsupported update encoding -225/, 'dies on unsupported encoding';
is $s->mocked_read, undef, 'no more messages left to read after reading unknown encoding';
+ # test with full data again, assuming the server is big-endian
+ $c->_do_endian_conversion(!$machine_is_big_endian); # assume server is big-endian
+ $vncinfo = tinycv::new_vncinfo($c->_do_endian_conversion, $c->_true_colour, $c->_bpp / 8, 255, 0, 255, 8, 255, 16);
+ $gray_pixel = pack(CCCC => 0, 41, 37, 31); # dark prime grey
+ $s->set_series(mocked_read => $update_message, $one_rectangle, $of_type_raw_with_coordinates_43_47_1_1, $gray_pixel);
+ $c->_framebuffer(undef)->width(1024)->height(512)->vncinfo($vncinfo);
+ ok $c->update_framebuffer, 'truthy return value for successful pixel update of big-endian server';
+ ($blue, $green, $red) = $c->_framebuffer->get_pixel(43, 47);
+ is $blue, 41, 'pixel data updated in framebuffer (blue, big-endian server)';
+ is $green, 37, 'pixel data updated in framebuffer (green, big-endian server)';
+ is $red, 31, 'pixel data updated in framebuffer (red, big-endian server)';
+
$c->ikvm(1);
my $unsupported_ikvm_encoding = pack(nnnnN => 0, 0, 1, 1, 88);
my $ikvm_specific_data = pack(NN => 0, 9); # some "prefix" and data length

@ -30,23 +30,28 @@
%global github_owner os-autoinst %global github_owner os-autoinst
%global github_name os-autoinst %global github_name os-autoinst
%global github_version 4.6 %global github_version 4.6
%global github_commit 5a76fb8e636ccc4fdf22b7738caae6aa40895920 %global github_commit 6802f4479120a2954adbfba6dbe2779842c5ac91
# if set, will be a post-release snapshot build, otherwise a 'normal' build # if set, will be a post-release snapshot build, otherwise a 'normal' build
%global github_date 20221122 %global github_date 20230418
%global shortcommit %(c=%{github_commit}; echo ${c:0:7}) %global shortcommit %(c=%{github_commit}; echo ${c:0:7})
Name: os-autoinst Name: os-autoinst
Version: %{github_version}%{?github_date:^%{github_date}git%{shortcommit}} Version: %{github_version}%{?github_date:^%{github_date}git%{shortcommit}}
Release: 3%{?dist} Release: 1%{?dist}
Summary: OS-level test automation Summary: OS-level test automation
License: GPLv2+ License: GPLv2+
URL: https://os-autoinst.github.io/openQA/ URL: https://os-autoinst.github.io/openQA/
Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{github_name}-%{github_commit}.tar.gz
# https://github.com/os-autoinst/os-autoinst/pull/2303
# Fix tests with Fedora tesseract data location
Patch0: 0001-Drop-setting-of-TESSDATA_PREFIX-in-invoke-tests.patch
# on SUSE this is conditional, for us it doesn't have to be but we # on SUSE this is conditional, for us it doesn't have to be but we
# still use a macro just to keep build_requires similar for ease of # still use a macro just to keep build_requires similar for ease of
# cross-comparison # cross-comparison
%define opencv_require pkgconfig(opencv) %define opencv_require pkgconfig(opencv)
# Ditto
%define ocr_requires tesseract tesseract-langpack-eng
# The following line is generated from dependencies.yaml (upstream) # The following line is generated from dependencies.yaml (upstream)
%define build_base_requires %opencv_require gcc-c++ perl(Pod::Html) pkg-config pkgconfig(fftw3) pkgconfig(libpng) pkgconfig(sndfile) pkgconfig(theoraenc) %define build_base_requires %opencv_require gcc-c++ perl(Pod::Html) pkg-config pkgconfig(fftw3) pkgconfig(libpng) pkgconfig(sndfile) pkgconfig(theoraenc)
# diff from SUSE: SUSE has 'ninja', Fedora has 'ninja-build' # diff from SUSE: SUSE has 'ninja', Fedora has 'ninja-build'
@ -76,7 +81,7 @@ Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{gith
%define test_version_only_requires perl(Mojo::IOLoop::ReadWriteProcess) >= 0.28 %define test_version_only_requires perl(Mojo::IOLoop::ReadWriteProcess) >= 0.28
# diff from SUSE: it's python3-pillow-tk, not python3-Pillow-tk # diff from SUSE: it's python3-pillow-tk, not python3-Pillow-tk
# The following line is generated from dependencies.yaml (upstream) # The following line is generated from dependencies.yaml (upstream)
%define test_requires %build_requires %test_base_requires %yamllint_requires perl(Inline::Python) perl(YAML::PP) python3-pillow-tk %define test_requires %build_requires %ocr_requires %test_base_requires %yamllint_requires perl(Inline::Python) perl(YAML::PP) python3-pillow-tk
# diff from SUSE: dropped perl(Devel::Cover::Report::Codecov) as it's # diff from SUSE: dropped perl(Devel::Cover::Report::Codecov) as it's
# not currently packaged for Fedora # not currently packaged for Fedora
# The following line is generated from dependencies.yaml (upstream) # The following line is generated from dependencies.yaml (upstream)
@ -142,11 +147,6 @@ rm -f t/99-full-stack.t
rm -f t/13-osutils.t rm -f t/13-osutils.t
%endif # no_osutils %endif # no_osutils
# Tesseract 4.0.0 (in Rawhide as of 2018-11) fails utterly to OCR
# the test needle properly:
# https://github.com/tesseract-ocr/tesseract/issues/2052
rm -f t/02-test_ocr.t
# exclude unnecessary author tests # exclude unnecessary author tests
rm xt/00-tidy.t rm xt/00-tidy.t
# Remove test relying on a git working copy # Remove test relying on a git working copy
@ -244,6 +244,9 @@ rm tools/lib/perlcritic/Perl/Critic/Policy/*.pm
%files devel %files devel
%changelog %changelog
* Wed Apr 19 2023 Adam Williamson <awilliam@redhat.com> - 4.6^20230418git6802f44-1
- Update to latest git, re-enable OCR tests
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.6^20221122git5a76fb8-3 * Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 4.6^20221122git5a76fb8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

@ -1 +1 @@
SHA512 (os-autoinst-5a76fb8e636ccc4fdf22b7738caae6aa40895920.tar.gz) = 74adac6f7f1134f8b6db85fb141246f3a40b81cf23d5f5213ad26da507e38c189522b8e576493070c11d589b3a71c8aa4b3e31d1b8b8f2a3cbe604c894d4af29 SHA512 (os-autoinst-6802f4479120a2954adbfba6dbe2779842c5ac91.tar.gz) = d903cb9e628a58ecc45a52a4c58060c62e6f854e4ef4b72a92836088cc3f5738a61f1d31c371b649de36c4a2075b7b9a78fdf9dc77e5f561d98dd0c20ef7a7ca

Loading…
Cancel
Save