qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, aliguori@us.ibm.com, stefanha@gmail.com,
	blauwirbel@gmail.com, pbonzini@redhat.com, eblake@redhat.com,
	Wenchao Xia <xiawenc@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH V3 4/5] libqblock test build system
Date: Tue, 18 Sep 2012 17:01:58 +0800	[thread overview]
Message-ID: <1347958919-30380-5-git-send-email-xiawenc@linux.vnet.ibm.com> (raw)
In-Reply-To: <1347958919-30380-1-git-send-email-xiawenc@linux.vnet.ibm.com>

  Created a new directory in tests, make chekc-libqblock will build an
executable binrary, make clean will delete it.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 .gitignore                       |    1 +
 Makefile                         |    1 +
 tests/Makefile                   |    3 +++
 tests/libqblock/Makefile         |   32 ++++++++++++++++++++++++++++++++
 tests/libqblock/libqblock-test.c |    4 ++++
 5 files changed, 41 insertions(+), 0 deletions(-)
 create mode 100644 tests/libqblock/Makefile
 create mode 100644 tests/libqblock/libqblock-test.c

diff --git a/.gitignore b/.gitignore
index 824c0d2..eccb637 100644
--- a/.gitignore
+++ b/.gitignore
@@ -95,3 +95,4 @@ cscope.*
 tags
 TAGS
 *~
+tests/libqblock/*.bin
diff --git a/Makefile b/Makefile
index b0b9b8d..de8ea17 100644
--- a/Makefile
+++ b/Makefile
@@ -238,6 +238,7 @@ clean:
 	rm -rf qapi-generated
 	rm -rf qga/qapi-generated
 	$(MAKE) -C tests/tcg clean
+	$(MAKE) -C tests/libqblock clean
 	for d in $(ALL_SUBDIRS) $(QEMULIBS) libcacard libqblock; do \
 	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
 	rm -f $$d/qemu-options.def; \
diff --git a/tests/Makefile b/tests/Makefile
index 26a67ce..69af1e2 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -148,4 +148,7 @@ check-unit: $(patsubst %,check-%, $(check-unit-y))
 check-block: $(patsubst %,check-%, $(check-block-y))
 check: check-unit check-qtest
 
+check-libqblock:
+	$(call quiet-command,$(MAKE) $(SUBDIR_MAKEFLAGS) -C tests/libqblock V="$(V)" TARGET_DIR="$*/" check-libqblock,)
+
 -include $(wildcard tests/*.d)
diff --git a/tests/libqblock/Makefile b/tests/libqblock/Makefile
new file mode 100644
index 0000000..eb6947b
--- /dev/null
+++ b/tests/libqblock/Makefile
@@ -0,0 +1,32 @@
+-include ../../config-host.mak
+-include $(SRC_PATH)/Makefile.objs
+-include $(SRC_PATH)/rules.mak
+
+$(call set-vpath, $(SRC_PATH))
+
+#library test case objects
+libqblock-test-objs=libqblock-test.lo
+
+QEMU_CFLAGS+=-I $(SRC_PATH)/$(libqblock-lib-path)
+libqblock-la-path = $(SRC_PATH)/$(libqblock-lib-path)/$(libqblock-lib-la)
+
+##########################################################################
+#runtime rules:
+ifeq ($(LIBTOOL),)
+libqblock-test.bin:
+	@echo "libtool is missing, please install and rerun configure"; exit 1
+else
+libqblock-test.bin: $(libqblock-test-objs) $(libqblock-la-path)
+	$(call quiet-command,$(LIBTOOL) --mode=link --quiet --tag=CC $(CC) -shared -rpath $(libdir) -o $@ $^,"  lt LINK $@")
+endif
+
+check-libqblock:
+	@echo "Building libqblock.la..."
+	$(call quiet-command,$(MAKE) -C $(SRC_PATH) $(libqblock-lib-la),)
+	@make libqblock-test.bin
+	@echo "Executing test binary..."
+	./libqblock-test.bin
+
+clean:
+	rm -f *.lo *.o *.d *.la *.bin
+	rm -rf .libs
diff --git a/tests/libqblock/libqblock-test.c b/tests/libqblock/libqblock-test.c
new file mode 100644
index 0000000..c05c0c4
--- /dev/null
+++ b/tests/libqblock/libqblock-test.c
@@ -0,0 +1,4 @@
+int main(int argc, char **argv)
+{
+    return 0;
+}
-- 
1.7.1

  parent reply	other threads:[~2012-09-18  9:04 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-18  9:01 [Qemu-devel] [PATCH V3 0/5] libqblock qemu block layer library Wenchao Xia
2012-09-18  9:01 ` [Qemu-devel] [PATCH V3 1/5] libqblock build system Wenchao Xia
2012-09-18 10:05   ` Paolo Bonzini
2012-09-19  6:35     ` Wenchao Xia
2012-09-19  9:57       ` Paolo Bonzini
2012-09-27  2:15         ` Wenchao Xia
2012-09-27  7:14           ` Paolo Bonzini
2012-09-18 10:31   ` Paolo Bonzini
2012-09-18  9:01 ` [Qemu-devel] [PATCH V3 2/5] libqblock type defines Wenchao Xia
2012-09-18 10:05   ` Paolo Bonzini
2012-09-19  3:23     ` Wenchao Xia
2012-09-18  9:01 ` [Qemu-devel] [PATCH V3 3/5] libqblock API Wenchao Xia
2012-09-18  9:01 ` Wenchao Xia [this message]
2012-09-18 10:10   ` [Qemu-devel] [PATCH V3 4/5] libqblock test build system Paolo Bonzini
2012-09-19  6:39     ` Wenchao Xia
2012-09-18  9:01 ` [Qemu-devel] [PATCH V3 5/5] libqblock test example code Wenchao Xia
2012-09-18 10:10   ` Paolo Bonzini
2012-09-19  6:40     ` Wenchao Xia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1347958919-30380-5-git-send-email-xiawenc@linux.vnet.ibm.com \
    --to=xiawenc@linux.vnet.ibm.com \
    --cc=aliguori@us.ibm.com \
    --cc=blauwirbel@gmail.com \
    --cc=eblake@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).