mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
tests/xenstore: Rework Makefile
In particular, fill in the install/uninstall rules so this test can be
packaged to be automated sensibly.
This causes the code to be noticed by CI, which objects as follows:
test-xenstore.c: In function 'main':
test-xenstore.c:486:5: error: ignoring return value of 'asprintf', declared
with attribute warn_unused_result [-Werror=unused-result]
asprintf(&path, "%s/%u", TEST_PATH, getpid());
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Address the CI failure by checking the asprintf() return value and exiting.
Rename xs-test to test-xenstore to be consistent with other tests. Honour
APPEND_FLAGS too.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
6a9f547763
commit
93c9edbef5
4 files changed
+29
-12
No files matched your search
@@ -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
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
test-xenstore
|
||||
@@ -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)
|
||||
@@ -20,6 +20,7 @@
|
||||
*/
|
||||
|
||||
#define _GNU_SOURCE
|
||||
#include <err.h>
|
||||
#include <getopt.h>
|
||||
#include <inttypes.h>
|
||||
#include <stdbool.h>
|
||||
@@ -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);
|
||||