39 Commits

Author SHA1 Message Date
Pino Toscano
1f5054daa8 php: Fix the tests yet again.
Move unsetting of LIBGUESTFS_DEBUG & LIBGUESTFS_TRACE into the
php-for-tests.sh wrapper.

Fixes commit 0d69eab98f.
2016-05-03 13:21:34 +01:00
Richard W.M. Jones
915f6e299e Revert "php: Fix the tests ... again."
This reverts commit 0d69eab98f.
2016-05-03 13:21:34 +01:00
Richard W.M. Jones
0d69eab98f php: Fix the tests ... again.
PHP (5?) renamed the PHP_EXECUTABLE variable to TEST_PHP_EXECUTABLE.
As a result of that if you enabled debugging, the tests broke because
we no longer used our custom PHP wrapper to filter out debugging
environment variables before running the tests, so debug output was
mixed with the expected output.

This commit also updates an old comment telling you how to debug PHP
tests.
2016-04-24 15:08:12 +01:00
Pino Toscano
76a01fe41d php: pass $(MAKE) to run-php-tests.sh
Instead of hardcoding "make" in run-php-tests.sh, pass the actual name
of make from the Makefile; the default is still "make", mostly to use
the script without having to set $MAKE.
2016-03-22 09:45:41 +01:00
Pino Toscano
f7765ea6e4 Start adding return values tests for bindings
Introduce a new kind of bindings tests, 090-retvalues, to check all the
possible return values in bindings; start implementing them for
scripting languages such as GObject introspection, Perl, PHP, Python,
and Ruby, reusing existing implementations where existing.
2016-02-15 18:32:07 +01:00
Richard W.M. Jones
85b1815e7b tests: Make '080' be an official test of the guestfs_version API.
Useful because it tests returning a single structure.
2016-02-12 15:41:42 +00:00
Pino Toscano
7a598a0c02 php: restructure and expand tests
Rename the existing tests according to the naming/numbering described in
guestfs-hacking(1), and improve the current ones:
- guestfs_php_001.phpt: rename to guestfs_020_create.phpt
- guestfs_php_003.phpt: rename to guestfs_070_optargs.phpt
- guestfs_php_bindtests.phpt: rename to guestfs_090_bindtests.phpt
- guestfs_090_version.phpt: new, checks taken from the former
  guestfs_php_002.phpt
- guestfs_100_launch.phpt: new, modelled after the equivalent in e.g.
  OCaml/Perl/Python
- guestfs_php_002.phpt: remove, as what it did is now covered by
  090_version and 100_launch
2016-02-12 15:10:07 +01:00
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Richard W.M. Jones
d23134c5b8 php: Clean up more intermediate files. 2015-04-10 13:55:07 +01:00
Richard W.M. Jones
c5800dc97d Update copyright dates for 2015. 2015-01-17 09:08:15 +00:00
Pino Toscano
f80fc724bc php: raise the per-test timeout to 300 secs
Some tests might spawn an appliance, which will take time on slower
architectures and on some virtualized environments.
Hence raise the per-test timeout from the default of 60s to 300s (which
should be hopefully enough for now).
2014-03-24 17:05:14 +01:00
Richard W.M. Jones
4edf659aa0 php: Include new location of tests in EXTRA_DIST.
This fixes commit 251a1934c9.
2014-03-20 15:24:34 +00:00
Pino Toscano
251a1934c9 php: move tests under a tests subdirectory
This eases fixes the classname in the junit output of run-tests.php,
which now can be properly handled by junit XML consumers.
2014-03-18 15:12:26 +01:00
Pino Toscano
7fb823e427 php: make the test suite failures fatal
So far the failure of some test would have not reported a non-zero
return value by run-tests.php. Since now all the PHP tests pass, we can
ask for failures to be fatal, by exporting REPORT_EXIT_STATUS=1 for
run-tests.php.
2014-03-18 14:38:02 +01:00
Pino Toscano
e411cf8269 php: remove the custom "env" loading in tests
Other than being too late for changing environment variables like
LD_LIBRARY_PATH, now it is no more needed.
2014-03-13 11:43:24 +01:00
Pino Toscano
5fbbfe7440 php: add a custom PHP runner for tests
Since the default PHP test runner ignores a good number of environment
variables to potentially tampering the test suite execution, create a
custom php-for-tests.sh script which does nothing more than sourcing the
custom environment that our run-php-tests.sh outputs and running the
actual "php" executable (the one found by configure).

