[Bash-completion-devel] Bump match_max for test suite?

Freddy Vulto fvulto at gmail.com
Wed Jan 20 21:27:35 UTC 2010


On 100116 13:51, Guillaume Rousse wrote:
> Avoiding assumptions whenever possible ensure consistent results, that's
> my point. The test you describe will fail, without added value to
> anyone, when run by a user with a 'locanything' host in its
> /etc/resolv.conf file.

Why would that fail?  The completion would produce:

    $ loc<TAB>
    ... localhost ... locanything ...

and if the test checks for 'localhost' "among possibly others" thus:
"\s+localhost\s+" we have tested successfully that at least `localhost' is
listed as a possible completion.

I think both tests on top of the user's environment and tests within a constant
test environment serve a purpose.  But I also found tests on top of the user's
environment easier to write (and definitely useful).  

The way I go about writing tests is that I first try to make the utility point
to its test/fixtures/<util> directory, and if this isn't possible, I try to let
the testcase add values from the current user's environment to the expected
results at run-time.

The only time when I long for a fixed test environment, is when the steps above
fail or are becoming difficult.  I've been looking at `chroot' to create some
kind of `chroot jail' in which tests could be run but I don't have any
experience with chroot and didn't really feel the need so left it at that...
I'm also afraid that maintaining a large test environment is putting a burden
on development, so at least we'd better create tiny test environments per
utility within the test/fixtures directory? 

I saw you already did a:

   assert_bash_exec {HOME=$TESTDIR}

within test/lib/completions/xhost.exp, which is in fact creating a constant
test environment.  Maybe it's better to point it to $TESTDIR/fixtures/xhost?.
And restore HOME within the teardown()?  I've tried relocating HOME for ssh,
but this doesn't work for ssh (it keeps looking at the old HOME dir or in fact
retrieves HOME from somewhere else I believe).

What are your ideas on creating a constant test environment?  Would chroot be
useful?

Regards,

Freddy Vulto
http://fvue.nl



More information about the Bash-completion-devel mailing list