Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[sonic-yang-models]: fix unit test failure #7436

Merged
merged 1 commit into from
May 6, 2021
Merged

Conversation

lguohan
Copy link
Collaborator

@lguohan lguohan commented Apr 26, 2021

Signed-off-by: Guohan Lu [email protected]

Why I did it

[sonic-yang-models]: fix unit test failure

it is not quite understood why the unit test suddenly failed as below.
but add ietf yang model explicitly to the build process fix the test
failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

How I did it

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@lguohan lguohan marked this pull request as ready for review April 26, 2021 22:23
@lguohan lguohan changed the title [pyang]: debug build failure [sonic-yang-models]: fix unit test failure Apr 26, 2021
praveen-li
praveen-li previously approved these changes Apr 26, 2021
Copy link
Collaborator

@praveen-li praveen-li left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thx for fixing this.

@lguohan
Copy link
Collaborator Author

lguohan commented Apr 27, 2021

seems upgrading to 2.4.0 also resolve the issue. let's use that one. I'll hold on this one.

@praveen-li
Copy link
Collaborator

seems upgrading to 2.4.0 also resolve the issue. let's use that one. I'll hold on this one.

Cool, but this is highly recommend to put the search path in pyang command, so I guess we should add -p as well and list the contents of directory in case of failure, it will be easier to debug that way in future.

it is not quite understood why the unit test suddenly failed as below.
but add ietf yang model explicitly to the build process fix the test
failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

Signed-off-by: Guohan Lu <[email protected]>
@dflynn-Nokia
Copy link
Contributor

Upgrading to pyang 2.4.0 did not seem to fix this unit test failure when building for the marvell-armhf platform. As a test I cherry-picked this change from Gouhan's fork and I no longer see the failure. I agree that we should move forward with this PR.

@praveen-li
Copy link
Collaborator

Upgrading to pyang 2.4.0 did not seem to fix this unit test failure when building for the marvell-armhf platform. As a test I cherry-picked this change from Gouhan's fork and I no longer see the failure. I agree that we should move forward with this PR.

Agree.

@joyas-joseph
Copy link
Contributor

The breakage is coming from pip version 21.1.

https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1

@dflynn-Nokia
Copy link
Contributor

@joyas-joseph I presume you are saying that this problem is related to PR #7450 which is in Draft state.
Have we confirmed that PR #7450 fixes this?

@joyas-joseph
Copy link
Contributor

@joyas-joseph I presume you are saying that this problem is related to PR #7450 which is in Draft state.
Have we confirmed that PR #7450 fixes this?

With pip21.1, we see the below exception. The code is from pyang2.4.0 - https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93

jjoseph@7dea14fc47be:/sonic/src/sonic-yang-models$ pip3 list | grep pip
pip                 21.1
jjoseph@7dea14fc47be:/sonic/src/sonic-yang-models$

jjoseph@7dea14fc47be:/sonic/src/sonic-yang-models$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> import pip._internal.locations as locations
>>> location = locations.distutils_scheme('pyang')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'pip._internal.locations' has no attribute 'distutils_scheme'
>>> 

The same code works with pip 21.0.1.

jjoseph@7dea14fc47be:/sonic/src/sonic-yang-models$ pip3 list | grep pip
pip                 21.0.1

jjoseph@7dea14fc47be:/sonic/src/sonic-yang-models$ python3
Python 3.7.3 (default, Jan 22 2021, 20:04:44)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pip
>>> import pip._internal.locations as locations
>>> location = locations.distutils_scheme('pyang')
>>> print(location)
{'purelib': '/usr/local/lib/python3.7/dist-packages', 'platlib': '/usr/local/lib/python3.7/dist-packages', 'headers': '/usr/local/include/python3.7/pyang', 'scripts': '/usr/local/bin', 'data': '/usr/local'}
>>> print(location['data'])
/usr/local
>>>

@dflynn-Nokia
Copy link
Contributor

FWIW I have observed that a fresh build of the marvell-armhf platform on the 202012 branch succeeds.
Specifically all sonic_yang_models-1.0-py3-none-any.whl unit tests pass.
However if I perform the following sequence, I still see the sonic_yang_models-1.0-py3-none-any.whl unit test failure.

make target/python-wheels/sonic_yang_models-1.0-py3-none-any.whl-clean
make target/python-wheels/sonic_yang_models-1.0-py3-none-any.whl

When I cherry-pick this commit from lguohan:pyang I no longer see the unit test failure.

@lguohan lguohan merged commit 7124dbe into sonic-net:master May 6, 2021
@lguohan lguohan deleted the pyang branch May 6, 2021 17:57
@joyas-joseph
Copy link
Contributor

Would have preferred #7450 over this.

daall pushed a commit that referenced this pull request May 10, 2021
https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1

add ietf yang model explicitly to the build process fix the test failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

Signed-off-by: Guohan Lu <[email protected]>
raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-buildimage that referenced this pull request May 23, 2021
https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1

add ietf yang model explicitly to the build process fix the test failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

Signed-off-by: Guohan Lu <[email protected]>
praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Jun 1, 2021
https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1

add ietf yang model explicitly to the build process fix the test failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

Signed-off-by: Guohan Lu <[email protected]>
carl-nokia pushed a commit to carl-nokia/sonic-buildimage that referenced this pull request Aug 7, 2021
https://github.com/mbj4668/pyang/blob/master/pyang/repository.py#L93 throws an exception with pip 21.1

add ietf yang model explicitly to the build process fix the test failure.

tests/test_sonic_yang_models.py .F [ 66%]
tests/yang_model_tests/test_yang_model.py . [100%]
Failed: pyang -f tree ./yang-models/*.yang > ./yang-models/sonic_yang_tree
----------------------------- Captured stderr call -----------------------------
./yang-models/sonic-acl.yang:8: error: module "ietf-inet-types" not found in search path
./yang-models/sonic-device_metadata.yang:8: error: module "ietf-yang-types" not found in search path

Signed-off-by: Guohan Lu <[email protected]>
praveen-li pushed a commit to praveen-li/sonic-buildimage that referenced this pull request Feb 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants