From: Richard W.M. Jones <rjones@redhat.com>
Date: Wed, 3 Nov 2010 17:26:00 +0000 (+0000)
Subject: capitests: Set path in TESTS_ENVIRONMENT instead of in tests.c
X-Git-Tag: 1.6.1~18
X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=4c7b6facdc7d8cb65d5fb3c0ad2764523165dfce;p=libguestfs.git

capitests: Set path in TESTS_ENVIRONMENT instead of in tests.c

By exporting LIBGUESTFS_PATH with the right path to the appliance,
we no longer need to hard code the path in tests.c
(cherry picked from commit 2a33d81e2b7fa2affaaad48538307c818b4a8260)
---

diff --git a/capitests/Makefile.am b/capitests/Makefile.am
index 023efe4..65a7240 100644
--- a/capitests/Makefile.am
+++ b/capitests/Makefile.am
@@ -38,6 +38,7 @@ TESTS_ENVIRONMENT = \
 	SKIP_TEST_COMMAND=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
 	SKIP_TEST_COMMAND_LINES=$(shell ldd test-command | grep -sq 'not a dynamic executable' || echo 1) \
 	SKIP_TEST_CHECKSUM_8=$(shell if test `find ../initramfs -name squashfs.ko | wc -l` -eq 0; then echo 1; fi) \
+	LIBGUESTFS_PATH=$(top_builddir)/appliance \
 	$(VG)
 
 # Run the tests under valgrind.
diff --git a/generator/generator_capitests.ml b/generator/generator_capitests.ml
index b41e288..707d59b 100644
--- a/generator/generator_capitests.ml
+++ b/generator/generator_capitests.ml
@@ -175,8 +175,6 @@ int main (int argc, char *argv[])
 
   guestfs_set_error_handler (g, print_error, NULL);
 
-  guestfs_set_path (g, \"../appliance\");
-
   filename = \"test1.img\";
   fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
   if (fd == -1) {