[libvirt] [PATCH v2] tests: Move tools under tests/tools/

Michal Privoznik posted 1 patch 11 weeks ago
Test syntax-check passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/a0b244e9c84bc293330ce2fcbb15fe1b2b3b7a44.1557234123.git.mprivozn@redhat.com
.gitignore                                  |  2 +-
cfg.mk                                      |  4 ++--
tests/Makefile.am                           | 22 +++-----------------
tests/qemucapabilitiestest.c                |  4 ++--
tests/testutils.c                           |  2 +-
tests/{ => tools}/.valgrind.supp            |  0
tests/tools/Makefile.inc.am                 | 23 +++++++++++++++++++++
tests/{ => tools}/check-file-access.pl      |  2 +-
tests/{ => tools}/file_access_whitelist.txt |  0
tests/{ => tools}/group-qemu-caps.pl        |  0
tests/{ => tools}/oomtrace.pl               |  0
tests/{ => tools}/qemucapsprobe.c           |  2 +-
tests/{ => tools}/qemucapsprobemock.c       |  0
tests/{ => tools}/test-wrap-argv.pl         |  2 +-
14 files changed, 35 insertions(+), 28 deletions(-)
rename tests/{ => tools}/.valgrind.supp (100%)
create mode 100644 tests/tools/Makefile.inc.am
rename tests/{ => tools}/check-file-access.pl (98%)
rename tests/{ => tools}/file_access_whitelist.txt (100%)
rename tests/{ => tools}/group-qemu-caps.pl (100%)
rename tests/{ => tools}/oomtrace.pl (100%)
rename tests/{ => tools}/qemucapsprobe.c (96%)
rename tests/{ => tools}/qemucapsprobemock.c (100%)
rename tests/{ => tools}/test-wrap-argv.pl (98%)

[libvirt] [PATCH v2] tests: Move tools under tests/tools/

Posted by Michal Privoznik 11 weeks ago
There are some scripts/binaries that are not tests themselves but
rather fulfill support purpose. Separate them from the rest of
the tests.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---

diff to v1:
- Found a way to generate a binary into a subdir. So no new Makefile.am
  is introduced

 .gitignore                                  |  2 +-
 cfg.mk                                      |  4 ++--
 tests/Makefile.am                           | 22 +++-----------------
 tests/qemucapabilitiestest.c                |  4 ++--
 tests/testutils.c                           |  2 +-
 tests/{ => tools}/.valgrind.supp            |  0
 tests/tools/Makefile.inc.am                 | 23 +++++++++++++++++++++
 tests/{ => tools}/check-file-access.pl      |  2 +-
 tests/{ => tools}/file_access_whitelist.txt |  0
 tests/{ => tools}/group-qemu-caps.pl        |  0
 tests/{ => tools}/oomtrace.pl               |  0
 tests/{ => tools}/qemucapsprobe.c           |  2 +-
 tests/{ => tools}/qemucapsprobemock.c       |  0
 tests/{ => tools}/test-wrap-argv.pl         |  2 +-
 14 files changed, 35 insertions(+), 28 deletions(-)
 rename tests/{ => tools}/.valgrind.supp (100%)
 create mode 100644 tests/tools/Makefile.inc.am
 rename tests/{ => tools}/check-file-access.pl (98%)
 rename tests/{ => tools}/file_access_whitelist.txt (100%)
 rename tests/{ => tools}/group-qemu-caps.pl (100%)
 rename tests/{ => tools}/oomtrace.pl (100%)
 rename tests/{ => tools}/qemucapsprobe.c (96%)
 rename tests/{ => tools}/qemucapsprobemock.c (100%)
 rename tests/{ => tools}/test-wrap-argv.pl (98%)

