From a36e8de0efd3e9356b221bca1b316fb23cd4ecf3 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 6 Jun 2008 12:48:57 +0200 Subject: [PATCH] skip device-mapper test if support is not enabled * configure.ac: Revamp test; also set ENABLE_DEVICE_MAPPER shell var. * tests/Makefile.am (ENABLE_DEVICE_MAPPER): Propagate to tests. * tests/t6000-dm.sh: Skip all tests w/o device-mapper support. --- configure.ac | 32 +++++++++++++++----------------- tests/Makefile.am | 3 ++- tests/t6000-dm.sh | 7 +++++++ 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/configure.ac b/configure.ac index 3281102..7466538 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,5 @@ dnl GNU Parted - a library and front end for manipulation hard disk partitions -dnl Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2007 -dnl Free Software Foundation, Inc. +dnl Copyright (C) 1998-2002, 2005-2008 Free Software Foundation, Inc. dnl dnl This file may be modified and/or distributed without restriction. @@ -78,12 +77,14 @@ if test "$enable_mtrace" = yes; then AC_DEFINE(ENABLE_MTRACE, 1, [Mtrace malloc() debugging]) fi -AC_ARG_ENABLE(device-mapper, - [ --enable-device-mapper enable device mapper support [default=no]], , - enable_device_mapper=no -) -if test "$enable_device_mapper" = yes; then - AC_DEFINE(ENABLE_DEVICE_MAPPER, 1, [device mapper (libdevmapper) support]) +AC_SUBST([ENABLE_DEVICE_MAPPER]) +ENABLE_DEVICE_MAPPER=no +AC_ARG_ENABLE([device-mapper], + [ --enable-device-mapper enable device mapper support [default=no]], + [ENABLE_DEVICE_MAPPER=yes]) +if test $ENABLE_DEVICE_MAPPER = yes; then + AC_DEFINE([ENABLE_DEVICE_MAPPER], + 1, [device mapper (libdevmapper) support]) fi AC_ARG_ENABLE(selinux, @@ -255,15 +256,12 @@ If you compile e2fsprogs yourself then you need to do 'make install' and AC_SUBST(UUID_LIBS) dnl Check for libdevmapper -DM_LIBS="" -if test "$enable_device_mapper" = yes; then - AC_CHECK_LIB(devmapper, dm_task_create, - DM_LIBS="-ldevmapper", - AC_MSG_ERROR( - [libdevmapper not found! Try using --disable-device-mapper] - ) - exit - ) +DM_LIBS= +if test $ENABLE_DEVICE_MAPPER = yes; then + AC_CHECK_LIB([devmapper], [dm_task_create], + [DM_LIBS=-ldevmapper], + [AC_MSG_ERROR([libdevmapper not found! Try using --disable-device-mapper]) + ]) fi AC_SUBST(DM_LIBS) diff --git a/tests/Makefile.am b/tests/Makefile.am index 3c268d6..ebebf49 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,4 +29,5 @@ init.sh: Makefile.in mv $@-t $@ TESTS_ENVIRONMENT = \ - srcdir='$(srcdir)' + srcdir='$(srcdir)' \ + ENABLE_DEVICE_MAPPER=$(ENABLE_DEVICE_MAPPER) diff --git a/tests/t6000-dm.sh b/tests/t6000-dm.sh index 4038997..db139df 100755 --- a/tests/t6000-dm.sh +++ b/tests/t6000-dm.sh @@ -23,6 +23,13 @@ device_mapper_required_=1 : ${srcdir=.} . $srcdir/test-lib.sh +test "x$ENABLE_DEVICE_MAPPER" = xyes || + { + say "skipping $0: no device-mapper support" + test_done + exit + } + # Device maps names - should be random to not conflict with existing ones on # the system linear_=plinear -- 2.11.0