Skip to content

Fix CI tests - #481

Merged
WasabiFan merged 2 commits into
stretchfrom
fix-ci-tests
Jul 13, 2018
Merged

WasabiFan merged 2 commits into
stretchfrom
fix-ci-tests

Conversation

@WasabiFan

Copy link
Copy Markdown
Member

First commit adds a failing test (we didn't write to properties before); second commit fixes it 💪😎. I don't entirely understand why the files had different permissions on the CI server from what I see when I clone in Ubuntu locally, but whatever the issue is, checking for user permissions seems to work. I'll validate this on an EV3 soon to confirm I didn't cause any regressions.

Comment thread ev3dev2/__init__.py Outdated
r_ok = mode & stat.S_IRGRP
w_ok = mode & stat.S_IWGRP
r_ok = mode & stat.S_IRUSR
w_ok = mode & stat.S_IWUSR

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I am not sure now, but I think group permission are checked for a reason. Attributes are root-owned, and to read some of them, we add users to a specific groups. See f49158b and #84

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we alter group permissions on the CI server before running the tests?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Hmph, I was wondering about that. We probably can add such logic to the fake-sys script as long as we know what to add... I assume it's a chmod call with these flags added but I don't fully understand the Unix permissions model so I'd have to test it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

May be something like chown -R $USER:$USER to change group to the current user and/or chmod -R g+rw to allow group member to read/write?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We use copy the devices from devices, and python's shutil.copytree should copy permissions, so may be adding chmod/chown calls to the travis script would be enough:

https://github.com/ev3dev/ev3dev-lang-python/blob/jessie/.travis.yml#L8

@WasabiFan

Copy link
Copy Markdown
Member Author

I can't reproduce this error locally, despite using the official docker image and replicating the build commands used in the real environment. Nonetheless, there certainly is a difference.

Locally:

$ stat tests/fake-sys/arena/tacho-motor/motor0/speed_sp
  File: ‘tests/fake-sys/arena/tacho-motor/motor0/speed_sp’
  Size: 2               Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d      Inode: 2766152     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 2000/  travis)   Gid: ( 2000/  travis)
Access: 2018-07-12 05:43:02.784530600 +0000
Modify: 2018-07-12 05:42:46.762545800 +0000
Change: 2018-07-12 05:46:25.805545600 +0000
 Birth: -

On their agent:

$ stat ./tests/fake-sys/arena/tacho-motor/motor0/speed_sp
  File: './tests/fake-sys/arena/tacho-motor/motor0/speed_sp'
  Size: 2         	Blocks: 8          IO Block: 4096   regular file
Device: fd07h/64775d	Inode: 21730405    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 2000/  travis)   Gid: ( 2000/  travis)
Access: 2018-07-12 05:53:49.629314075 +0000
Modify: 2018-07-12 05:53:44.725738838 +0000
Change: 2018-07-12 05:53:49.749303731 +0000
 Birth: -

Note the bit of interest -- group write -- isn't set in the real env. Going to test out some things now.

Build in question: https://travis-ci.org/ev3dev/ev3dev-lang-python/builds/402969142

@WasabiFan

Copy link
Copy Markdown
Member Author

Local:

$ stat tests/fake-sys/devices/medium_motor/speed_sp
  File: ‘tests/fake-sys/devices/medium_motor/speed_sp’
  Size: 2               Blocks: 8          IO Block: 4096   regular file
Device: 801h/2049d      Inode: 2766092     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 2000/  travis)   Gid: ( 2000/  travis)
Access: 2018-07-12 05:43:02.764530600 +0000
Modify: 2018-07-12 05:42:46.762545800 +0000
Change: 2018-07-12 05:42:46.762545800 +0000
 Birth: -

Remote:

$ stat tests/fake-sys/devices/medium_motor/speed_sp
  File: 'tests/fake-sys/devices/medium_motor/speed_sp'
  Size: 2         	Blocks: 8          IO Block: 4096   regular file
Device: fd09h/64777d	Inode: 34657809    Links: 1
Access: (0644/-rw-r--r--)  Uid: ( 2000/  travis)   Gid: ( 2000/  travis)
Access: 2018-07-12 06:01:22.772310467 +0000
Modify: 2018-07-12 06:01:17.936466389 +0000
Change: 2018-07-12 06:01:17.936466389 +0000
 Birth: -

I'm inclined to believe that setting that bit in the source directory both will work and is the correct approach. Will test.

@WasabiFan

WasabiFan commented Jul 12, 2018 •

Copy link
Copy Markdown
Member Author

The command "chmod -R g+rw ./tests/fake-sys/devices/**/*" exited with 0.
The command "./tests/api_tests.py" exited with 0.

🎉 I'll update the PR tomorrow (my time; I need some sleep).

script:
- chmod -R g+rw ./tests/fake-sys/devices/**/*
- ./tests/api_tests.py

@WasabiFan

Copy link
Copy Markdown
Member Author

Updated with the new fix

@WasabiFan
WasabiFan merged commit 862c4fe into stretch Jul 13, 2018
@WasabiFan
WasabiFan deleted the fix-ci-tests branch July 18, 2018 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants