diff mbox series

[kvm-unit-tests] README: Reflect missing --getopt in configure

Message ID 20200924100613.71136-1-r.bolshakov@yadro.com (mailing list archive)
State New, archived
Headers show
Series [kvm-unit-tests] README: Reflect missing --getopt in configure | expand

Commit Message

Roman Bolshakov Sept. 24, 2020, 10:06 a.m. UTC
83760814f637 ("configure: Check for new-enough getopt") has replaced
proposed patch and doesn't introduce --getopt option in configure.
Instead, `configure` and `run_tests.sh` expect proper getopt to be
available in PATH.

Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
---
 README.macOS.md | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Paolo Bonzini Sept. 24, 2020, 10:18 a.m. UTC | #1
On 24/09/20 12:06, Roman Bolshakov wrote:
> 83760814f637 ("configure: Check for new-enough getopt") has replaced
> proposed patch and doesn't introduce --getopt option in configure.
> Instead, `configure` and `run_tests.sh` expect proper getopt to be
> available in PATH.

Is this because getopt is "keg only"?  I thought you could just add
`brew --prefix`/bin to the path.  You can also do "brew link" if there
are no backwards-compatibility issues.

Paolo

> Signed-off-by: Roman Bolshakov <r.bolshakov@yadro.com>
> ---
>  README.macOS.md | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/README.macOS.md b/README.macOS.md
> index 4ca5a57..62b00be 100644
> --- a/README.macOS.md
> +++ b/README.macOS.md
> @@ -22,10 +22,14 @@ $ brew install i686-elf-gcc
>  $ brew install x86_64-elf-gcc
>  ```
>  
> -32-bit x86 tests can be built like that:
> +Make enhanced getopt available in the current shell session:
> +```
> +export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
> +```
> +
> +Then, 32-bit x86 tests can be built like that:
>  ```
>  $ ./configure \
> -  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
>    --arch=i386 \
>    --cross-prefix=i686-elf-
>  $ make -j $(nproc)
> @@ -34,7 +38,6 @@ $ make -j $(nproc)
>  64-bit x86 tests can be built likewise:
>  ```
>  $ ./configure \
> -  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
>    --arch=x86_64 \
>    --cross-prefix=x86_64-elf-
>  $ make -j $(nproc)
> @@ -71,7 +74,6 @@ $ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
>  Once compiled, the cross-compiler can be used to build the tests:
>  ```
>  $ ./configure \
> -  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
>    --arch=x86_64 \
>    --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-
>  $ make -j $(nproc)
>
Roman Bolshakov Sept. 24, 2020, 10:30 a.m. UTC | #2
On Thu, Sep 24, 2020 at 12:18:04PM +0200, Paolo Bonzini wrote:
> On 24/09/20 12:06, Roman Bolshakov wrote:
> > 83760814f637 ("configure: Check for new-enough getopt") has replaced
> > proposed patch and doesn't introduce --getopt option in configure.
> > Instead, `configure` and `run_tests.sh` expect proper getopt to be
> > available in PATH.
> 
> Is this because getopt is "keg only"?  I thought you could just add
> `brew --prefix`/bin to the path.  You can also do "brew link" if there
> are no backwards-compatibility issues.
> 

Yes, keg-only packages do not shadow system utilities (which either come
from FreeBSD or GNU but have the most recent GPL2 version, i.e. quite
old), so adding `brew --prefix`/bin to PATH doesn't help much.

brew link doesn't help either :)

$ brew link gnu-getopt

Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

Thanks,
Roman
Paolo Bonzini Sept. 24, 2020, 10:34 a.m. UTC | #3
On 24/09/20 12:30, Roman Bolshakov wrote:
> Yes, keg-only packages do not shadow system utilities (which either come
> from FreeBSD or GNU but have the most recent GPL2 version, i.e. quite
> old), so adding `brew --prefix`/bin to PATH doesn't help much.
> 
> brew link doesn't help either :)
> 
> $ brew link gnu-getopt
> 
> Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
> If you need to have gnu-getopt first in your PATH run:
>   echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

Oh, that's not what https://docs.brew.sh/FAQ says:

-----
What does “keg-only” mean?

It means the formula is installed only into the Cellar and is not linked
into /usr/local. This means most tools will not find it. You can see why
a formula was installed as keg-only, and instructions to include it in
your PATH, by running brew info <formula>.

You can still link in the formula if you need to with brew link
<formula>, though this can cause unexpected behaviour if you are
shadowing macOS software.
-----

Apparently you need --force.

Paolo
Roman Bolshakov Sept. 24, 2020, 10:48 a.m. UTC | #4
On Thu, Sep 24, 2020 at 12:34:28PM +0200, Paolo Bonzini wrote:
> On 24/09/20 12:30, Roman Bolshakov wrote:
> > Yes, keg-only packages do not shadow system utilities (which either come
> > from FreeBSD or GNU but have the most recent GPL2 version, i.e. quite
> > old), so adding `brew --prefix`/bin to PATH doesn't help much.
> > 
> > brew link doesn't help either :)
> > 
> > $ brew link gnu-getopt
> > 
> > Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
> > If you need to have gnu-getopt first in your PATH run:
> >   echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
> 
> Oh, that's not what https://docs.brew.sh/FAQ says:
> 
> -----
> What does “keg-only” mean?
> 
> It means the formula is installed only into the Cellar and is not linked
> into /usr/local. This means most tools will not find it. You can see why
> a formula was installed as keg-only, and instructions to include it in
> your PATH, by running brew info <formula>.
> 
> You can still link in the formula if you need to with brew link
> <formula>, though this can cause unexpected behaviour if you are
> shadowing macOS software.
> -----
> 
> Apparently you need --force.
> 

