Skip to contentSkip to conversation

Add liblvm interactive test infrastructure to build.

PATCH New Dave Wysochanski 2 participants 4 messages Dec 7, 2008 Library code

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Add liblvm interactive test infrastructure to build.

---
 configure            |    3 +-
 configure.in         |    1 +
 lib/liblvm2.h        |   43 +++++++++++++++++++++
 test/api/Makefile.in |   38 ++++++++++++++++++
 test/api/test.c      |  102 ++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 186 insertions(+), 1 deletions(-)
 create mode 100644 lib/liblvm2.h
 create mode 100644 test/api/Makefile.in
 create mode 100644 test/api/test.c
configure +2 -1
index 2fe92fd..5d2ed22 100755
@@ -11720,7 +11720,7 @@ LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\""
 
 
 ################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile tools/Makefile tools/version.h"
+ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile tools/version.h"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -12301,6 +12301,7 @@ do
     "scripts/clvmd_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/clvmd_init_red_hat" ;;
     "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+    "test/api/Makefile") CONFIG_FILES="$CONFIG_FILES test/api/Makefile" ;;
     "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
     "tools/version.h") CONFIG_FILES="$CONFIG_FILES tools/version.h" ;;
 
configure.in +1 -0
index d18d5fd..0a05406 100644
@@ -806,6 +806,7 @@ po/Makefile
 scripts/clvmd_init_red_hat
 scripts/Makefile
 test/Makefile
+test/api/Makefile
 tools/Makefile
 tools/version.h
 ])
lib/liblvm2.h new file +43 -0

43 lines not on this page · raw message

test/api/Makefile.in new file +38 -0
new file mode 100644
index 0000000..c1c44c6
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2004 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+SOURCES = test.c
+
+ifeq ("@DEBUG@", "yes")
+	DEFS += -DDEBUG
+endif
+
+TARGETS = test
+
+LVMLIBS = -llvm -ldevmapper
+
+DEFS += -D_REENTRANT
+CFLAGS += -fno-strict-aliasing
+
+LDFLAGS += -L$(top_srcdir)/api/lib
+
+include $(top_srcdir)/make.tmpl
+
+test: $(OBJECTS) $(top_srcdir)/lib/liblvm.a $(top_srcdir)/libdm/libdevmapper.so
+	$(CC) -o test $(OBJECTS) $(CFLAGS) $(LDFLAGS) \
+		$(LVMLIBS) $(LMLIBS) $(LIBS)
+
test/api/test.c new file +102 -0

102 lines not on this page · raw message

Signature · 1 line
1.5.4.3
#1 lore raw

PATCH 1/1 Add liblvm interactive test infrastructure to build.

Quoted 4 lines · Dave Wysochanski
 configure            |    3 +-
 configure.in         |    1 +
 lib/liblvm2.h        |   43 +++++++++++++++++++++

include/.symlinks missing from patch

lib/liblvm2.h

Quoted 5 lines
 test/api/Makefile.in |   38 ++++++++++++++++++
 test/api/test.c      |  102 ++++++++++++++++++++++++++++++++++++++++++++++++++
lib/liblvm2.h +0 -0

Try just "lvm2.h" ?
(i.e. It can be /usr/include/lvm2.h alongside the existing /usr/include/lvm2cmd.h)

lib/liblvm2.h

Quoted 4 lines

new file mode 100644
index 0000000..757cd31

lib/liblvm2.h new file +0 -0

Missing copyright notice (also applies to some other new files).

lib/liblvm2.h line 1

Quoted 2 lines
lib/liblvm2.h new file +1 -0
@@ -0,0 +1,43 @@
+#ifndef _LIBLVM_API_H_

Try _LIB_LVM2_H ?

lib/liblvm2.h line 40

Quoted 13 lines
lib/liblvm2.h new file +13 -0
+/*
+ * lvm2_close
+int lvm2_close(lvm_context_t h);
+ *
+ * Description: Close an LVM2 context allocated with lvm2_open
+ *
+ * Parameters:
+ * - h (IN): context obtained from lvm2_open
+ *
+ * Returns:
+ * 0 - fail
+ * 1 - success
+ */

For the public library, I think 0 = success fits better - that's what we have in our one other public library so far, liblvm2cmd, and fits in with the idea we mentioned of trying errno values for errors.

(I'm not that keen on open/close here - personally I find create/new & destroy matches the functionality better - and I prefer 'handle' to 'context'.)

And in what way is this function allowed to fail, anyway - what stops it from being void?

lib/liblvm2.h

Quoted 3 lines
lib/liblvm2.h new file +2 -0
+++ b/test/api/test.c
 
+#include "../../lib/liblvm2.h"

Try to avoid relative paths - use -I<dir> instead.

Alasdair

Signature · 1 line
agk at redhat.com
#2 lore raw

PATCH 1/1 Add liblvm interactive test infrastructure to build.

Quoted 2 lines · Alasdair G Kergon

For the public library, I think 0 = success fits better - that's what we have in our one other public library so far, liblvm2cmd

Actually that's false - there's only one function returning a value and the interface fails to explain the meanings of its return values:-(

But I think the library function here should be void anyway so the specific question doesn't arise yet:-)

Alasdair

Signature · 1 line
agk at redhat.com
#3 lore raw

PATCH 1/1 Add liblvm interactive test infrastructure to build.

---
 configure            |    3 +-
 configure.in         |    1 +
 include/.symlinks    |    1 +
 lib/lvm2.h           |   53 +++++++++++++++++++++++
 test/api/Makefile.in |   39 +++++++++++++++++
 test/api/test.c      |  116 ++++++++++++++++++++++++++++++++++++++++++++++++++
 6 files changed, 212 insertions(+), 1 deletions(-)
 create mode 100644 lib/lvm2.h
 create mode 100644 test/api/Makefile.in
 create mode 100644 test/api/test.c
configure +2 -1
index 2fe92fd..5d2ed22 100755
@@ -11720,7 +11720,7 @@ LVM_VERSION="\"`cat VERSION 2>/dev/null || echo Unknown`\""
 
 
 ################################################################################
-ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile tools/Makefile tools/version.h"
+ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile doc/Makefile include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/snapshot/Makefile libdm/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/clvmd_init_red_hat scripts/Makefile test/Makefile test/api/Makefile tools/Makefile tools/version.h"
 
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
@@ -12301,6 +12301,7 @@ do
     "scripts/clvmd_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/clvmd_init_red_hat" ;;
     "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;;
     "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
+    "test/api/Makefile") CONFIG_FILES="$CONFIG_FILES test/api/Makefile" ;;
     "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
     "tools/version.h") CONFIG_FILES="$CONFIG_FILES tools/version.h" ;;
 
configure.in +1 -0
index d18d5fd..0a05406 100644
@@ -806,6 +806,7 @@ po/Makefile
 scripts/clvmd_init_red_hat
 scripts/Makefile
 test/Makefile
+test/api/Makefile
 tools/Makefile
 tools/version.h
 ])
include/.symlinks +1 -0
index b70b96d..1a4bd93 100644
@@ -1,5 +1,6 @@
 ../daemons/clvmd/clvm.h
 ../daemons/dmeventd/libdevmapper-event.h
+../lib/lvm2.h
 ../lib/activate/activate.h
 ../lib/activate/targets.h
 ../lib/cache/lvmcache.h
lib/lvm2.h new file +53 -0

53 lines not on this page · raw message

test/api/Makefile.in new file +39 -0
new file mode 100644
index 0000000..4032a78
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.  
+# Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
+#
+# This file is part of LVM2.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+
+SOURCES = test.c
+INCLUDES += -I${top_srcdir}/lib
+
+ifeq ("@DEBUG@", "yes")
+	DEFS += -DDEBUG
+endif
+
+TARGETS = test
+
+LVMLIBS = -llvm -ldevmapper
+
+DEFS += -D_REENTRANT
+CFLAGS += -fno-strict-aliasing
+
+LDFLAGS += -L$(top_srcdir)/api/lib
+
+include $(top_srcdir)/make.tmpl
+
+test: $(OBJECTS) $(top_srcdir)/lib/liblvm.a $(top_srcdir)/libdm/libdevmapper.so
+	$(CC) -o test $(OBJECTS) $(CFLAGS) $(LDFLAGS) $(LVMLIBS) $(LIBS)
+
test/api/test.c new file +116 -0

116 lines not on this page · raw message

Signature · 1 line
1.5.5.1