Re: [kvm-unit-tests PATCH v2 06/10] configure: Add an option to specify getopt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 22, 2020 at 03:53:27PM +0200, Paolo Bonzini wrote:
> On 01/09/20 10:50, Roman Bolshakov wrote:
> > macOS is shipped with an old non-enhanced version of getopt and it
> > doesn't support options used by run_tests.sh. Proper version of getopt
> > is available from homebrew but it has to be added to PATH before invoking
> > run_tests.sh. It's not convenient because it has to be done in each
> > shell instance and there could be many if a multiplexor is used.
> > 
> > The change provides a way to override getopt and halts ./configure if
> > enhanced getopt can't be found.
> > 
> > Cc: Cameron Esfahani <dirty@xxxxxxxxx>
> > Signed-off-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx>
> 
> I don't like the extra option very much, generally people are just expected
> to stick homebrew in their path somehow.  Reporting a better error is a
> good idea though, what about this:
> 

Homebrew doesn't shadow system tools unlike macports. That's why the
patch is helpful and the error below can be corrected automatically
without human intervention. The error in the proposed below patch would
still cause frustrating:

  "ugh. I again forgot to set PATH for this tmux window..."

May be I'm exaggarating the issue, but I don't set PATH on a per-project
basis unless I'm doing something extremely rare or something weird :)

The original patch also shouldn't have an impact on most modern Linux
systems. It would help only a few who build kvm-unit-tests on mac.
Hopefully, it eases contribution and testing of QEMU without an access
to Linux box.

Thanks,
Roman

> diff --git a/configure b/configure
> index 4eb504f..3293634 100755
> --- a/configure
> +++ b/configure
> @@ -167,6 +167,13 @@ EOF
>    rm -f lib-test.{o,S}
>  fi
>  
> +# require enhanced getopt
> +getopt -T > /dev/null
> +if [ $? -ne 4 ]; then
> +    echo "Enhanced getopt is not available, add it to your PATH?"
> +    exit 1
> +fi
> +
>  # Are we in a separate build tree? If so, link the Makefile
>  # and shared stuff so that 'make' and run_tests.sh work.
>  if test ! -e Makefile; then
> diff --git a/run_tests.sh b/run_tests.sh
> index 01e36dc..70d012c 100755
> --- a/run_tests.sh
> +++ b/run_tests.sh
> @@ -34,6 +34,13 @@ EOF
>  RUNTIME_arch_run="./$TEST_DIR/run"
>  source scripts/runtime.bash
>  
> +# require enhanced getopt
> +getopt -T > /dev/null
> +if [ $? -ne 4 ]; then
> +    echo "Enhanced getopt is not available, add it to your PATH?"
> +    exit 1
> +fi
> +
>  only_tests=""
>  args=`getopt -u -o ag:htj:v -l all,group:,help,tap13,parallel:,verbose -- $*`
>  [ $? -ne 0 ] && exit 2;
> 
> Paolo
> 



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux