Bug 1967544 - perl-SDL-2.548-11.fc35 skips all video tests with sdl12-compat-devel-0.0.1~git.20210602.cc5826a-1.fc35: Failed to init video
Summary: perl-SDL-2.548-11.fc35 skips all video tests with sdl12-compat-devel-0.0.1~gi...
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: sdl12-compat
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Neal Gompa
QA Contact:
URL:
Whiteboard:
Depends On: 1968508
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-06-03 10:43 UTC by Petr Pisar
Modified: 2021-06-21 06:39 UTC (History)
5 users (show)

Fixed In Version: sdl12-compat-0.0.1~git.20210618.f44f295-1.fc35
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-06-20 12:56:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Petr Pisar 2021-06-03 10:43:17 UTC
sdl12-compat replaced SDL in Fedora 35 and perl-SDL-2.548-11.fc35 fails to build now because of failing tests:

Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.puyE59
+ umask 022
+ cd /builddir/build/BUILD
+ cd SDL-2.548
+ ./Build test
[Alien::SDL] Build option used:
	Already installed SDL ver=1.2.15 path=/usr
    SDL(v1.2.15) SDL_image(v1.2.12) SDL_mixer(v1.2.12) SDL_ttf(v2.0.11) SDL_gfx(v2.0.26) SDL_Pango(v1.3) 
Building SDL
#   Failed test 'use SDL;'
#   at t/00-load.t line 88.
#     Tried to use 'SDL'.
#     Error:  Can't locate loadable object for module SDL_perl in @INC (@INC contains: /builddir/build/BUILD/SDL-2.548/blib/lib /builddir/build/BUILD/SDL-2.548/blib/arch inc /usr/local/lib64/perl5/5.34 /usr/local/share/perl5/5.34 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /builddir/build/BUILD/SDL-2.548/blib/lib/SDL.pm line 42.
# Compilation failed in require at /builddir/build/BUILD/SDL-2.548/blib/lib/SDL.pm line 42.
# BEGIN failed--compilation aborted at /builddir/build/BUILD/SDL-2.548/blib/lib/SDL.pm line 42.
# Compilation failed in require at t/00-load.t line 88.
# BEGIN failed--compilation aborted at t/00-load.t line 88.
Bailout called.  Further testing stopped:  Test failed.  BAIL OUT!.
FAILED--Further testing stopped: Test failed.  BAIL OUT!.
error: Bad exit status from /var/tmp/rpm-tmp.puyE59 (%check)

