summaryrefslogtreecommitdiffstats
path: root/recipes-extended/libvirt/libvirt/runptest.patch
blob: b900c015caa331ec0ccc1f75a1843fb1fbb80f49 (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
From 94478517c4f9950b28be3a348387db6ede3db812 Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselstine@windriver.com>
Date: Mon, 4 Jun 2018 11:55:37 -0400
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>
---
 tests/Makefile.am | 74 +++++++++++++++++++++++++++++++++++++++++++++----------
 1 file changed, 61 insertions(+), 13 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 7b93fbd..edc1eb9 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -35,11 +35,13 @@ INCLUDES = \
 
 WARN_CFLAGS += $(RELAXED_FRAME_LIMIT_CFLAGS)
 
+PTEST_DIR ?= $(libdir)/libvirt/ptest
+
 AM_CFLAGS = \
-	-Dabs_builddir="\"$(abs_builddir)\"" \
-	-Dabs_topbuilddir="\"$(abs_topbuilddir)\"" \
-	-Dabs_srcdir="\"$(abs_srcdir)\"" \
-	-Dabs_topsrcdir="\"$(abs_topsrcdir)\"" \
+	-Dabs_builddir="\"$(PTEST_DIR)/tests\"" \
+	-Dabs_topbuilddir="\"$(PTEST_DIR)\"" \
+	-Dabs_srcdir="\"$(PTEST_DIR)/tests\"" \
+	-Dabs_topsrcdir="\"$(PTEST_DIR)\"" \
 	$(LIBXML_CFLAGS) \
 	$(LIBNL_CFLAGS) \
 	$(GNUTLS_CFLAGS) \
@@ -64,7 +66,7 @@ QEMULIB_LDFLAGS = \
 	$(MINGW_EXTRA_LDFLAGS)
 
 INCLUDES += \
-	-DTEST_DRIVER_DIR=\"$(top_builddir)/src/.libs\"
+	-DTEST_DRIVER_DIR=\"$(PTEST_DIR)/src/.libs\"
 
 PROBES_O =
 if WITH_DTRACE_PROBES
@@ -466,17 +468,15 @@ TESTS = $(test_programs) \
 # Also, BSD sh doesn't like 'a=b b=$$a', so we can't use an
 # intermediate shell variable, but must do all the expansion in make
 
-lv_abs_top_builddir=$(shell cd '$(top_builddir)' && pwd)
-
 VIR_TEST_EXPENSIVE ?= $(VIR_TEST_EXPENSIVE_DEFAULT)
 TESTS_ENVIRONMENT = \
-  abs_top_builddir=$(lv_abs_top_builddir) \
-  abs_top_srcdir=`cd '$(top_srcdir)'; pwd` \
-  abs_builddir=$(abs_builddir) \
-  abs_srcdir=$(abs_srcdir) \
-  CONFIG_HEADER="$(lv_abs_top_builddir)/config.h" \
+  abs_top_builddir="$(PTEST_DIR)" \
+  abs_top_srcdir="$(PTEST_DIR)" \
+  abs_builddir="$(PTEST_DIR)/tests" \
+  abs_srcdir="$(PTEST_DIR)/tests" \
+  CONFIG_HEADER="$(PTEST_DIR)/config.h" \
   SHELL="$(SHELL)" \
-  LIBVIRT_DRIVER_DIR="$(lv_abs_top_builddir)/src/.libs" \
+  LIBVIRT_DRIVER_DIR="$(PTEST_DIR)/src/.libs" \
   LIBVIRT_AUTOSTART=0 \
   LC_ALL=C \
   VIR_TEST_EXPENSIVE=$(VIR_TEST_EXPENSIVE) \
@@ -1486,5 +1486,55 @@ else ! WITH_CIL
 EXTRA_DIST += objectlocking.ml
 endif ! WITH_CIL
 
+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
+	cp $(top_srcdir)/src/cpu/*.xml $(DEST_DIR)/src/cpu
+	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)/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 *.cmi *.cmx \
 	objectlocking-files.txt
-- 
2.7.4