diff --git a/.gitignore b/.gitignore
index 16eb4a3e2e..c231d394f3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -170,7 +170,7 @@
 /tests/*.trs
 /tests/*test
 /tests/commandhelper
-/tests/qemucapsprobe
+/tests/tools/qemucapsprobe
 !/tests/virsh-self-test
 !/tests/virt-aa-helper-test
 !/tests/virt-admin-self-test
diff --git a/cfg.mk b/cfg.mk
index b785089910..5e055023ee 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -1169,10 +1169,10 @@ header-ifdef:
 
 test-wrap-argv:
 	$(AM_V_GEN)$(VC_LIST) | $(GREP) -E '\.(ldargs|args)' | xargs \
-	$(PERL) $(top_srcdir)/tests/test-wrap-argv.pl --check
+	$(PERL) $(top_srcdir)/tests/tools/test-wrap-argv.pl --check
 
 group-qemu-caps:
-	$(AM_V_GEN)$(PERL) $(top_srcdir)/tests/group-qemu-caps.pl --check $(top_srcdir)/
+	$(AM_V_GEN)$(PERL) $(top_srcdir)/tests/tools/group-qemu-caps.pl --check $(top_srcdir)/
 
 # sc_po_check can fail if generated files are not built first
 sc_po_check: \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 46d94d2236..c63e8a6e70 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -75,7 +75,6 @@ MOCKLIBS_LIBS = \
 	../src/libvirt.la
 
 EXTRA_DIST = \
-	.valgrind.supp \
 	bhyvexml2argvdata \
 	bhyveargv2xmldata \
 	bhyvexml2xmloutdata \
@@ -107,7 +106,6 @@ EXTRA_DIST = \
 	nwfilterxml2firewalldata \
 	nwfilterxml2xmlin \
 	nwfilterxml2xmlout \
-	oomtrace.pl \
 	qemuagentdata \
 	qemuargv2xmldata \
 	qemublocktestdata \
@@ -285,12 +283,10 @@ test_programs += qemuxml2argvtest qemuxml2xmltest \
 	qemusecuritytest \
 	qemufirmwaretest \
 	$(NULL)
-test_helpers += qemucapsprobe
 test_libraries += libqemumonitortestutils.la \
 		libqemutestdriver.la \
 		qemuxml2argvmock.la \
 		qemucaps2xmlmock.la \
-		qemucapsprobemock.la \
 		qemucpumock.la \
 		$(NULL)
 endif WITH_QEMU
@@ -442,15 +438,13 @@ EXTRA_DIST += $(test_scripts)
 if WITH_LINUX
 check-access: file-access-clean
 	VIR_TEST_FILE_ACCESS=1 $(MAKE) $(AM_MAKEFLAGS) check
-	$(PERL) check-file-access.pl | sort -u
+	$(PERL) tools/check-file-access.pl | sort -u
 
 file-access-clean:
 	> test_file_access.txt
 endif WITH_LINUX
 
-EXTRA_DIST += \
-	check-file-access.pl \
-	file_access_whitelist.txt
+include tools/Makefile.inc.am
 
 if WITH_TESTS
 noinst_PROGRAMS = $(test_programs) $(test_helpers)
@@ -478,7 +472,7 @@ TESTS_ENVIRONMENT = \
 
 VALGRIND = valgrind --quiet --leak-check=full --trace-children=yes \
 	--trace-children-skip="*/tools/virsh","*/tests/commandhelper" \
-	--suppressions=$(abs_srcdir)/.valgrind.supp
+	--suppressions=$(abs_srcdir)/tools/.valgrind.supp
 valgrind:
 	$(MAKE) check VG="$(LIBTOOL) --mode=execute $(VALGRIND)"
 
@@ -603,16 +597,6 @@ qemucapabilitiestest_SOURCES = \
 qemucapabilitiestest_LDADD = libqemumonitortestutils.la \
 	$(qemu_LDADDS) $(LDADDS)
 
-qemucapsprobe_SOURCES = \
-	qemucapsprobe.c
-qemucapsprobe_LDADD = \
-	libqemutestdriver.la $(LDADDS)
-
-qemucapsprobemock_la_SOURCES = \
-	qemucapsprobemock.c
-qemucapsprobemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
-qemucapsprobemock_la_LIBADD = $(MOCKLIBS_LIBS)
-
 qemucommandutiltest_SOURCES = \
 	qemucommandutiltest.c \
 	testutils.c testutils.h \
diff --git a/tests/qemucapabilitiestest.c b/tests/qemucapabilitiestest.c
index ac9ab6bfce..48363326f4 100644
--- a/tests/qemucapabilitiestest.c
+++ b/tests/qemucapabilitiestest.c
@@ -225,11 +225,11 @@ mymain(void)
         return EXIT_FAILURE;
 
     /*
-     * Run "tests/qemucapsprobe /path/to/qemu/binary >foo.replies"
+     * Run "tests/tools/qemucapsprobe /path/to/qemu/binary >foo.replies"
      * to generate updated or new *.replies data files.
      *
      * If you manually edit replies files you can run
-     * "tests/qemucapsfixreplies foo.replies" to fix the replies ids.
+     * "tests/tools/qemucapsfixreplies foo.replies" to fix the replies ids.
      *
      * Once a replies file has been generated and tweaked if necessary,
      * you can drop it into tests/qemucapabilitiesdata/ (with a sensible
diff --git a/tests/testutils.c b/tests/testutils.c
index 245b1832f6..080a1ccda2 100644
--- a/tests/testutils.c
+++ b/tests/testutils.c
@@ -533,7 +533,7 @@ virTestRewrapFile(const char *filename)
         return -1;
     }
 
-    if (virAsprintf(&script, "%s/test-wrap-argv.pl", abs_srcdir) < 0)
+    if (virAsprintf(&script, "%s/tools/test-wrap-argv.pl", abs_srcdir) < 0)
         goto cleanup;
 
     cmd = virCommandNewArgList(perl, script, "--in-place", filename, NULL);
diff --git a/tests/.valgrind.supp b/tests/tools/.valgrind.supp
similarity index 100%
rename from tests/.valgrind.supp
rename to tests/tools/.valgrind.supp
diff --git a/tests/tools/Makefile.inc.am b/tests/tools/Makefile.inc.am
new file mode 100644
index 0000000000..ffc38a93f7
--- /dev/null
+++ b/tests/tools/Makefile.inc.am
@@ -0,0 +1,23 @@
+# vim: filetype=automake
+
+if WITH_QEMU
+test_helpers += tools/qemucapsprobe
+test_libraries += tools/qemucapsprobemock.la
+
+tools_qemucapsprobe_SOURCES = \
+	tools/qemucapsprobe.c \
+	testutils.h
+tools_qemucapsprobe_LDADD = \
+	libqemutestdriver.la $(LDADDS)
+
+tools_qemucapsprobemock_la_SOURCES = \
+	tools/qemucapsprobemock.c
+tools_qemucapsprobemock_la_LDFLAGS = $(MOCKLIBS_LDFLAGS)
+tools_qemucapsprobemock_la_LIBADD = $(MOCKLIBS_LIBS)
+endif WITH_QEMU
+
+EXTRA_DIST += \
+	tools/.valgrind.supp \
+	tools/check-file-access.pl \
+	tools/file_access_whitelist.txt \
+	tools/oomtrace.pl
diff --git a/tests/check-file-access.pl b/tests/tools/check-file-access.pl
similarity index 98%
rename from tests/check-file-access.pl
rename to tests/tools/check-file-access.pl
index ea0b7a18a2..2f1796b0f3 100755
--- a/tests/check-file-access.pl
+++ b/tests/tools/check-file-access.pl
@@ -25,7 +25,7 @@ use strict;
 use warnings;
 
 my $access_file = "test_file_access.txt";
-my $whitelist_file = "file_access_whitelist.txt";
+my $whitelist_file = "tools/file_access_whitelist.txt";
 
 my @known_actions = ("open", "fopen", "access", "stat", "lstat", "connect");
 
diff --git a/tests/file_access_whitelist.txt b/tests/tools/file_access_whitelist.txt
similarity index 100%
rename from tests/file_access_whitelist.txt
rename to tests/tools/file_access_whitelist.txt
diff --git a/tests/group-qemu-caps.pl b/tests/tools/group-qemu-caps.pl
similarity index 100%
rename from tests/group-qemu-caps.pl
rename to tests/tools/group-qemu-caps.pl
diff --git a/tests/oomtrace.pl b/tests/tools/oomtrace.pl
similarity index 100%
rename from tests/oomtrace.pl
rename to tests/tools/oomtrace.pl
diff --git a/tests/qemucapsprobe.c b/tests/tools/qemucapsprobe.c
similarity index 96%
rename from tests/qemucapsprobe.c
rename to tests/tools/qemucapsprobe.c
index 14c0ecad97..7a5018676c 100644
--- a/tests/qemucapsprobe.c
+++ b/tests/tools/qemucapsprobe.c
@@ -47,7 +47,7 @@ main(int argc, char **argv)
     virThread thread;
     virQEMUCapsPtr caps;
 
-    VIR_TEST_PRELOAD(abs_builddir "/.libs/qemucapsprobemock.so");
+    VIR_TEST_PRELOAD(abs_builddir "/tools/.libs/qemucapsprobemock.so");
 
     if (argc != 2) {
         fprintf(stderr, "%s QEMU_binary\n", argv[0]);
diff --git a/tests/qemucapsprobemock.c b/tests/tools/qemucapsprobemock.c
similarity index 100%
rename from tests/qemucapsprobemock.c
rename to tests/tools/qemucapsprobemock.c
diff --git a/tests/test-wrap-argv.pl b/tests/tools/test-wrap-argv.pl
similarity index 98%
rename from tests/test-wrap-argv.pl
rename to tests/tools/test-wrap-argv.pl
index 7867e9d719..4a28ee9d46 100755
--- a/tests/test-wrap-argv.pl
+++ b/tests/tools/test-wrap-argv.pl
@@ -94,7 +94,7 @@ sub rewrap {
             close DIFF;
 
             print STDERR "Incorrect line wrapping in $file\n";
-            print STDERR "Use test-wrap-argv.pl to wrap test data files\n";
+            print STDERR "Use tests/tools/test-wrap-argv.pl to wrap test data files\n";
             return -1;
         }
     } else {
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list