Source: libsdl-perl
Version: 2.546-2
Severity: important
Tags: patch
Usertags: hurd
User: debian-h...@lists.debian.org

Hello,

Currently libsdl-cdrom FTBFS on GNU/Hurd since the test
SDL::CDROM::num_drives() in t/core_cd.t returns -1. This return value is
expected when the SDL_INIT_CDROM flag is not used for SDL_init(). From
/usr/include/SDL/SDL_cdrom.h:
/**
 *  Returns the number of CD-ROM drives on the system, or -1 if
 *  SDL_Init() has not been called with the SDL_INIT_CDROM flag.
*/

Note: This is confusing since the  test i t/core_cd.t succeeds:
plan( skip_all => 'Failed to init cdrom' )
  unless SDL::TestTool->init(SDL_INIT_CDROM);

Anyway, the attached patch, fix-core_cd-tests, fixes the test when
SDL::CDROM::num_drives() returns a number <= 0.

Thanks!
Index: libsdl-perl-2.546/t/core_cd.t
===================================================================
--- libsdl-perl-2.546.orig/t/core_cd.t
+++ libsdl-perl-2.546/t/core_cd.t
@@ -37,12 +37,13 @@ is( SDL_DATA_TRACK,    4, 'SDL_DATA_TRAC
 is( SDL_DATA_TRACK(),  4, 'SDL_DATA_TRACK() should also be available' );
 
 my $num_drives = SDL::CDROM::num_drives();
-ok( $num_drives >= 0, "[SDL::CDROM::num_drives] is $num_drives" );
 
 SKIP:
 {
-	skip( "no drives available or SDL_RELEASE_TESTING not set", 17 )
+	skip( "no drives available or SDL_RELEASE_TESTING not set", 18 )
 		if $num_drives <= 0 || !$ENV{SDL_RELEASE_TESTING};
+
+	ok( $num_drives > 0, "[SDL::CDROM::num_drives] is $num_drives" );
 	for ( 0 .. $num_drives - 1 ) {
 		my $name = SDL::CDROM::name($_);
 		ok( $name, "[SDL::CDROM::name] for drive $_ is $name" );

Reply via email to