test gifload for fd leaks
This commit is contained in:
parent
efcd31b498
commit
09b4ce6d9b
@ -39,6 +39,9 @@ main( int argc, char **argv )
|
|||||||
if( VIPS_INIT( argv[0] ) )
|
if( VIPS_INIT( argv[0] ) )
|
||||||
vips_error_exit( "unable to start" );
|
vips_error_exit( "unable to start" );
|
||||||
|
|
||||||
|
if( argc != 2 )
|
||||||
|
vips_error_exit( "usage: %s test-image", argv[0] );
|
||||||
|
|
||||||
vips_snprintf( fd_dir, 256, "/proc/%d/fd", getpid() );
|
vips_snprintf( fd_dir, 256, "/proc/%d/fd", getpid() );
|
||||||
n_files = count_files( fd_dir );
|
n_files = count_files( fd_dir );
|
||||||
if( n_files == -1 )
|
if( n_files == -1 )
|
||||||
@ -57,7 +60,8 @@ main( int argc, char **argv )
|
|||||||
NULL )) )
|
NULL )) )
|
||||||
vips_error_exit( NULL );
|
vips_error_exit( NULL );
|
||||||
if( count_files( fd_dir ) != n_files )
|
if( count_files( fd_dir ) != n_files )
|
||||||
vips_error_exit( "fd not closed after header read" );
|
vips_error_exit( "%s: fd not closed after header read",
|
||||||
|
argv[1] );
|
||||||
|
|
||||||
/* We should be able to read a chunk near the top, then have the fd
|
/* We should be able to read a chunk near the top, then have the fd
|
||||||
* closed again.
|
* closed again.
|
||||||
@ -67,7 +71,8 @@ main( int argc, char **argv )
|
|||||||
vips_error_exit( NULL );
|
vips_error_exit( NULL );
|
||||||
g_object_unref( x );
|
g_object_unref( x );
|
||||||
if( count_files( fd_dir ) != n_files )
|
if( count_files( fd_dir ) != n_files )
|
||||||
vips_error_exit( "fd not closed after first read" );
|
vips_error_exit( "%s: fd not closed after first read",
|
||||||
|
argv[1] );
|
||||||
|
|
||||||
/* We should be able to read again, a little further down, and have
|
/* We should be able to read again, a little further down, and have
|
||||||
* the input restarted and closed again.
|
* the input restarted and closed again.
|
||||||
@ -77,7 +82,8 @@ main( int argc, char **argv )
|
|||||||
vips_error_exit( NULL );
|
vips_error_exit( NULL );
|
||||||
g_object_unref( x );
|
g_object_unref( x );
|
||||||
if( count_files( fd_dir ) != n_files )
|
if( count_files( fd_dir ) != n_files )
|
||||||
vips_error_exit( "fd not closed after second read" );
|
vips_error_exit( "%s: fd not closed after second read",
|
||||||
|
argv[1] );
|
||||||
|
|
||||||
/* Clean up, and we should still just have three open.
|
/* Clean up, and we should still just have three open.
|
||||||
*/
|
*/
|
||||||
@ -85,7 +91,8 @@ main( int argc, char **argv )
|
|||||||
vips_shutdown();
|
vips_shutdown();
|
||||||
|
|
||||||
if( count_files( fd_dir ) != n_files )
|
if( count_files( fd_dir ) != n_files )
|
||||||
vips_error_exit( "fd not closed after shutdown" );
|
vips_error_exit( "%s: fd not closed after shutdown",
|
||||||
|
argv[1] );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
@ -10,3 +10,12 @@ set -e
|
|||||||
if test_supported jpegload; then
|
if test_supported jpegload; then
|
||||||
./test_descriptors $image
|
./test_descriptors $image
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test_supported heifload; then
|
||||||
|
# ./test_descriptors $test_images/Example1.heic
|
||||||
|
echo
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test_supported gifload; then
|
||||||
|
./test_descriptors $test_images/cogs.gif
|
||||||
|
fi
|
||||||
|
@ -11,3 +11,17 @@ vipsheader=$top_srcdir/tools/vipsheader
|
|||||||
|
|
||||||
# we need bc to use '.' for a decimal separator
|
# we need bc to use '.' for a decimal separator
|
||||||
export LC_NUMERIC=C
|
export LC_NUMERIC=C
|
||||||
|
|
||||||
|
# test for file format supported
|
||||||
|
test_supported() {
|
||||||
|
format=$1
|
||||||
|
|
||||||
|
if $vips $format > /dev/null 2>&1; then
|
||||||
|
result=0
|
||||||
|
else
|
||||||
|
echo "support for $format not configured, skipping test"
|
||||||
|
result=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
return $result
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user