This fixes the loading of the guestfs_php.so module in the test suite,
as the libguestfs.so.0 library can be found by that module.
2014-03-13 11:43:24 +01:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Richard W.M. Jones
14fabcd88e tests: Use new guestfs_add_drive_scratch API where possible in tests.
Replaces code such as:

  fd = open "test1.img"
  ftruncate fd, size
  close fd
  g.add_drive "test1.img"

with the shorter and simpler:

  g.add_drive_scratch size
2013-07-20 16:31:42 +01:00
Richard W.M. Jones
49bdaabc7d build: Add common-rules.mk, common rules for all Makefiles.
This file is mainly a central place to:

 - include localenv if it exists, and

 - define the RHEL 5 backwards compatibility macros, instead of
   spreading them over every other file.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
6d87aaefa0 php: Fix comment in run-php-tests.sh.
This updates commit cd40cf7139.
2013-05-17 11:53:45 +01:00
Richard W.M. Jones
0ec2726a52 php: Disallow separated builds.
As it stands, this will just break.  Until it is fixed, give a
diagnostic message.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
6e4f9be492 php: Pass all libvirt environment variables down to PHP test scripts.
Including LIBVIRTD_* and VIRTLOCKD_*.

This updates commit cd40cf7139.
2013-03-12 12:35:17 +00:00
Richard W.M. Jones
cd40cf7139 php: Fix tests.
- Use ./run script to run the tests.
- Set environment variables correctly, including $PATH.
- Test the locally built, not installed, copy of libguestfs.
2013-03-11 16:04:17 +00:00
Richard W.M. Jones
becc4fecf4 php: Revise README-PHP documentation. 2013-03-11 14:29:13 +00:00
Richard W.M. Jones
fe3798f366 php: Print libguestfs error string if test fails. 2013-03-11 13:44:50 +00:00
Richard W.M. Jones
d44752a110 php: Fix test, /dev/null format must be "raw". 2013-03-11 13:44:33 +00:00
Matthew Booth
27b995c841 Make internal-only functions and structures private
Certain functions are intended to be internal only, but we currently
export them anyway. This change moves them into a separate section of
guestfs.h protected by a GUESTFS_PRIVATE variable. This change also
enables private structs, but doesn't implement any.

This change only affects the C api. Language bindings aren't affected,
but probably should be in the future.
2013-01-30 17:27:01 +00:00
Richard W.M. Jones
7486fc6f43 generator: Rename 'add_drive_opts' API to 'add_drive'.
By using the once_had_no_optargs flag, this change is backwards
compatible for callers (except Haskell, PHP and GObject as discussed
in earlier commit).
2012-07-14 12:42:24 +01:00
Richard W.M. Jones
50aa9533e4 build: Define builddir and abs_srcdir when they are missing.
RHEL 5-era autoconf did not define these, so define them manually
when they are missing.

Define builddir as '.'  The scripts require this.  It won't work
in the srcdir != builddir case, but we don't care about that for
RHEL 5.

This commit also moves the builddir / abs_srcdir variable setting
above the include of subdir-rules.mk, in case that include uses
these variables.

Useful script:

  for f in $(find -name Makefile.am | xargs fgrep '$(abs_srcdir)' -l) ; do
    if ! grep -q '^abs_srcdir' $f; then
      echo missing in $f
    fi
  done
