[Libguestfs] [PATCH 2/3] gobject: Check gjs is available for gobject bind tests

Richard W.M. Jones rjones at redhat.com
Fri Jan 20 17:17:26 UTC 2012


On Fri, Jan 20, 2012 at 05:12:16PM +0000, Matthew Booth wrote:
> ---
>  configure.ac          |    6 ++++++
>  gobject/run-bindtests |   10 ++++++++--
>  2 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 2ca0c47..f15db58 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1017,6 +1017,12 @@ AS_IF(
>  )
>  AM_CONDITIONAL([HAVE_GOBJECT],[test "x$GOBJECT_LIBS" != "x"])
>  
> +AC_CHECK_PROG([GJS],[gjs],[gjs],[no])
> +AS_IF(
> +  [test "x$GJS" = "xno"],
> +  [AC_MSG_WARN([gjs not found, gobject bindtests will not run])]
> +)
> +
>  dnl gobject introspection
>  GOBJECT_INTROSPECTION_CHECK([1.30.0])
>  
> diff --git a/gobject/run-bindtests b/gobject/run-bindtests
> index 3df2333..32760bb 100755
> --- a/gobject/run-bindtests
> +++ b/gobject/run-bindtests
> @@ -16,8 +16,14 @@
>  # along with this program; if not, write to the Free Software
>  # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
>  
> +GJS=`which gjs 2>/dev/null`
> +if [ -z "$GJS" ]; then
> +  echo "GObject bind tests skipped: gjs is missing"
> +  exit 0
> +fi

I think the right way to do this is to pass $GJS through
TESTS_ENVIRONMENT (see ruby/Makefile.am for an equivalent example).
Then here you'd test it for x$GJS != xno.  The advantage of doing it
this way is the gjs binary can be overridden in the ./configure script
(by setting GJS environment variable).

Rich.

>  set -e
>  
> -../run gjs bindtests.js > bindtests.tmp
> +../run $GJS bindtests.js > bindtests.tmp
>  diff -u ${srcdir}/../bindtests bindtests.tmp
> -../run gjs bindtests-manual.js 2>/dev/null
> +../run $GJS bindtests-manual.js 2>/dev/null
> -- 
> 1.7.7.5
> 
> _______________________________________________
> Libguestfs mailing list
> Libguestfs at redhat.com
> https://www.redhat.com/mailman/listinfo/libguestfs

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list