ia64/xen-unstable

view tools/xenstore/Makefile @ 7238:971e7c7411b3

Raise an exception if an error appears on the pipes to our children, and make
sure that the child's pipes are closed even under that exception. Move the
handling of POLLHUP to the end of the loop, so that we guarantee to read any
remaining data from the child if POLLHUP and POLLIN appear at the same time.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author emellor@ewan
date Thu Oct 06 10:13:11 2005 +0100 (2005-10-06)
parents 34d251183985
children 76a7a7aa27e4
line source
1 XEN_ROOT=../..
2 include $(XEN_ROOT)/tools/Rules.mk
3 XEN_LIBXC = $(XEN_ROOT)/tools/libxc
5 INSTALL = install
6 INSTALL_DATA = $(INSTALL) -m0644
7 INSTALL_PROG = $(INSTALL) -m0755
8 INSTALL_DIR = $(INSTALL) -d -m0755
10 PROFILE=#-pg
11 BASECFLAGS=-Wall -W -g -Werror
12 # Make gcc generate dependencies.
13 BASECFLAGS += -Wp,-MD,.$(@F).d
14 PROG_DEP = .*.d
15 BASECFLAGS+= -O3 $(PROFILE)
16 #BASECFLAGS+= -I$(XEN_ROOT)/tools
17 BASECFLAGS+= -I$(XEN_ROOT)/tools/libxc
18 BASECFLAGS+= -I.
20 CFLAGS += $(BASECFLAGS)
21 LDFLAGS += $(PROFILE) -L$(XEN_LIBXC)
22 TESTDIR = testsuite/tmp
23 TESTFLAGS= -DTESTING
24 TESTENV = XENSTORED_ROOTDIR=$(TESTDIR) XENSTORED_RUNDIR=$(TESTDIR)
26 CLIENTS := xenstore-exists xenstore-list xenstore-read xenstore-rm
27 CLIENTS += xenstore-write
28 CLIENTS_OBJS := $(patsubst xenstore-%,xenstore_%.o,$(CLIENTS))
30 all: libxenstore.so xenstored $(CLIENTS) xs_tdb_dump
32 testcode: xs_test xenstored_test xs_random xs_dom0_test
34 xenstored: xenstored_core.o xenstored_watch.o xenstored_domain.o xenstored_transaction.o xs_lib.o talloc.o utils.o tdb.o
35 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
37 $(CLIENTS): libxenstore.so
38 $(CLIENTS): xenstore-%: xenstore_%.o
39 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -L. -lxenstore -o $@
41 $(CLIENTS_OBJS): xenstore_%.o: xenstore_client.c
42 $(COMPILE.c) -DCLIENT_$(*F) -o $@ $<
44 xenstored_test: xenstored_core_test.o xenstored_watch_test.o xenstored_domain_test.o xenstored_transaction_test.o xs_lib.o talloc_test.o fake_libxc.o utils.o tdb.o
45 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
47 xs_tdb_dump: xs_tdb_dump.o utils.o tdb.o talloc.o
48 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
50 xs_test: xs_test.o xs_lib.o utils.o
51 xs_random: xs_random.o xs_test_lib.o xs_lib.o talloc.o utils.o
52 xs_stress: xs_stress.o xs_test_lib.o xs_lib.o talloc.o utils.o
53 xs_crashme: xs_crashme.o xs_lib.o talloc.o utils.o
55 speedtest: speedtest.o xs.o xs_lib.o utils.o talloc.o
57 check-speed: speedtest xenstored_test $(TESTDIR)
58 $(TESTENV) time ./speedtest 100
60 xs_test.o xs_stress.o xenstored_core_test.o xenstored_watch_test.o xenstored_transaction_test.o xenstored_domain_test.o xs_random.o xs_test_lib.o talloc_test.o fake_libxc.o xs_crashme.o: CFLAGS=$(BASECFLAGS) $(TESTFLAGS)
62 xenstored_%_test.o: xenstored_%.c
63 $(COMPILE.c) -o $@ $<
65 xs_test_lib.o: xs.c
66 $(COMPILE.c) -o $@ $<
68 talloc_test.o: talloc.c
69 $(COMPILE.c) -o $@ $<
71 libxenstore.so: xs.opic xs_lib.opic
72 $(CC) $(CFLAGS) $(LDFLAGS) -Wl,-soname -Wl,libxenstore.so -shared -o $@ $^
74 clean: testsuite-clean
75 rm -f *.o *.opic *.so
76 rm -f xenstored xs_random xs_stress xs_crashme
77 rm -f xs_test xenstored_test xs_dom0_test
78 $(RM) $(PROG_DEP)
80 print-dir:
81 @echo -n tools/xenstore:
83 print-end:
84 @echo
86 check: print-dir testsuite-fast randomcheck-fast print-end
88 fullcheck: testsuite-run randomcheck stresstest
90 $(TESTDIR):
91 mkdir $@
93 testsuite-run: xenstored_test xs_test $(TESTDIR)
94 $(TESTENV) testsuite/test.sh && echo
96 testsuite-fast: xenstored_test xs_test $(TESTDIR)
97 @$(TESTENV) testsuite/test.sh --fast
99 testsuite-clean:
100 rm -rf $(TESTDIR)
102 # Make this visible so they can see repeat tests without --fast if they
103 # fail.
104 RANDSEED=$(shell date +%s)
105 randomcheck: xs_random xenstored_test $(TESTDIR)
106 $(TESTENV) ./xs_random --simple --fast /tmp/xs_random 200000 $(RANDSEED) && echo
107 $(TESTENV) ./xs_random --fast /tmp/xs_random 100000 $(RANDSEED) && echo
108 # $(TESTENV) ./xs_random --fail /tmp/xs_random 10000 $(RANDSEED)
110 crashme: xs_crashme xenstored_test $(TESTDIR)
111 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* /tmp/trace
112 export $(TESTENV); ./xs_crashme 5000 $(RANDSEED) 2>/dev/null
113 if [ -n "`cat /tmp/xs_crashme.vglog*`" ]; then echo Valgrind complained; cat /tmp/xs_crashme.vglog*; exit 1; fi
114 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions /tmp/xs_crashme.vglog* /tmp/trace
116 randomcheck-fast: xs_random xenstored_test $(TESTDIR)
117 @$(TESTENV) ./xs_random --fast /tmp/xs_random 2000 $(RANDSEED)
119 stresstest: xs_stress xenstored_test $(TESTDIR)
120 rm -rf $(TESTDIR)/store $(TESTDIR)/transactions
121 export $(TESTENV); PID=`./xenstored_test --output-pid --trace-file=/tmp/trace`; ./xs_stress 5000; ret=$$?; kill $$PID; exit $$ret
123 xs_dom0_test: xs_dom0_test.o utils.o
124 $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -lxenctrl -o $@
126 TAGS:
127 etags `find . -name '*.[ch]'`
129 tarball: clean
130 cd .. && tar -c -j -v -h -f xenstore.tar.bz2 xenstore/
132 install: libxenstore.so xenstored $(CLIENTS)
133 $(INSTALL_DIR) -p $(DESTDIR)/var/run/xenstored
134 $(INSTALL_DIR) -p $(DESTDIR)/var/lib/xenstored
135 $(INSTALL_DIR) -p $(DESTDIR)/usr/bin
136 $(INSTALL_DIR) -p $(DESTDIR)/usr/sbin
137 $(INSTALL_DIR) -p $(DESTDIR)/usr/include
138 $(INSTALL_PROG) xenstored $(DESTDIR)/usr/sbin
139 $(INSTALL_PROG) $(CLIENTS) $(DESTDIR)/usr/bin
140 $(INSTALL_DIR) -p $(DESTDIR)/usr/$(LIBDIR)
141 $(INSTALL_DATA) libxenstore.so $(DESTDIR)/usr/$(LIBDIR)
142 $(INSTALL_DATA) xs.h $(DESTDIR)/usr/include
143 $(INSTALL_DATA) xs_lib.h $(DESTDIR)/usr/include
145 -include $(PROG_DEP)
147 # never delete any intermediate files.
148 .SECONDARY: