[Libguestfs] [PATCH v5 1/7] tests: Introduce test harness for running tests.

Richard W.M. Jones rjones at redhat.com
Fri Oct 24 12:31:52 UTC 2014


On Tue, Oct 21, 2014 at 05:56:14PM +0200, Pino Toscano wrote:
> > +  (* If we are running from automake, then automake will pass $srcdir
> > +   * to us, and if it's not "." then we have to adjust our path to the
> > +   * top source directory accordingly.
> > +   *)
> > +  let srcdir = try Sys.getenv "srcdir" with Not_found -> "." in
> > +
> > +  (* Are we running from the build directory or from installed tests? *)
> > +  let running_in_builddir = is_file (srcdir // "Makefile.am") in
> 
> The logic above would fool the runner if $srcdir is not set, and
> there's a file called Makefile.am in the current directory.
> Maybe something like:
>   let srcdir, running_in_builddir =
>     try
>       let srcdir = Sys.getenv "srcdir" in
>       srcdir, is_file (srcdir // "Makefile.am")
>     with Not_found ->
>       ".", false in

Actually I think the original is correct, since it lets you run
'./test-harness' from the build directory.

> Or, maybe it would be even clearer/better, just have a --uninstalled
> parameter to explicitly turn the runner into that mode, without
> implicit logic.

Then developers would need to use an explicit flag for this case.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top




More information about the Libguestfs mailing list