2012-06-18 15:32:47 +01:00
Richard W.M. Jones
4f868b84d6 php: Enable 'make clean' in extension subdirectory. 2012-01-22 14:38:07 +00:00
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard W.M. Jones
4fb3b23fb6 php: Fix bug in PHP tests.
We partitioned the disk, and then tried to create a PV on the whole
disk.  LVM gave the error:

  Device /dev/vda not found (or ignored by filtering).

It is unclear how this bug persisted for so long.  It might be due to
a change in LVM.
2011-08-23 20:21:32 +01:00
Richard W.M. Jones
b79e075d63 php: Combine tests to reduce number of launches. 2010-11-30 14:18:34 +00:00
Richard W.M. Jones
14490c3e1a generator: Optional arguments, add-drive-opts (RHBZ#642934,CVE-2010-3851).
This large commit changes the generator so that optional arguments
can be supported for functions.

The model for arguments (known as the "style") is changed from
(ret, args) to (ret, args, optargs) where optargs is a more limited
list of arguments.

One function has been added which takes optional arguments, it is
"add-drive-opts", modelled as:

  (RErr, [String "filename"], #required
         [Bool "readonly"; String "format"; String "iface"]) #optional

Note that this function is processed in the library (does not go over
the RPC protocol to the daemon).  This has allowed us to simplify
the current implementation by omitting changes related to RPC or the
daemon, although we plan to add these at some point in the future.

From C this function can be called in 3 different ways as in these
examples:

  guestfs_add_drive_opts (g, filename,
                          GUESTFS_ADD_DRIVE_OPTS_READONLY, 1,
			  GUESTFS_ADD_DRIVE_OPTS_FORMAT, "raw",
                          -1);

(the argument(s) between 'filename' and '-1' are the optional ones).

  guestfs_add_drive_opts_va (g, filename, args);

where 'args' is a va_list.  This works like the first version.

  struct guestfs_add_drive_opts_argv optargs = {
    .bitmask = GUESTFS_ADD_DRIVE_OPTS_READONLY_BITMASK,
    .readonly = 1,
  }
  guestfs_add_drive_opts_argv (g, filename, &optargs);

This last form lets you construct lists of optional arguments, and
is used by guestfish and the language bindings.

In guestfish optional arguments are used like this:

  add-drive-opts filename readonly:true

In OCaml these are mapped naturally to OCaml optional arguments, eg:

  g#add_drive_opts ~readonly:true filename;

In Perl these are mapped to extra arguments, eg:

  $g->add_drive_opts ($filename, readonly => 1);

In Python these are mapped to optional arguments, eg:

  g.add_drive_opts ("file", readonly = 1, format = "qcow2")

In Ruby these are mapped to a final hash argument, eg:

  g.add_drive_opts("file", {})
  g.add_drive_opts("file", :readonly => 1)
  g.add_drive_opts("file", :readonly => 1, :iface => "virtio")

In PHP these are mapped to extra parameters.  This is not quite
accurate since you cannot omit arbitrary optional parameters, but
there's not much than can be done within the limitations of PHP
as a language.

Unimplemented in: Haskell, C#, Java.
2010-10-22 17:45:00 +01:00
Richard W.M. Jones
4460280960 php: Create test file properly before running test. 2010-10-21 18:47:44 +01:00
Richard W.M. Jones
c97d6c16bd php: Note that tests are testing the wrong thing. 2010-10-21 18:41:56 +01:00
Richard Jones
c1b6352677 syntax: Fully bracket m4 macro arguments. 2010-09-10 22:57:52 +01:00
Richard Jones
bd77c8d1b4 php: Remove 'make clean' rule in subdirectory. 2010-09-05 16:51:45 -04:00
Richard Jones
2c61e04c45 PHP bindings.
Note that these are not complete on 32 bit architectures.  PHP doesn't
offer any convenient 64 bit type (on 32 bit).  Therefore you should
always use these PHP bindings on 64 bit.
2010-09-04 13:38:03 +01:00