Skip to contentSkip to conversation

Cleanup to tools/tests

PATCH In review Andrew Cooper 4 participants 12 messages Jan 13, 2021

lore
Share & tools
lore
#0 lore raw

cover Cleanup to tools/tests

Move two non-test things out of tests/ and drop some obsolete infrastructure.

Andrew Cooper (3):
tools/tests: Drop obsolete running scripts
tools: Move xen-access from tests/ to misc/
tools: Move memshrtool from tests/ to misc/

 .gitignore                                         |  5 --
 tools/misc/.gitignore                              |  2 +
 tools/misc/Makefile                                |  8 +++
 tools/{tests/xen-access => misc}/xen-access.c      |  1 +
 .../memshrtool.c => misc/xen-memshare-tool.c}      |  0
 tools/tests/Makefile                               |  5 --
 tools/tests/mem-sharing/Makefile                   | 31 -----------
 tools/tests/run_tests.sh                           | 61 ----------------------
 tools/tests/utests/run_all_tests.py                | 23 --------
 tools/tests/xen-access/Makefile                    | 33 ------------
 10 files changed, 11 insertions(+), 158 deletions(-)
 rename tools/{tests/xen-access => misc}/xen-access.c (99%)
 rename tools/{tests/mem-sharing/memshrtool.c => misc/xen-memshare-tool.c} (100%)
 delete mode 100644 tools/tests/mem-sharing/Makefile
 delete mode 100644 tools/tests/run_tests.sh
 delete mode 100644 tools/tests/utests/run_all_tests.py
 delete mode 100644 tools/tests/xen-access/Makefile
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/3 tools/tests: Drop obsolete running scripts

The python unit tests were dropped in Xen 4.12 due to being obsolete, but the scripts to run the tests were missed. Clean up .gitignore as well

Also drop the libxenctrl {C,LD}FLAGS adjustments in the Makefile. This logic isn't used, and isn't appropriate even in principle, as there are tests in here which don't want to use libxenctrl.

---
CC: Ian Jackson <[email protected]>

---
 .gitignore                          |  3 --
 tools/tests/Makefile                |  3 --
 tools/tests/run_tests.sh            | 61 -------------------------------------
 tools/tests/utests/run_all_tests.py | 23 --------------
 4 files changed, 90 deletions(-)
 delete mode 100644 tools/tests/run_tests.sh
 delete mode 100644 tools/tests/utests/run_all_tests.py
.gitignore +0 -3
index b169d78ed7..1b54ea3111 100644
@@ -274,9 +274,6 @@ tools/tests/x86_emulator/x86_emulate
 tools/tests/x86_emulator/xop*.[ch]
 tools/tests/xen-access/xen-access
 tools/tests/xenstore/xs-test
-tools/tests/regression/installed/*
-tools/tests/regression/build/*
-tools/tests/regression/downloads/*
 tools/tests/mem-sharing/memshrtool
 tools/tests/mce-test/tools/xen-mceinj
 tools/tests/vpci/list.h
tools/tests/Makefile +0 -3
index ed3bed404b..9077fa14d3 100644
@@ -1,9 +1,6 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS  += $(CFLAGS_libxenctrl)
-LDLIBS += $(LDLIBS_libxenctrl)
-
 SUBDIRS-y :=
 SUBDIRS-$(CONFIG_X86) += cpu-policy
 SUBDIRS-$(CONFIG_X86) += mce-test
tools/tests/run_tests.sh deleted +0 -61

61 lines not on this page · raw message

tools/tests/utests/run_all_tests.py deleted +0 -23
deleted file mode 100644
index 7318c81ff2..0000000000
@@ -1,23 +0,0 @@
-#============================================================================
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of version 2.1 of the GNU Lesser General Public
-# License as published by the Free Software Foundation.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; If not, see <http://www.gnu.org/licenses/>.
-#============================================================================
-# Copyright (C) 2009 flonatel GmbH & Co. KG
-#============================================================================
-
-import unittest
-
-suite = unittest.TestSuite([])
-
-if __name__ == "__main__":
-    testresult = unittest.TextTestRunner(verbosity=3).run(suite)
-
Signature · 1 line
2.11.0
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] tools/tests: Drop obsolete running scripts

Andrew Cooper writes ("[PATCH 1/3] tools/tests: Drop obsolete running scripts"):

Quoted 2 lines

The python unit tests were dropped in Xen 4.12 due to being obsolete, but the scripts to run the tests were missed. Clean up .gitignore as well

I'm happy with this part.

Quoted 3 lines

Also drop the libxenctrl {C,LD}FLAGS adjustments in the Makefile. This logic isn't used, and isn't appropriate even in principle, as there are tests in here which don't want to use libxenctrl.

It's not clear to me that it's EBW to link all the tests to libxenctrl simply to make the build easier.

In a later patch you add these settings back as part of a particular test target.

I don't much mind it being done this way, and you've done the work, so I am giving this my ack, but I just wanted to register my qualm in case you had a second thought.

FTR, however, IMO the -DXC_WANT_COMPAT_DEVICEMODEL_API that you move to a specific test program in a later patch is something that ought not to be applied to all tests, so there doing it that way is necessary - thanks.

Ian.

#3 lore raw

Re: [PATCH 1/3] tools/tests: Drop obsolete running scripts

Quoted 11 lines · Ian Jackson

Andrew Cooper writes ("[PATCH 1/3] tools/tests: Drop obsolete running scripts"):

Quoted 2 lines

The python unit tests were dropped in Xen 4.12 due to being obsolete, but the scripts to run the tests were missed. Clean up .gitignore as well

I'm happy with this part.

Quoted 3 lines

Also drop the libxenctrl {C,LD}FLAGS adjustments in the Makefile. This logic isn't used, and isn't appropriate even in principle, as there are tests in here which don't want to use libxenctrl.

It's not clear to me that it's EBW to link all the tests to libxenctrl simply to make the build easier.

Quoted 6 lines

In a later patch you add these settings back as part of a particular test target.

I don't much mind it being done this way, and you've done the work, so I am giving this my ack, but I just wanted to register my qualm in case you had a second thought.

These lines aren't used, because this Makefile doesn't compile/link any code.  They don't apply to subdirs.

More than half the remaining content in tests/ really are unit tests, and must not be linked against libxc if they want to be run outside of dom0 (e.g. the developers build box.)

Quoted 6 lines

FTR, however, IMO the -DXC_WANT_COMPAT_DEVICEMODEL_API that you move to a specific test program in a later patch is something that ought not to be applied to all tests, so there doing it that way is necessary - thanks.

Thanks,

~Andrew

#4 lore raw

PATCH 2/3 tools: Move xen-access from tests/ to misc/

In reply to Andrew Cooper

xen-access is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live.

Move the -DXC_WANT_COMPAT_DEVICEMODEL_API from CFLAGS into xen-access.c itself to avoid adding Makefile complexity.

---
CC: Ian Jackson <[email protected]>
CC: Tamas K Lengyel <[email protected]>

---
 .gitignore                                    |  1 -
 tools/misc/.gitignore                         |  1 +
 tools/misc/Makefile                           |  4 ++++
 tools/{tests/xen-access => misc}/xen-access.c |  1 +
 tools/tests/Makefile                          |  1 -
 tools/tests/xen-access/Makefile               | 33 ---------------------------
 6 files changed, 6 insertions(+), 35 deletions(-)
 rename tools/{tests/xen-access => misc}/xen-access.c (99%)
 delete mode 100644 tools/tests/xen-access/Makefile
.gitignore +0 -1
index 1b54ea3111..630bdf5b99 100644
@@ -272,7 +272,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/xen-access/xen-access
 tools/tests/xenstore/xs-test
 tools/tests/mem-sharing/memshrtool
 tools/tests/mce-test/tools/xen-mceinj
tools/misc/.gitignore +1 -0
index c5fe2cfccd..e332ed4ec7 100644
@@ -1 +1,2 @@
+xen-access
 xen-ucode
tools/misc/Makefile +4 -0
index 7d37f297a9..612b7002e5 100644
@@ -30,6 +30,7 @@ INSTALL_SBIN                   += xenlockprof
 INSTALL_SBIN                   += xenperf
 INSTALL_SBIN                   += xenpm
 INSTALL_SBIN                   += xenwatchdogd
+INSTALL_SBIN                   += xen-access
 INSTALL_SBIN                   += xen-livepatch
 INSTALL_SBIN                   += xen-diag
 INSTALL_SBIN += $(INSTALL_SBIN-y)
@@ -73,6 +74,9 @@ clean:
 .PHONY: distclean
 distclean: clean
 
+xen-access: xen-access.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenevtchn) $(APPEND_LDFLAGS)
+
 xen-cpuid: xen-cpuid.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(APPEND_LDFLAGS)
 
tools/misc/xen-access.c renamed from tools/tests/xen-access/xen-access.c +1 -0
similarity index 99%
rename from tools/tests/xen-access/xen-access.c
rename to tools/misc/xen-access.c
index 1ab4f6705f..4bbef0bd2e 100644
@@ -38,6 +38,7 @@
 #include <sys/mman.h>
 #include <poll.h>
 
+#define XC_WANT_COMPAT_DEVICEMODEL_API
 #include <xenctrl.h>
 #include <xenevtchn.h>
 #include <xen/vm_event.h>
tools/tests/Makefile +0 -1
index 9077fa14d3..771715be0f 100644
@@ -8,7 +8,6 @@ SUBDIRS-y += mem-sharing
 ifneq ($(clang),y)
 SUBDIRS-$(CONFIG_X86) += x86_emulator
 endif
-SUBDIRS-y += xen-access
 SUBDIRS-y += xenstore
 SUBDIRS-y += depriv
 SUBDIRS-$(CONFIG_HAS_PCI) += vpci
tools/tests/xen-access/Makefile deleted +0 -33
deleted file mode 100644
index 131c9f375d..0000000000
@@ -1,33 +0,0 @@
-XEN_ROOT=$(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Werror
-CFLAGS += -DXC_WANT_COMPAT_DEVICEMODEL_API
-
-CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_libxenguest)
-CFLAGS += $(CFLAGS_libxenevtchn)
-CFLAGS += $(CFLAGS_xeninclude)
-
-TARGETS-y := xen-access
-TARGETS := $(TARGETS-y)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(TARGETS)
-
-.PHONY: clean
-clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
-
-.PHONY: distclean
-distclean: clean
-
-xen-access: xen-access.o Makefile
-	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl) $(LDLIBS_libxenguest) $(LDLIBS_libxenevtchn)
-
-install uninstall:
-
--include $(DEPS_INCLUDE)
Signature · 1 line
2.11.0
Acked-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] tools: Move xen-access from tests/ to misc/

Andrew Cooper writes ("[PATCH 2/3] tools: Move xen-access from tests/ to misc/"):

Quoted 5 lines

xen-access is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live.

Move the -DXC_WANT_COMPAT_DEVICEMODEL_API from CFLAGS into xen-access.c itself to avoid adding Makefile complexity.

Acked-by on v1 2/3
#6 lore raw

Re: [PATCH 2/3] tools: Move xen-access from tests/ to misc/

In reply to Andrew Cooper
Quoted 6 lines · Andrew Cooper

xen-access is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live.

Move the -DXC_WANT_COMPAT_DEVICEMODEL_API from CFLAGS into xen-access.c itself to avoid adding Makefile complexity.

#7 lore raw

Re: [PATCH 2/3] tools: Move xen-access from tests/ to misc/

Quoted 7 lines · Tamas K Lengyel
Quoted 5 lines · Andrew Cooper

xen-access is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live.

Move the -DXC_WANT_COMPAT_DEVICEMODEL_API from CFLAGS into xen-access.c itself to avoid adding Makefile complexity.

Thanks.  I'll also update the MAINTAINERs path, which I forgot to do.

~Andrew

#8 lore raw

PATCH 3/3 tools: Move memshrtool from tests/ to misc/

In reply to Andrew Cooper

memshrtool is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live. Also rename it to xen-memshare-tool

---
CC: Ian Jackson <[email protected]>

I'm debating dropping the tool suffix, because I don't think that's much help either.

---
 .gitignore                                         |  1 -
 tools/misc/.gitignore                              |  1 +
 tools/misc/Makefile                                |  4 +++
 .../memshrtool.c => misc/xen-memshare-tool.c}      |  0
 tools/tests/Makefile                               |  1 -
 tools/tests/mem-sharing/Makefile                   | 31 ----------------------
 6 files changed, 5 insertions(+), 33 deletions(-)
 rename tools/{tests/mem-sharing/memshrtool.c => misc/xen-memshare-tool.c} (100%)
 delete mode 100644 tools/tests/mem-sharing/Makefile
.gitignore +0 -1
index 630bdf5b99..35957cc21f 100644
@@ -273,7 +273,6 @@ 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/mem-sharing/memshrtool
 tools/tests/mce-test/tools/xen-mceinj
 tools/tests/vpci/list.h
 tools/tests/vpci/vpci.[hc]
tools/misc/.gitignore +1 -0
index e332ed4ec7..a01bc5b5b5 100644
@@ -1,2 +1,3 @@
 xen-access
+xen-memshare-tool
 xen-ucode
tools/misc/Makefile +4 -0
index 612b7002e5..fbe010a55a 100644
@@ -32,6 +32,7 @@ INSTALL_SBIN                   += xenpm
 INSTALL_SBIN                   += xenwatchdogd
 INSTALL_SBIN                   += xen-access
 INSTALL_SBIN                   += xen-livepatch
+INSTALL_SBIN                   += xen-memshare-tool
 INSTALL_SBIN                   += xen-diag
 INSTALL_SBIN += $(INSTALL_SBIN-y)
 
@@ -86,6 +87,9 @@ xen-hvmctx: xen-hvmctx.o
 xen-hvmcrash: xen-hvmcrash.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
+xen-memshare-tool: xen-memshare-tool.o
+	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
+
 xenperf: xenperf.o
 	$(CC) $(LDFLAGS) -o $@ $< $(LDLIBS_libxenctrl) $(APPEND_LDFLAGS)
 
tools/misc/xen-memshare-tool.c renamed from tools/tests/mem-sharing/memshrtool.c +0 -0
similarity index 100%
rename from tools/tests/mem-sharing/memshrtool.c
rename to tools/misc/xen-memshare-tool.c
tools/tests/Makefile +0 -1
index 771715be0f..fc9b715951 100644
@@ -4,7 +4,6 @@ include $(XEN_ROOT)/tools/Rules.mk
 SUBDIRS-y :=
 SUBDIRS-$(CONFIG_X86) += cpu-policy
 SUBDIRS-$(CONFIG_X86) += mce-test
-SUBDIRS-y += mem-sharing
 ifneq ($(clang),y)
 SUBDIRS-$(CONFIG_X86) += x86_emulator
 endif
tools/tests/mem-sharing/Makefile deleted +0 -31
deleted file mode 100644
index 5cd96e4cc9..0000000000
@@ -1,31 +0,0 @@
-XEN_ROOT=$(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-CFLAGS += -Werror
-
-CFLAGS += $(CFLAGS_libxenctrl)
-CFLAGS += $(CFLAGS_xeninclude)
-
-TARGETS-y := 
-TARGETS-$(CONFIG_X86) += memshrtool
-TARGETS := $(TARGETS-y)
-
-.PHONY: all
-all: build
-
-.PHONY: build
-build: $(TARGETS)
-
-.PHONY: clean
-clean:
-	$(RM) *.o $(TARGETS) *~ $(DEPS_RM)
-
-.PHONY: distclean
-distclean: clean
-
-memshrtool: memshrtool.o
-	$(CC) -o $@ $< $(LDFLAGS) $(LDLIBS_libxenctrl)
-
--include $(DEPS_INCLUDE)
-
-install uninstall:
Signature · 1 line
2.11.0
Acked-by on v1 3/3
#9 lore raw

Re: [PATCH 3/3] tools: Move memshrtool from tests/ to misc/

Andrew Cooper writes ("[PATCH 3/3] tools: Move memshrtool from tests/ to misc/"):

Quoted 3 lines

memshrtool is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live. Also rename it to xen-memshare-tool

#10 lore raw

Re: [PATCH 3/3] tools: Move memshrtool from tests/ to misc/

Quoted 5 lines · Ian Jackson

Andrew Cooper writes ("[PATCH 3/3] tools: Move memshrtool from tests/ to misc/"):

Quoted 3 lines

memshrtool is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live. Also rename it to xen-memshare-tool

Thanks, but I expect that Gitlab will tell me that I broke the ARM build, by losing a "only build this for x86"-ism.

I've folded this delta in to resolve:

tools/misc/Makefile +0 -0
index fbe010a55a..1774ff014f 100644
@@ -22,6 +22,7 @@ INSTALL_SBIN-$(CONFIG_MIGRATE) += xen-hptool

 INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmcrash INSTALL_SBIN-$(CONFIG_X86)     += xen-hvmctx INSTALL_SBIN-$(CONFIG_X86)     += xen-lowmemd +INSTALL_SBIN-$(CONFIG_X86)     += xen-memshare-tool INSTALL_SBIN-$(CONFIG_X86)     += xen-mfndump INSTALL_SBIN-$(CONFIG_X86)     += xen-ucode INSTALL_SBIN                   += xencov
@@ -32,7 +33,6 @@ INSTALL_SBIN                   += xenpm INSTALL_SBIN                   += xenwatchdogd INSTALL_SBIN                   += xen-access INSTALL_SBIN                   += xen-livepatch -INSTALL_SBIN                   += xen-memshare-tool INSTALL_SBIN                   += xen-diag INSTALL_SBIN += $(INSTALL_SBIN-y)

~Andrew

#11 lore raw

Re: [PATCH 3/3] tools: Move memshrtool from tests/ to misc/

Andrew Cooper writes ("Re: [PATCH 3/3] tools: Move memshrtool from tests/ to misc/"):

Quoted 11 lines · Ian Jackson
Quoted 5 lines

Andrew Cooper writes ("[PATCH 3/3] tools: Move memshrtool from tests/ to misc/"):

Quoted 3 lines

memshrtool is a tool for a human to use, rather than a test. Move it into misc/ as a more appropriate location to live. Also rename it to xen-memshare-tool

Thanks, but I expect that Gitlab will tell me that I broke the ARM build, by losing a "only build this for x86"-ism.

I've folded this delta in to resolve:

Ooops. Thanks.

Ian.