Unfortunately it has no effect (and I wouldn't want to do that to avoid
issues with other scripts/software that implicitly depend on native
utilities):

$ brew link --force gnu-getopt
Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
If you need to have gnu-getopt first in your PATH run:
  echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc

So if it's possible I'd still prefer to add an option to specify
--getopt in configure. I can resend a patch for that.

Thanks,
Roman
Paolo Bonzini Sept. 24, 2020, 10:52 a.m. UTC | #5
On 24/09/20 12:48, Roman Bolshakov wrote:
> Unfortunately it has no effect (and I wouldn't want to do that to avoid
> issues with other scripts/software that implicitly depend on native
> utilities):
> 
> $ brew link --force gnu-getopt
> Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
> If you need to have gnu-getopt first in your PATH run:
>   echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
> 
> So if it's possible I'd still prefer to add an option to specify
> --getopt in configure. I can resend a patch for that.

No, I'm not going to accept that.  It's just Apple's stupidity.  I have
applied your patch, rewriting the harness in another language would
probably be a good idea though.

Paolo
Andrew Jones Sept. 24, 2020, 11:48 a.m. UTC | #6
On Thu, Sep 24, 2020 at 12:52:16PM +0200, Paolo Bonzini wrote:
> On 24/09/20 12:48, Roman Bolshakov wrote:
> > Unfortunately it has no effect (and I wouldn't want to do that to avoid
> > issues with other scripts/software that implicitly depend on native
> > utilities):
> > 
> > $ brew link --force gnu-getopt
> > Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
> > If you need to have gnu-getopt first in your PATH run:
> >   echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
> > 
> > So if it's possible I'd still prefer to add an option to specify
> > --getopt in configure. I can resend a patch for that.
> 
> No, I'm not going to accept that.  It's just Apple's stupidity.  I have
> applied your patch, rewriting the harness in another language would
> probably be a good idea though.
>

I also feel like we've outgrown Bash, especially when we implement
things like migration tests. We have had requests to keep it Bash
though in order to continue running in resource constrained environments.
I think we can have both. We could rewrite the harness is a different
language and then compile/generate standalone tests (as we already do
to some extent). The standalone tests need to be compiled/generated in
such a way that they can run in resource constrained environments.
Finally, with standalone tests the only test runner you need is

 for t in `ls tests`; do
   tests/$t
 done

which can be written in the minimal scripting language of your choice.

Thanks,
drew
Thomas Huth Sept. 24, 2020, 11:54 a.m. UTC | #7
On 24/09/2020 13.48, Andrew Jones wrote:
> On Thu, Sep 24, 2020 at 12:52:16PM +0200, Paolo Bonzini wrote:
>> On 24/09/20 12:48, Roman Bolshakov wrote:
>>> Unfortunately it has no effect (and I wouldn't want to do that to avoid
>>> issues with other scripts/software that implicitly depend on native
>>> utilities):
>>>
>>> $ brew link --force gnu-getopt
>>> Warning: Refusing to link macOS provided/shadowed software: gnu-getopt
>>> If you need to have gnu-getopt first in your PATH run:
>>>   echo 'export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"' >> ~/.zshrc
>>>
>>> So if it's possible I'd still prefer to add an option to specify
>>> --getopt in configure. I can resend a patch for that.
>>
>> No, I'm not going to accept that.  It's just Apple's stupidity.  I have
>> applied your patch, rewriting the harness in another language would
>> probably be a good idea though.
> 
> I also feel like we've outgrown Bash, especially when we implement
> things like migration tests.
Any chance that we could then use some pre-existing test runner instead
of re-inventing the wheel? E.g. I think Avocado already has some basic
support for running the kvm-unit-tests, IIRC.

 Thomas
diff mbox series

Patch

diff --git a/README.macOS.md b/README.macOS.md
index 4ca5a57..62b00be 100644
--- a/README.macOS.md
+++ b/README.macOS.md
@@ -22,10 +22,14 @@  $ brew install i686-elf-gcc
 $ brew install x86_64-elf-gcc
 ```
 
-32-bit x86 tests can be built like that:
+Make enhanced getopt available in the current shell session:
+```
+export PATH="/usr/local/opt/gnu-getopt/bin:$PATH"
+```
+
+Then, 32-bit x86 tests can be built like that:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=i386 \
   --cross-prefix=i686-elf-
 $ make -j $(nproc)
@@ -34,7 +38,6 @@  $ make -j $(nproc)
 64-bit x86 tests can be built likewise:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=x86_64 \
   --cross-prefix=x86_64-elf-
 $ make -j $(nproc)
@@ -71,7 +74,6 @@  $ ct-ng -C $X_BUILD_DIR build CT_PREFIX=$X_INSTALL_DIR
 Once compiled, the cross-compiler can be used to build the tests:
 ```
 $ ./configure \
-  --getopt=/usr/local/opt/gnu-getopt/bin/getopt \
   --arch=x86_64 \
   --cross-prefix=$X_INSTALL_DIR/x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu-
 $ make -j $(nproc)