diff --git a/.gitignore b/.gitignore index d4b90303b2..8ebb51b6c5 100644 --- a/.gitignore +++ b/.gitignore @@ -275,7 +275,6 @@ tools/tests/x86_emulator/*sse*.[ch] tools/tests/x86_emulator/test_x86_emulator tools/tests/x86_emulator/x86_emulate tools/tests/x86_emulator/xop*.[ch] -tools/tests/xenstore/xs-test tools/tests/vpci/list.h tools/tests/vpci/vpci.[hc] tools/tests/vpci/test_vpci diff --git a/tools/tests/xenstore/.gitignore b/tools/tests/xenstore/.gitignore new file mode 100644 index 0000000000..4b44f5dd60 --- /dev/null +++ b/tools/tests/xenstore/.gitignore @@ -0,0 +1 @@ +test-xenstore diff --git a/tools/tests/xenstore/Makefile b/tools/tests/xenstore/Makefile index a367d88803..b9969dd090 100644 --- a/tools/tests/xenstore/Makefile +++ b/tools/tests/xenstore/Makefile @@ -1,11 +1,7 @@ XEN_ROOT=$(CURDIR)/../../.. include $(XEN_ROOT)/tools/Rules.mk -CFLAGS += -Werror - -CFLAGS += $(CFLAGS_libxenstore) - -TARGETS-y := xs-test +TARGETS-y := test-xenstore TARGETS := $(TARGETS-y) .PHONY: all @@ -16,14 +12,31 @@ build: $(TARGETS) .PHONY: clean clean: - $(RM) *.o $(TARGETS) *~ $(DEPS_RM) + $(RM) -- *.o $(TARGETS) $(DEPS_RM) .PHONY: distclean distclean: clean + $(RM) -- *~ -xs-test: xs-test.o Makefile - $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenstore) +.PHONY: install +install: all + $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN) + $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN)) -install uninstall: +.PHONY: uninstall +uninstall: + $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS)) + +CFLAGS += -Werror +CFLAGS += $(CFLAGS_libxenstore) +CFLAGS += $(APPEND_CFLAGS) + +LDFLAGS += $(LDLIBS_libxenstore) +LDFLAGS += $(APPEND_LDFLAGS) + +%.o: Makefile + +test-xenstore: test-xenstore.o + $(CC) -o $@ $< $(LDFLAGS) -include $(DEPS_INCLUDE) diff --git a/tools/tests/xenstore/xs-test.c b/tools/tests/xenstore/test-xenstore.c similarity index 98% rename from tools/tests/xenstore/xs-test.c rename to tools/tests/xenstore/test-xenstore.c index c4c99c0661..d3574b3fa2 100644 --- a/tools/tests/xenstore/xs-test.c +++ b/tools/tests/xenstore/test-xenstore.c @@ -20,6 +20,7 @@ */ #define _GNU_SOURCE +#include #include #include #include @@ -483,11 +484,14 @@ int main(int argc, char *argv[]) return 0; } - asprintf(&path, "%s/%u", TEST_PATH, getpid()); + if ( asprintf(&path, "%s/%u", TEST_PATH, getpid()) < 0 ) + err(2, "asprintf() malloc failure\n"); + for ( t = 0; t < WRITE_BUFFERS_N; t++ ) { memset(write_buffers[t], 'a' + t, WRITE_BUFFERS_SIZE); - asprintf(&paths[t], "%s/%c", path, 'a' + t); + if ( asprintf(&paths[t], "%s/%c", path, 'a' + t) < 0 ) + err(2, "asprintf() malloc failure\n"); } xsh = xs_open(0);