From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Xen-devel <xen-devel@lists.xenproject.org>
Cc: "Andrew Cooper" <andrew.cooper3@citrix.com>,
"Ian Jackson" <iwj@xenproject.org>, "Wei Liu" <wl@xen.org>,
"Jan Beulich" <JBeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Juergen Gross" <jgross@suse.com>
Subject: [PATCH 4/4] tests/xenstore: Rework Makefile
Date: Tue, 22 Jun 2021 19:21:24 +0100 [thread overview]
Message-ID: <20210622182124.11571-5-andrew.cooper3@citrix.com> (raw)
In-Reply-To: <20210622182124.11571-1-andrew.cooper3@citrix.com>
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>
---
CC: Ian Jackson <iwj@xenproject.org>
CC: Wei Liu <wl@xen.org>
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
CC: Juergen Gross <jgross@suse.com>
v2:
* Drop -f's
* Fix CI breakage, now that CI can build the test.
---
.gitignore | 1 -
tools/tests/xenstore/.gitignore | 1 +
tools/tests/xenstore/Makefile | 31 +++++++++++++++-------
.../tests/xenstore/{xs-test.c => test-xenstore.c} | 8 ++++--
4 files changed, 29 insertions(+), 12 deletions(-)
create mode 100644 tools/tests/xenstore/.gitignore
rename tools/tests/xenstore/{xs-test.c => test-xenstore.c} (98%)
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) -- *~
+
+.PHONY: install
+install: all
+ $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+ $(if $(TARGETS),$(INSTALL_PROG) $(TARGETS) $(DESTDIR)$(LIBEXEC_BIN))
+
+.PHONY: uninstall
+uninstall:
+ $(RM) -- $(addprefix $(DESTDIR)$(LIBEXEC_BIN)/,$(TARGETS))
+
+CFLAGS += -Werror
+CFLAGS += $(CFLAGS_libxenstore)
+CFLAGS += $(APPEND_CFLAGS)
+
+LDFLAGS += $(LDLIBS_libxenstore)
+LDFLAGS += $(APPEND_LDFLAGS)
-xs-test: xs-test.o Makefile
- $(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenstore)
+%.o: Makefile
-install uninstall:
+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 <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);
--
2.11.0
next prev parent reply other threads:[~2021-06-22 18:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-22 18:21 [PATCH v2 0/4] tools/tests: More cleanup for automation improvements Andrew Cooper
2021-06-22 18:21 ` [PATCH 1/4] tools/tests: Drop obsolete mce-test infrastructure Andrew Cooper
2021-06-22 18:21 ` [PATCH 2/4] tests/resource: Rework Makefile Andrew Cooper
2021-06-28 12:42 ` Jan Beulich
2021-06-22 18:21 ` [PATCH 3/4] tests/cpu-policy: " Andrew Cooper
2021-06-28 12:47 ` Jan Beulich
2021-06-22 18:21 ` Andrew Cooper [this message]
2021-06-28 12:52 ` [PATCH 4/4] tests/xenstore: " Jan Beulich
2021-06-28 12:59 ` [PATCH v2 0/4] tools/tests: More cleanup for automation improvements Jan Beulich
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=20210622182124.11571-5-andrew.cooper3@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=JBeulich@suse.com \
--cc=iwj@xenproject.org \
--cc=jgross@suse.com \
--cc=roger.pau@citrix.com \
--cc=wl@xen.org \
--cc=xen-devel@lists.xenproject.org \
/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).