public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <leif.lindholm@linaro.org>
To: devel@edk2.groups.io, "Fan, ZhijuX" <zhijux.fan@intel.com>
Cc: "Gao, Liming" <liming.gao@intel.com>, bob.c.feng@intel.com
Subject: Re: [edk2-devel] [PATCH] BaseTools:The code used to test python module is moved to edksetup
Date: Wed, 8 May 2019 12:38:24 +0100	[thread overview]
Message-ID: <20190508113824.ixax7b3nl6meypty@bivouac.eciton.net> (raw)
In-Reply-To: <08650203BA1BD64D8AD9B6D5D74A85D16010465E@SHSMSX101.ccr.corp.intel.com>

Hi guys,

This patch (now committed) break our ci (which runs with 'set -e').
This seems to be caused by TestUtilModule() returning error (1 -
non-zero) when it actually finds the module, and success (0) when it
does not.

While debugging, I found another side effect that I have not had time
to track down, and does not go away with resolving this incorrect
behaviour. When I run from the command line:
 $ set -e
 $ . edks<tab>
to tab-complete the filename in bash, this terminates the current
shell.

Unless someone can find a solution to the latter quickly, can we
revert this patch please?

One further comment below.

On Tue, May 07, 2019 at 03:53:18AM +0000, Bob Feng wrote:
> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
> 
> -----Original Message-----
> From: Fan, ZhijuX 
> Sent: Tuesday, April 30, 2019 10:16 AM
> To: devel@edk2.groups.io
> Cc: Gao, Liming <liming.gao@intel.com>; Feng, Bob C <bob.c.feng@intel.com>
> Subject: [PATCH] BaseTools:The code used to test python module is moved to edksetup
> 
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1582
> 
> testing for presence of python modules should be done in edksetup to reduce impact on subsequent build times.
> This code currently exists in BaseTools/Tests/RunTest.py.
> 
> This patch is going to fix this issue.
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
> ---
>  BaseTools/Tests/RunTests.py |  8 --------
>  edksetup.sh                 | 15 +++++++++++++--
>  2 files changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/BaseTools/Tests/RunTests.py b/BaseTools/Tests/RunTests.py index 81af736cd8..e8acf1b348 100644
> --- a/BaseTools/Tests/RunTests.py
> +++ b/BaseTools/Tests/RunTests.py
> @@ -12,14 +12,6 @@
>  import os
>  import sys
>  import unittest
> -
> -try:
> -    import distutils.util
> -except ModuleNotFoundError:
> -    sys.exit('''
> -Python reported: "No module named 'distutils.util"
> -''')
> -
>  import TestTools
>  
>  def GetCTestSuite():
> diff --git a/edksetup.sh b/edksetup.sh
> index c7b2e1e201..add18ca7c0 100755
> --- a/edksetup.sh
> +++ b/edksetup.sh
> @@ -177,11 +177,22 @@ function SetupPython()
>    SetupPython3
>  }
>  
> +function TestUtilModule()
> +{
> +  if ( $PYTHON_COMMAND -c "import distutils.util" >/dev/null 2>&1 );then
> +    return 1
> +  else
> +    echo Error: "No module named 'distutils.util"
> +    return 0
> +  fi
> +}
> +
>  function SourceEnv()
>  {
>    SetWorkspace &&
> -  SetupEnv
> -  SetupPython
> +  SetupEnv &&

Not adding this && in 9c2d68c0a299 ("BaseTools: Update windows and
linux run scripts file to use Python3") when SetupPython was added was
clearly an oversight, but that is not something to quietly fix up in
this completely unrelated patch.

When resending a new version, after revert, please do that as a
separate patch.

Best Regards,

Leif

> +  SetupPython &&
> +  TestUtilModule
>  }
>  
>  I=$#
> --
> 2.14.1.windows.1
> 
> 
> 
> 

  reply	other threads:[~2019-05-08 11:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-30  2:16 [PATCH] BaseTools:The code used to test python module is moved to edksetup Fan, ZhijuX
2019-05-07  3:53 ` Bob Feng
2019-05-08 11:38   ` Leif Lindholm [this message]
2019-05-08 11:45     ` [edk2-devel] " Leif Lindholm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190508113824.ixax7b3nl6meypty@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox