On Tue, May 27, 2014 at 10:35 AM, Julio Merino <jm...@meroh.net> wrote:Why is it ok to change the shell via an environment variable, but not
> On Tue, May 27, 2014 at 12:16 PM, Alan Somers <aso...@freebsd.org> wrote:
>> So what is the correct way to specify ATF_SHELL for an individual test
>> program or test case ?
>
> Well... you can't. atf-sh is "built" and _tested_ against a specific
> shell. Dynamically changing the shell at run-time to something
> different can (and probably will) cause all sorts of unexpected issues
> in libatf-sh.subr. (Allowing the end user to customize this, as you
> attempted via kyua.conf, is a non-option.)
via any configuration files? Is it because the config files are
parsed after atf-sh has already been invoked?
> What are you trying to do?I have a large number of tests that predate ATF. They were originally
written to run under ksh93 and no other shell. I've converted them to
run as ATF test programs, but I must specify ATF_SHELL in the
environment or they will fail in various ways. But ksh93 isn't 100%
backwards compatible with /bin/sh, so some of FreeBSD's builtin tests
fail when run with it.
So the situation I'm in is that I can't run
all of my tests with a single invocation of Kyua. That in turn means
that I can't view all of my results in a single HTML output file.
What solution would you recommend?
On Sep 25, 2014 12:30 AM, "Julio Merino" <jm...@meroh.net> wrote:
>
> On Tue, Sep 23, 2014 at 8:58 PM, Craig Rodrigues <rod...@freebsd.org> wrote:
> >
> > Now I am understanding the problems that Alan faced with this.
> > I have a whole lot of tests, some are written as /bin/sh compatible scripts,
> > and some are /bin/bash compatible scripts.
> >
> > Is there a way to override the ATF_SHELL on a per test basis?
>
> There isn't.
>
> I'm wondering if adding a flag to atf-sh to specify the shell would be
> sufficient and a good idea for this use case? Then you'd do "#!
> /somewhere/atf-sh -s /bin/bash".
>
Adding a flag to atf-sh would work for me. On Linux and Mac, compiling atf results in atf-sh using bash internally, and atf still works. So the internal shell routines in atf-sh are clean and portable to bash...dunno about ksh, but I think it should work there too.
The restriction would have to be that folks could only use "POSIX-compatible" shells. No csh, emacs, python, etc.
--
Craig
Alright then. This is done in head. Please let me know if things work
for you. Also, Alan, it'd be great if you'd check that this removes
the need for your ksh93 hack.