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

Share resource files between tests #161

Closed
ZhaoXiangXML opened this issue Jul 16, 2022 · 7 comments
Closed

Share resource files between tests #161

ZhaoXiangXML opened this issue Jul 16, 2022 · 7 comments

Comments

@ZhaoXiangXML
Copy link

I've a project with many asset files and many integration tests.

When running on Android, one copy of all asset files is pushed to the phone for each integration test, which is slow and drains disk space very fast.

Is it possible to share a single copy of resource file for all integration tests and unit tests?

@fredszaq
Copy link
Collaborator

here is a partial fix #163

it will still recopy the resources each time but at least it will be at the same place and won't eat disk space

we could probably speed up things for the copy on the android device by checking if https://github.com/google/adb-sync or https://github.com/SelfAdjointOperator/better-adb-sync is is the path and use it for the copy if it is the case

@ZhaoXiangXML
Copy link
Author

Is it possible to just copy resources once before the first test?

@fredszaq
Copy link
Collaborator

Dinghy registers itself as a runner inside cargo, and cargo creates a new dinghy process when it needs to run something on the device, passing some info about the executable to run and the package it comes from that is not available inside the dinghy main program. We don't really have the knowledge of previous invocations dinghy as the runner inside the runner.

So short answer is is not that easy and would probably be quite error prone if we did.

For ssh devices we already leverage rsync for the sync of the resources it would sort of make sense too use the same sort of mecanism for android (hence adb-sync)

@ZhaoXiangXML
Copy link
Author

Is it ok to split the process into two commands, one for copy all resources and one for copy binaries and run tests?

Something like:

cargo dinghy prepare
cargo dinghy test

@fredszaq
Copy link
Collaborator

fredszaq commented Jul 20, 2022

Ok so I looked a bit more into it, and in fact adb has a --sync option when using adb push that we are using. We however had a bug in the preparation of the bundle where test_data consisting of a single file didn't have metadata copied from the original file that prevented adb from seeing it as the same file. I fixed it in #163 could you test that it fixes things for you ?

use

$ git clone https://github.com/sonos/dinghy.git
$ git checkout use-package-name-instead-of-runnable-id-for-dinghy-dir
$ cargo install --path cargo-dinghy

to install the updated dinghy

@ZhaoXiangXML
Copy link
Author

ZhaoXiangXML commented Jul 20, 2022

@fredszaq I tried the new version for Android and indeed it's faster.

The version from cargo install took 3.8 minutes for my tests and the branch version took 2.5.

Guess my bottleneck is the size of executables now.

I have no success with dinghy on iOS so far so I can't try it for iOS now.

Looking forward for it to be published.

Thanks.

@fredszaq
Copy link
Collaborator

great news ! you can use the --strip dinghy argument to strip the executables before sending them to the device is you don't need debug symbols. I'm closing this, I have a few more things I want to add to the release that I'm working on this week but we'll probably cut one either end of this week or beginning of the next.

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

No branches or pull requests

2 participants