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

Re: [PATCH v2] xen/misra: xen-analysis.py: fix return error on PhaseExceptions


  • To: Luca Fancellu <luca.fancellu@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Thu, 27 Apr 2023 21:07:06 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9AVOa7NBV5cC/pxdxzos/UkaHUaqLqsFBVe53H07fLg=; b=JdRZcMEazuIBlQr65mygBro5JY87/Q1yv+1J8M7LT84sLplnWpMowR4Gx/jGHHz1S/QFHkjhHFuGkxHvT8pea8BQrKD15MTaMSS3Yo/MztcFIcBldpU0ix3hFlQ1ftPizDbXcH57IBp7XuMR7nlHkVGpqjMGdVCj7n1CMNM2HgFLTRaDAuQNXeJbbAkGZnTtABHbqGyRHRYNFyOyDSQWSRd4y/2KlfBas+RAPqNgSpxRXJftBrjxxsx73qhrWhCw+5eOL0ipoZZxqhDLLxwVC2jmXHM3LGNnhWfzX3AutqCECtauB1fPwVV4YqGQhji9YLjbFpLhe/LWdQJ6ZItlpw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WKZltyeyLy1HTwThCCjicI5ya+QDVhFkZ5K03voTjdZQesDYGV+9JP5vX+4pj7LkgmNokj9jia8QN2qyq4nAjlMJGKm3FvQevbWoYdjJ9DXrjUpHeovwGD3RcWkjmEYruzpRq3E763VLIlBkZgdRHYv3ehFitu0dYaSO4mywz90q+8iiBme6YKFywAxJLzf0j3zWJPO7SrZmh4nIJVf7rPvpPGxAOIq1JsdfK9vuNJ+Vc/2kgt13SGdQtQ2/umjGWTAumER4iMHqgiIaVj2gq7/YMCtHwUc/2g4dzzvflyUTKGGAMJelgEOsLx+jJ7yon3g7O5/sEnX+LLUvuvcycg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: bertrand.marquis@xxxxxxx, wei.chen@xxxxxxx
  • Delivery-date: Thu, 27 Apr 2023 20:07:38 +0000
  • Ironport-data: A9a23:rVa2l6kkFjD4/Sifm8Whlg/o5gxIJ0RdPkR7XQ2eYbSJt1+Wr1Gzt xJLX2nXO6mJZmrze9wiO96zpx5VuJGGnd9nTFFo+Xs8RCMWpZLJC+rCIxarNUt+DCFhoGFPt JxCN4aafKjYaleG+39B55C49SEUOZmgH+a6U6icfHgqH2eIcQ954Tp7gek1n4V0ttawBgKJq LvartbWfVSowFaYCEpNg064gE4p7aWaVA8w5ARkPqgX5gCGzBH5MbpETU2PByqgKmVrNrbSq 9brlNmR4m7f9hExPdKp+p6TnpoiG+O60aCm0xK6aoD66vRwjnVaPpUTbZLwXXx/mTSR9+2d/ f0W3XCGpaXFCYWX8AgVe0Ew/yiTpsSq8pefSZS0mZT7I0Er7xIAahihZa07FdRwxwp5PY1B3 awJCm4Dch6vvtL13rKxTNlcu9QScta+aevzulk4pd3YJdAPZMifBoD1v5pf1jp2gd1SF/HDY cZfcSBocBnLfxxIPBEQFY46m+CrwHL4dlW0qnrM/fZxvzeVk1c3iee3WDbWUoXiqcF9t0CUv G/ZuU/+BQkXLoe3wjuZ6HO8wOTImEsXXapLTOLlra8z2Qb7Kmo7FT0oDEaf/sGCkGGgdshAM HQTqjs1sv1nnKCsZpynN/Gim1aAoxUVHdRZFeY37AWQ4qPO5kCSAW1sZi5MbpkqudE7QRQu1 0SVhJX5CDp3qrqXRHmBsLCOoluaMyUPMXULYyNCSAIf+sTiu6k6lBeJRdFmeIaqg9yzEjH9x RiDti14jLIW5fPnzI2+9FHDxjez/J7AS1Zp4h2NBz3/qARkeISieoqkr0DB6upNJ5qYSV/Hu 2UYn8+Z76YFCpTleDGxfdjh1YqBv56tWAAwS3Y2d3X931xBI0KeQL0=
  • Ironport-hdrordr: A9a23:LO/qEqhL1PgzNToDV7fD7hTGbnBQX7x23DAbv31ZSRFFG/FwyP rCoB1L73XJYWgqM03I+eruBEBPewK7yXcH2/h0AV7EZniahILIFvAZ0WKG+VHd8kLFh41gPM tbAtBD4ZjLfCNHZKXBkXeF+rQboOVvmZrA7Ym+854ud3ASV0gJ1XYHNu/xKDwSeOApP+tfKH PR3Lskm9L2Ek5nEvhTS0N1FtTrlpnurtbLcBQGDxko5E2nii6p0qfzF1y1zwoTSDRGxJYl6C zgnxbi7quunvmnwluEvlWjoqh+qZ/E8J9uFcaMgs8aJnHFjRupXp1oX/mvrS04u+am7XctiZ 3prw07N8p+xnvNdiWeoAfr2SPnzDEygkWSg2OwsD/Gm4jUVTg6A81OicZwdQbY0VMpuJVZ3L hQ12yUmpJLBVeY9R6NrOTgZlVPrA6ZsHAimekcgzh2VpYfUqZYqcg68FlOGJkNMSrm4MQMEf VoDuvb+PFKGGnqJ0zxjy1K+piBT34zFhCJTgwrvdGU6SFfmDRDw04R1KUk7wM93aN4b6MBy/ XPM6xumr0LZNQRd7hBCOAIRtbyInDRQDrXWVjiYGjPJeUiATbgupT36LI66KWBY5oT1qY/n5 zHTRdxqXMyQUTzEseDtac7vCwleF/NHggF9/supaSQ4tbHNf/W2Gy4OR8TevKb0rUi6paxYY f2BHpUa8WTWFcGV7w5mDEWYKMiWkX2YPdly+rTZGj+0v4jCreawdAzI8yjUobFIHIDZl7VJE clcXzaGPhgh3rbKEMQxiKhF0/QRg==
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 27/04/2023 2:25 pm, Luca Fancellu wrote:
> Currently the script return code is 0 even if an exception is
> found, because the return code is written only if the exception
> object has the errorcode member.
>
> Fix the issue returning the errorcode member in case it exists,
> otherwise use a generic value different from 0.
>
> Fixes: 02b26c02c7c4 ("xen/scripts: add cppcheck tool to the xen-analysis.py 
> script")
> Signed-off-by: Luca Fancellu <luca.fancellu@xxxxxxx>

Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

> Change-Id: I1b76b8fa4668bef49da3282339fca3052e3379cd

although this doesn't look like it should be here.  I've stripped it

~Andrew

> ---
> Changes from v1:
>  - use getattr() (Andrew)
> ---
>  xen/scripts/xen-analysis.py | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/xen/scripts/xen-analysis.py b/xen/scripts/xen-analysis.py
> index 8e50c27cd898..5e8f2910cd72 100755
> --- a/xen/scripts/xen-analysis.py
> +++ b/xen/scripts/xen-analysis.py
> @@ -26,8 +26,7 @@ def main(argv):
>              cppcheck_analysis.generate_cppcheck_report()
>      except PhaseExceptions as e:
>          print("ERROR: {}".format(e))
> -        if hasattr(e, "errorcode"):
> -            ret_code = e.errorcode
> +        ret_code = getattr(e, "errorcode", 1)
>      finally:
>          if settings.step_clean_analysis:
>              cppcheck_analysis.clean_analysis_artifacts()




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.