"make check" works uninstalled
and skips tests for missing features
This commit is contained in:
parent
a560d3b8c2
commit
1b86de44f4
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,6 +2,7 @@ a.out
|
||||
*.log
|
||||
*.trs
|
||||
tmp
|
||||
tmp-*
|
||||
test/variables.sh
|
||||
libvips/introspect
|
||||
scan
|
||||
|
@ -10,6 +10,7 @@
|
||||
- vips_gaussmat() and vips_logmat() are now int by default, to match
|
||||
vips_conv(), and use @precision, not @integer
|
||||
- added --disable-pyvips8 switch to turn off new py binding
|
||||
- "vips thing" exit status can now be used to test for optional components
|
||||
|
||||
25/7/14 started 7.41.0
|
||||
- start working on --disable-deprecated
|
||||
|
5
TODO
5
TODO
@ -1,8 +1,3 @@
|
||||
- need some way to disable tests in test_formats if those load/save options
|
||||
are not there
|
||||
|
||||
perhaps "vips fitsload" with no args should not set errno?
|
||||
|
||||
- use vips_resize() in vipsthumbnail?
|
||||
|
||||
should the sharpening filter be selectable?
|
||||
|
@ -681,7 +681,7 @@ if test x"$enable_pyvips8" != "xno"; then
|
||||
[pyoverridesdir="\$(pyexecdir)/gi/overrides"
|
||||
AC_SUBST(pyoverridesdir)
|
||||
],
|
||||
[AC_MSG_WARN([pgobject-3.0 not found; disabling vips8 python support])
|
||||
[AC_MSG_WARN([pygobject-3.0 not found; disabling vips8 python support])
|
||||
])
|
||||
fi
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
#set -x
|
||||
set -x
|
||||
|
||||
. ./variables.sh
|
||||
|
||||
|
@ -133,36 +133,64 @@ test_loader() {
|
||||
echo "ok"
|
||||
}
|
||||
|
||||
# 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
|
||||
}
|
||||
|
||||
test_format $image v 0
|
||||
if test_supported tiffload; then
|
||||
test_format $image tif 0
|
||||
test_format $image tif 90 [compression=jpeg]
|
||||
test_format $image tif 0 [compression=deflate]
|
||||
test_format $image tif 0 [compression=packbits]
|
||||
test_format $image tif 90 [compression=jpeg,tile]
|
||||
test_format $image tif 90 [compression=jpeg,tile,pyramid]
|
||||
fi
|
||||
if test_supported pngload; then
|
||||
test_format $image png 0
|
||||
test_format $image png 0 [compression=9,interlace=1]
|
||||
fi
|
||||
if test_supported jpegload; then
|
||||
test_format $image jpg 90
|
||||
fi
|
||||
test_format $image ppm 0
|
||||
test_format $image pfm 0
|
||||
if test_supported fitsload; then
|
||||
test_format $image fits 0
|
||||
fi
|
||||
|
||||
# csv can only do mono
|
||||
test_format $mono csv 0
|
||||
|
||||
# cmyk jpg is a special path
|
||||
if test_supported jpegload; then
|
||||
test_format $cmyk jpg 90
|
||||
fi
|
||||
if test_supported tiffload; then
|
||||
test_format $cmyk tif 0
|
||||
test_format $cmyk tif 90 [compression=jpeg]
|
||||
test_format $cmyk tif 90 [compression=jpeg,tile]
|
||||
test_format $cmyk tif 90 [compression=jpeg,tile,pyramid]
|
||||
fi
|
||||
|
||||
test_rad $rad
|
||||
|
||||
test_raw $mono
|
||||
test_raw $image
|
||||
|
||||
if test_supported matload; then
|
||||
test_loader $matlab_ref $matlab matlab
|
||||
fi
|
||||
|
||||
# we have loaders but not savers for other formats, add tests here
|
||||
|
||||
|
58
tools/vips.c
58
tools/vips.c
@ -146,7 +146,7 @@ map_name( const char *name, map_name_fn fn )
|
||||
*/
|
||||
fn( func );
|
||||
else {
|
||||
im_error( "map_name",
|
||||
vips_error( "map_name",
|
||||
_( "no package or function \"%s\"" ), name );
|
||||
return( fn );
|
||||
}
|
||||
@ -208,7 +208,7 @@ print_list( int argc, char **argv )
|
||||
}
|
||||
else {
|
||||
if( map_name( argv[0], list_function ) )
|
||||
error_exit( "unknown package \"%s\"", argv[0] );
|
||||
vips_error_exit( "unknown package \"%s\"", argv[0] );
|
||||
}
|
||||
|
||||
return( 0 );
|
||||
@ -253,6 +253,17 @@ has_print( im_function *fn )
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
static int
|
||||
isvips( const char *name )
|
||||
{
|
||||
/* If we're running uninstalled we get the lt- prefix.
|
||||
*/
|
||||
if( vips_isprefix( "lt-", name ) )
|
||||
name += 3;
|
||||
|
||||
return( vips_isprefix( "vips", name ) );
|
||||
}
|
||||
|
||||
/* Print a usage string from an im_function descriptor.
|
||||
*/
|
||||
static void
|
||||
@ -264,7 +275,7 @@ usage( im_function *fn )
|
||||
/* Don't print the prgname if we're being run as a symlink.
|
||||
*/
|
||||
fprintf( stderr, "usage: " );
|
||||
if( im_isprefix( "vips", g_get_prgname() ) )
|
||||
if( isvips( g_get_prgname() ) )
|
||||
fprintf( stderr, "%s ", g_get_prgname() );
|
||||
fprintf( stderr, "%s ", fn->name );
|
||||
|
||||
@ -895,10 +906,10 @@ static int
|
||||
print_cppdecls( int argc, char **argv )
|
||||
{
|
||||
printf( "// this file automatically generated from\n"
|
||||
"// VIPS library %s\n", im_version_string() );
|
||||
"// VIPS library %s\n", vips_version_string() );
|
||||
|
||||
if( map_name( argv[0], print_cppdecl ) )
|
||||
error_exit( NULL );
|
||||
vips_error_exit( NULL );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -909,10 +920,10 @@ static int
|
||||
print_cppdefs( int argc, char **argv )
|
||||
{
|
||||
printf( "// this file automatically generated from\n"
|
||||
"// VIPS library %s\n", im_version_string() );
|
||||
"// VIPS library %s\n", vips_version_string() );
|
||||
|
||||
if( map_name( argv[0], print_cppdef ) )
|
||||
error_exit( NULL );
|
||||
vips_error_exit( NULL );
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
@ -996,7 +1007,7 @@ parse_options( GOptionContext *context, int *argc, char **argv )
|
||||
g_error_free( error );
|
||||
}
|
||||
|
||||
error_exit( NULL );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
|
||||
/* Remove any "--" argument. If one of our arguments is a negative
|
||||
@ -1088,16 +1099,16 @@ main( int argc, char **argv )
|
||||
g_error_free( error );
|
||||
}
|
||||
|
||||
error_exit( NULL );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
|
||||
if( main_option_plugin ) {
|
||||
if( !im_load_plugin( main_option_plugin ) )
|
||||
error_exit( NULL );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
|
||||
if( main_option_version )
|
||||
printf( "vips-%s\n", im_version_string() );
|
||||
printf( "vips-%s\n", vips_version_string() );
|
||||
|
||||
/* Reenable help and unknown option detection ready for the second
|
||||
* option parse.
|
||||
@ -1112,7 +1123,7 @@ main( int argc, char **argv )
|
||||
|
||||
/* Should we try to run the thing we are named as?
|
||||
*/
|
||||
if( !im_isprefix( "vips", g_get_prgname() ) )
|
||||
if( !isvips( g_get_prgname() ) )
|
||||
action = argv[0];
|
||||
|
||||
if( !action ) {
|
||||
@ -1145,7 +1156,7 @@ main( int argc, char **argv )
|
||||
parse_options( context, &argc, argv );
|
||||
|
||||
if( actions[i].action( argc - 1, argv + 1 ) )
|
||||
error_exit( "%s", action );
|
||||
vips_error_exit( "%s", action );
|
||||
|
||||
handled = TRUE;
|
||||
break;
|
||||
@ -1162,7 +1173,7 @@ main( int argc, char **argv )
|
||||
if( argc == 1 )
|
||||
usage( fn );
|
||||
else
|
||||
error_exit( NULL );
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
|
||||
handled = TRUE;
|
||||
@ -1172,7 +1183,7 @@ main( int argc, char **argv )
|
||||
*/
|
||||
if( action &&
|
||||
!handled )
|
||||
im_error_clear();
|
||||
vips_error_clear();
|
||||
|
||||
/* Could be a vips8 VipsOperation.
|
||||
*/
|
||||
@ -1191,7 +1202,18 @@ main( int argc, char **argv )
|
||||
vips_object_unref_outputs( VIPS_OBJECT( operation ) );
|
||||
g_object_unref( operation );
|
||||
|
||||
error_exit( NULL );
|
||||
if( argc == 1 )
|
||||
/* We don't exit with an error for something
|
||||
* like "vips fitsload" failing, we use it to
|
||||
* decide if an optional component has been
|
||||
* configured. If we've been built without
|
||||
* fits support, fitsload will fail to find
|
||||
* the operation and we'll error with "unknown
|
||||
* action" below.
|
||||
*/
|
||||
exit( 0 );
|
||||
else
|
||||
vips_error_exit( NULL );
|
||||
}
|
||||
|
||||
vips_object_unref_outputs( VIPS_OBJECT( operation ) );
|
||||
@ -1204,12 +1226,12 @@ main( int argc, char **argv )
|
||||
*/
|
||||
if( action &&
|
||||
!handled )
|
||||
im_error_clear();
|
||||
vips_error_clear();
|
||||
|
||||
if( action &&
|
||||
!handled ) {
|
||||
print_help( argc, argv );
|
||||
error_exit( _( "unknown action \"%s\"" ), action );
|
||||
vips_error_exit( _( "unknown action \"%s\"" ), action );
|
||||
}
|
||||
|
||||
/* Still not handled? We may not have called parse_options(), so
|
||||
|
Loading…
Reference in New Issue
Block a user