Comment 1 Petr Pisar 2021-06-10 12:17:42 UTC
There were fixes in sdl12-compat-0.0.1~git.20210609.efe9791-1.fc35 (bug #1968508) and
another bug about an unnecessary RPATH was fixed in perl-Alien-SDL-1.446-21.fc35
(https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild) in the meain time.

But perl-SDL tests still fails. There are more warnings when configuring perl-SDL:

[Alien::SDL] Testing header(s): SDL.hDetecting available libraries ...
###WARNING### Disabling subsystem 'Video'
 NOK: (fatal error: SDL.h: No such file or directory
    5 | #include <SDL.h>   
      |          ^~~~~~~   
compilation terminated.)

Comment 2 Petr Pisar 2021-06-10 12:58:34 UTC
Not really. I had an old sdl12-compat on my system. With sdl12-compat-0.0.1~git.20210609.efe9791-1.fc35 the build and tests pass.

But most of the tests report:

INFO: sdl12-compat, built on Jun  9 2021 at 00:00:00, talking to SDL2 2.0.14
Init SDL_INIT_VIDEO failed with SDL error:
and stderr INFO: FIXME: there is never a parachute in SDL2, should we catch segfaults ourselves? (SDL_Init:1622)
INFO: FIXME: support SDL_INIT_EVENTTHREAD where it makes sense? (SDL_InitSubSystem:1594)

t/core.t ........................ skipped: Failed to init video

That not used to be like that. The tests had passed normally before sdl12-compat replaced SDL.

Comment 3 Petr Pisar 2021-06-10 13:13:37 UTC
It can be reduced to:

$ SDL_VIDEODRIVER=dummy perl -Iblib/{lib,arch} -e 'use SDL; $r = SDL::init(0x00000020); $e = SDL::get_error(); print qq{retval = <$r>, error = <$e>\n}'
INFO: sdl12-compat, built on Jun  9 2021 at 00:00:00, talking to SDL2 2.0.14
INFO: FIXME: there is never a parachute in SDL2, should we catch segfaults ourselves? (SDL_Init:1622)
INFO: FIXME: support SDL_INIT_EVENTTHREAD where it makes sense? (SDL_InitSubSystem:1594)
retval = <0>, error = <>

SDL::init() does not fail. But it prints a warning to an error output and that is caught by the tests in t/lib/SDL/TestTool.pm:init():

    ($stdout, $stderr ) = capture { SDL::init($init) };
    if ( $stderr ne '' ) {
        warn 'Init ' . $inits{$init} . ' failed with SDL error: ' . SDL::get_error() . "\nand stderr $stderr\n";
    }

    return !( $stderr ne '' );

In other words the tests check that there is not error output, but sdl12-compat logs there unimplemented features.

Comment 4 Petr Pisar 2021-06-10 13:51:39 UTC
I changes the initialization to check a return value instead of stderr like this:

--- a/t/lib/SDL/TestTool.pm
+++ b/t/lib/SDL/TestTool.pm
@@ -20,6 +20,7 @@ sub init {
        my ( $self, $init ) = @_;
        my $stdout = '';
        my $stderr = '';
+       my $retval;
 
        if ( $init == SDL_INIT_VIDEO ) {
                if ( $^O !~ /win/i && !$ENV{DISPLAY} && !$ENV{SDL_VIDEODRIVER} ) {
@@ -36,12 +37,15 @@ sub init {
                SDL::quit();
        }
 
-       ($stdout, $stderr ) = capture { SDL::init($init) };
-       if ( $stderr ne '' ) {
-               warn 'Init ' . $inits{$init} . ' failed with SDL error: ' . SDL::get_error() . "\nand stderr $stderr\n";
+       ($stdout, $stderr ) = capture { $retval = SDL::init($init) };
+       if ( $retval ) {
+               warn 'Init ' . $inits{$init} . ' failed with SDL error: ' . SDL::get_error() . "\n" .
+           ($stderr eq '') ? '' :  "and stderr $stderr\n";
+       } elsif ( $stderr ne '' ) {
+               warn 'Init ' . $inits{$init} . " succeeded but warned:\n$stderr\n";
        }
 
-       return !( $stderr ne '' );
+       return !( $retval );
 }
 
 sub test_audio_open {


All tests pass with old SDL. Some tests fail with sdl12-compat-0.0.1~git.20210609.efe9791-1.fc35:

Test Summary Report
-------------------
t/core.t                      (Wstat: 0 Tests: 28 Failed: 0)
  TODO passed:   21-22, 27
t/core_audio.t                (Wstat: 512 Tests: 45 Failed: 2)
  Failed tests:  30-31
  Non-zero exit status: 2
t/core_events.t               (Wstat: 256 Tests: 679 Failed: 1)
  Failed test:  668
  Non-zero exit status: 1
t/core_multi.t                (Wstat: 0 Tests: 4 Failed: 0)
  TODO passed:   3
t/core_timer.t                (Wstat: 0 Tests: 6 Failed: 0)
  TODO passed:   6
t/core_video.t                (Wstat: 256 Tests: 110 Failed: 1)
  Failed test:  62
  TODO passed:   57, 59
  Non-zero exit status: 1
t/gfx_imagefilter.t           (Wstat: 0 Tests: 8 Failed: 0)
  TODO passed:   7
t/mixer.t                     (Wstat: 768 Tests: 26 Failed: 3)
  Failed tests:  20-21, 23
  Non-zero exit status: 3
t/mixer_mixchunk.t            (Wstat: 256 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 1
  Parse errors: Bad plan.  You planned 6 tests but ran 2.
t/mixer_mixmusic.t            (Wstat: 512 Tests: 6 Failed: 2)
  Failed tests:  4-5
  Non-zero exit status: 2
t/mixer_music.t               (Wstat: 3584 Tests: 35 Failed: 14)
  Failed tests:  1, 8-11, 13-16, 20, 23-24, 28-29
  Non-zero exit status: 14
t/sdlx_music.t                (Wstat: 256 Tests: 2 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/sdlx_sound.t                (Wstat: 256 Tests: 5 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
t/sdlx_surface.t              (Wstat: 256 Tests: 1 Failed: 0)
  Non-zero exit status: 1
  Parse errors: No plan found in TAP output
Files=58, Tests=3449, 89 wallclock secs ( 0.34 usr  0.11 sys + 22.68 cusr  2.39 csys = 25.52 CPU)
Result: FAIL
Failed 10/58 test programs. 25/3449 subtests failed.

Comment 5 Petr Pisar 2021-06-10 13:55:47 UTC
The stderr checking has already been fixed in upstream with:

commit 39f3db900436329dcc1bfbc28f74775d1304b538
Author: Pino Toscano <toscano.pino>
Date:   Fri May 1 09:51:13 2015 +0200

    TestTool::init: properly handle SDL::init errors
    
    So far TestTool::init was just capturing stdout and stderr of SDL::init,
    using stderr to check whether SDL::init failed. This, other than being
    fragile, misses the init errors.
    
    Switch from checking stderr to checking the actual result code of
    SDL::init.

Comment 6 Neal Gompa 2021-06-11 11:05:26 UTC
Could you please take a look at this, Ryan?

Comment 7 Ryan C. Gordon 2021-06-18 23:29:55 UTC
This should all be resolved upstream now, including emulating a bug that the Perl unit tests expects.  :)

We no longer spam stderr by default, so it shouldn’t need those workarounds anymore, either.

Unless there are other concerns, I believe this bug can be marked as resolved now.

Comment 8 Neal Gompa 2021-06-19 03:08:44 UTC
Petr, I built sdl12-compat-0.0.1~git.20210618.f44f295-1.fc35 in Rawhide, which includes the work Ryan has done. Can you verify that this is fixed now?

Comment 9 Neal Gompa 2021-06-20 12:56:27 UTC
Koschei reports that this is no longer a problem: https://koschei.fedoraproject.org/build/10490013

Comment 10 Petr Pisar 2021-06-21 06:39:59 UTC
Thanks.


Note You need to log in before you can comment on or make changes to this bug.