diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2009-05-28 13:15:34 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2009-05-28 13:15:34 +0100 |
commit | e2206733d1287f5809dbde954f3eb64420471b0d (patch) | |
tree | 0f8efec3202e0577e581aa87ac443be82b38ad71 | |
parent | a1e8cdf2a254c5eddaf525cd7c34e4c937690204 (diff) | |
download | libguestfs-e2206733d1287f5809dbde954f3eb64420471b0d.tar.gz libguestfs-e2206733d1287f5809dbde954f3eb64420471b0d.tar.xz libguestfs-e2206733d1287f5809dbde954f3eb64420471b0d.zip |
Move C API tests out of root build dir into 'capitests' subdir.
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | HACKING | 3 | ||||
-rw-r--r-- | Makefile.am | 35 | ||||
-rw-r--r-- | capitests/Makefile.am | 49 | ||||
-rwxr-xr-x | capitests/test-bootbootboot.sh (renamed from test-bootbootboot.sh) | 0 | ||||
-rwxr-xr-x | capitests/test-cleanup.sh (renamed from test-cleanup.sh) | 0 | ||||
-rw-r--r-- | capitests/test-command.c (renamed from test-command.c) | 0 | ||||
-rw-r--r-- | capitests/tests.c (renamed from tests.c) | 5 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rwxr-xr-x | src/generator.ml | 7 |
10 files changed, 62 insertions, 46 deletions
@@ -25,6 +25,10 @@ appliance/make-initramfs.sh.in.old appliance/update-initramfs.sh appliance/vmlinuz.* autom4te.cache +capitests/test-command +capitests/test*.img +capitests/test*.tmp +capitests/tests compile config.h config.h.in @@ -91,7 +95,3 @@ ruby/Rakefile ruby/ext/guestfs/extconf.h ruby/ext/guestfs/mkmf.log stamp-h1 -test-command -test*.img -test*.tmp -tests @@ -34,6 +34,9 @@ Directories appliance/ The qemu appliance, build scripts and so on. +capitests/ + Automated tests of the C API. + contrib/ Outside contributions, experimental parts. diff --git a/Makefile.am b/Makefile.am index 17adf1ca..55b20ba9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -17,7 +17,7 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src daemon appliance fish po examples images +SUBDIRS = src daemon appliance fish po examples images capitests if HAVE_OCAML SUBDIRS += ocaml @@ -47,7 +47,6 @@ EXTRA_DIST = \ guestfish.pod guestfish-actions.pod \ html/pod.css \ HACKING TODO \ - tests.c \ libguestfs.pc libguestfs.pc.in \ gitlog-to-changelog \ recipes/LICENSE \ @@ -57,40 +56,10 @@ EXTRA_DIST = \ recipes/*.example \ html/recipes.css \ make-recipes.sh \ - test-cleanup.sh \ contrib/README \ contrib/febootstrap/install.title \ contrib/febootstrap/install.html \ - contrib/febootstrap/install.sh \ - test-bootbootboot.sh - -# Tests. These are auto-generated from the test descriptions -# in the generator. - -check_PROGRAMS = tests test-command - -tests_SOURCES = tests.c -tests_CFLAGS = \ - -I$(top_builddir)/src -Wall -tests_LDADD = $(top_builddir)/src/libguestfs.la - -TESTS = tests test-bootbootboot.sh -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_ZEROFREE=$(shell test -x initramfs/usr/sbin/zerofree || echo 1) \ - $(VG) - -# Run the tests under valgrind. - -valgrind: - $(MAKE) check VG="valgrind --quiet --leak-check=full" - -# This binary must be statically linked. It is used for testing -# the "guestfs_command" and "guestfs_command_lines" functions. - -test_command_SOURCES = test-command.c -test_command_LDFLAGS = -all-static + contrib/febootstrap/install.sh # Manual pages. # guestfs-actions.pod and guestfs-structs are autogenerated. There is diff --git a/capitests/Makefile.am b/capitests/Makefile.am new file mode 100644 index 00000000..f061243b --- /dev/null +++ b/capitests/Makefile.am @@ -0,0 +1,49 @@ +# libguestfs +# Copyright (C) 2009 Red Hat Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +EXTRA_DIST = \ + tests.c \ + test-cleanup.sh \ + test-bootbootboot.sh + +# Tests. These are auto-generated from the test descriptions +# in the generator. + +check_PROGRAMS = tests test-command + +tests_SOURCES = tests.c +tests_CFLAGS = \ + -I$(top_builddir)/src -Wall +tests_LDADD = $(top_builddir)/src/libguestfs.la + +TESTS = tests test-bootbootboot.sh +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_ZEROFREE=$(shell test -x ../initramfs/usr/sbin/zerofree || echo 1) \ + $(VG) + +# Run the tests under valgrind. + +valgrind: + $(MAKE) check VG="valgrind --quiet --leak-check=full" + +# This binary must be statically linked. It is used for testing +# the "guestfs_command" and "guestfs_command_lines" functions. + +test_command_SOURCES = test-command.c +test_command_LDFLAGS = -all-static diff --git a/test-bootbootboot.sh b/capitests/test-bootbootboot.sh index 7728f384..7728f384 100755 --- a/test-bootbootboot.sh +++ b/capitests/test-bootbootboot.sh diff --git a/test-cleanup.sh b/capitests/test-cleanup.sh index 33194ab2..33194ab2 100755 --- a/test-cleanup.sh +++ b/capitests/test-cleanup.sh diff --git a/test-command.c b/capitests/test-command.c index 1e29ee91..1e29ee91 100644 --- a/test-command.c +++ b/capitests/test-command.c diff --git a/tests.c b/capitests/tests.c index 11bd2a52..5d945980 100644 --- a/tests.c +++ b/capitests/tests.c @@ -15699,10 +15699,7 @@ int main (int argc, char *argv[]) guestfs_set_error_handler (g, print_error, NULL); - srcdir = getenv ("srcdir"); - if (!srcdir) srcdir = "."; - chdir (srcdir); - guestfs_set_path (g, "appliance"); + guestfs_set_path (g, "../appliance"); filename = "test1.img"; fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666); diff --git a/configure.ac b/configure.ac index d40464d7..2d918720 100644 --- a/configure.ac +++ b/configure.ac @@ -449,6 +449,7 @@ AC_CONFIG_FILES([Makefile appliance/Makefile appliance/make-initramfs.sh appliance/update-initramfs.sh images/Makefile + capitests/Makefile ocaml/Makefile ocaml/examples/Makefile perl/Makefile python/Makefile diff --git a/src/generator.ml b/src/generator.ml index 03439aa0..67415412 100755 --- a/src/generator.ml +++ b/src/generator.ml @@ -3717,10 +3717,7 @@ int main (int argc, char *argv[]) guestfs_set_error_handler (g, print_error, NULL); - srcdir = getenv (\"srcdir\"); - if (!srcdir) srcdir = \".\"; - chdir (srcdir); - guestfs_set_path (g, \"appliance\"); + guestfs_set_path (g, \"../appliance\"); filename = \"test1.img\"; fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666); @@ -7182,7 +7179,7 @@ Run it from the top source directory using the command generate_daemon_actions (); close (); - let close = output_to "tests.c" in + let close = output_to "capitests/tests.c" in generate_tests (); close (); |