aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-extended/libvirt/libvirt/runptest.patch
blob: f6bc773697d5d28ce4bd9b9fdc81a4f0b505243e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
From d210838a4433dd254c1a11b08b804ebe9ff5f378 Mon Sep 17 00:00:00 2001
From: Dengke Du <dengke.du@windriver.com>
Date: Wed, 8 May 2019 10:20:47 +0800
Subject: [PATCH] Add 'install-ptest' rule

Change TESTS_ENVIRONMENT to allow running outside build dir.

Upstream-status: Pending
Signed-off-by: Mihaela Sendrea <mihaela.sendrea@enea.com>
[KK: Update context for 1.3.5.]
Signed-off-by: Kai Kang <kai.kang@windriver.com>
[MA: Allow separate source and build dirs]
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
[ZH: add missing test_helper files]
Signed-off-by: He Zhe <zhe.he@windriver.com>
[MA: Update context for v4.3.0]
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
[DDU: Update context for v5.3.0]
Signed-off-by: Dengke Du <dengke.du@windriver.com>

---
 tests/Makefile.am | 68 +++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 60 insertions(+), 8 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index ada5b8f..4a808dd 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -28,11 +28,13 @@ AM_CPPFLAGS = \
 
 WARN_CFLAGS += $(RELAXED_FRAME_LIMIT_CFLAGS)
 
+PTEST_DIR ?= $(libdir)/libvirt/ptest
+
 AM_CFLAGS = \
-	-Dabs_builddir="\"$(abs_builddir)\"" \
-	-Dabs_top_builddir="\"$(abs_top_builddir)\"" \
-	-Dabs_srcdir="\"$(abs_srcdir)\"" \
-	-Dabs_top_srcdir="\"$(abs_top_srcdir)\"" \
+	-Dabs_builddir="\"$(PTEST_DIR)/tests\"" \
+	-Dabs_top_builddir="\"$(PTEST_DIR)\"" \
+	-Dabs_srcdir="\"$(PTEST_DIR)/tests\"" \
+	-Dabs_top_srcdir="\"$(PTEST_DIR)\"" \
 	$(LIBXML_CFLAGS) \
 	$(GLIB_CFLAGS) \
 	$(LIBNL_CFLAGS) \
@@ -474,10 +476,10 @@ TESTS = $(test_programs) \
 
 VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT)
 TESTS_ENVIRONMENT = \
-  abs_top_builddir="$(abs_top_builddir)" \
-  abs_top_srcdir="$(abs_top_srcdir)" \
-  abs_builddir="$(abs_builddir)" \
-  abs_srcdir="$(abs_srcdir)" \
+  abs_top_builddir="$(PTEST_DIR)" \
+  abs_top_srcdir="$(PTEST_DIR)" \
+  abs_builddir="$(PTEST_DIR)/tests" \
+  abs_srcdir="$(PTEST_DIR)/tests" \
   LIBVIRT_AUTOSTART=0 \
   LC_ALL=C \
   VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE) \
@@ -1547,4 +1549,54 @@ else ! WITH_LINUX
 EXTRA_DIST += virscsitest.c
 endif  ! WITH_LINUX
 
+buildtest-TESTS: $(TESTS) $(test_libraries) $(test_helpers)
+
+PTESTS = $(TESTS) $(test_helpers) test-lib.sh virschematest
+
+install-ptest:
+	list='$(TESTS) $(test_helpers) test-lib.sh virschematest'
+	install -d $(DEST_DIR)/tools
+	@(if [ -d ../tools/.libs ] ; then cd ../tools/.libs; fi; \
+	install * $(DEST_DIR)/tools)
+	install -d $(DEST_DIR)/src/network
+	cp $(top_srcdir)/src/network/*.xml $(DEST_DIR)/src/network
+	install -d $(DEST_DIR)/src/cpu_map
+	cp $(top_srcdir)/src/cpu_map/*.xml $(DEST_DIR)/src/cpu_map
+	install ../src/libvirt_iohelper $(DEST_DIR)/src
+	install -D ../src/libvirtd $(DEST_DIR)/src/libvirtd
+	install -d $(DEST_DIR)/src/remote
+	install -D $(top_srcdir)/../build/src/remote/libvirtd.conf $(DEST_DIR)/src/remote/libvirtd.conf
+	install -d $(DEST_DIR)/src/remote/.libs
+	@(if [ -d ../src/remote/.libs ] ; then cd ../src/remote/.libs; fi; \
+	install * $(DEST_DIR)/src/remote/.libs)
+	install -d $(DEST_DIR)/src/.libs
+	@(if [ -d ../src/.libs ] ; then cd ../src/.libs; fi; \
+	install * $(DEST_DIR)/src/.libs)
+	install -d $(DEST_DIR)/docs/schemas
+	cp $(top_srcdir)/docs/schemas/*.rng $(DEST_DIR)/docs/schemas
+	cp -r $(top_srcdir)/build-aux $(DEST_DIR)
+	install -d $(DEST_DIR)/examples/xml
+	cp -r $(top_srcdir)/examples/xml/test $(DEST_DIR)/examples/xml
+	install -d $(DEST_DIR)/tests/.libs
+	find . -type d -name "*xml2xml*" -exec cp -r {} $(DEST_DIR)/tests \;
+	find . -type d -name "*data" -exec cp -r {} $(DEST_DIR)/tests \;
+	@(for file in $(PTESTS); do \
+		if [ -f .libs/$$file ]; then \
+			install .libs/$$file $(DEST_DIR)/tests; \
+		elif [ -f $(srcdir)/$$file ]; then \
+			install $(srcdir)/$$file $(DEST_DIR)/tests; \
+		else \
+			install $(builddir)/$$file $(DEST_DIR)/tests; \
+		fi; \
+	done;)
+	@(if [ -d .libs ]; then install .libs/*.so $(DEST_DIR)/tests/.libs; fi;)
+	cp ../config.h $(DEST_DIR)
+	cp Makefile $(DEST_DIR)/tests
+	sed -i -e 's/^Makefile:/_Makefile:/' $(DEST_DIR)/tests/Makefile
+	cp ../Makefile $(DEST_DIR)
+	sed -i -e 's|^Makefile:|_Makefile:|' $(DEST_DIR)/Makefile
+	sed -i -e 's|$(BUILD_DIR)|$(PTEST_DIR)|g' $(DEST_DIR)/tests/Makefile
+	sed -i -e 's|$(BUILD_DIR)|$(PTEST_DIR)|g' $(DEST_DIR)/Makefile
+	sed -i -e 's|^\(.*\.log:\) \(.*EXEEXT.*\)|\1|g' $(DEST_DIR)/tests/Makefile
+
 CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda