-
Notifications
You must be signed in to change notification settings - Fork 704
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
external files in test support on iOS #429
Conversation
I agree to license my contributions to each file under the terms given at the top of each file I changed.
1 similar comment
@@ -38,6 +38,7 @@ macro_rules! bssl_test { | |||
} | |||
|
|||
init::init_once(); | |||
::std::env::set_current_dir(::test::ring_src_path()).unwrap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not quite sure why this is needed on iOS but not Android. Here's how we do it on Android; can we do the same thing on iOS?
Lines 82 to 90 in c84e411
adb wait-for-device | |
adb push $target_dir/ring-* /data/ring-test | |
for testfile in `find src crypto -name "*_test*.txt"`; do | |
adb shell mkdir -p /data/`dirname $testfile` | |
adb push $testfile /data/$testfile | |
done | |
adb shell mkdir -p /data/third-party/NIST | |
adb push third-party/NIST/SHAVS /data/third-party/NIST/SHAVS | |
adb shell 'cd /data && ./ring-test' 2>&1 | tee /tmp/ring-test |
Also, why is it important to switch the current directory, instead of just changing file accesses to use the full path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On a non-jailbroken iOS, the only (known) way to start a process is to make it an app, and lauching it as an app. It will only be started with the working directory set to /
, I could not find a way around that.
So we have two ways to solve this: using absolute paths (as I did for the pure Rust tests) or cd-ing to the right place just before running tests and keep relative paths. On principle, the first approach feels better as you're not altering what is basically a process-wide global variable. I used the cd strategy for the bn tests because I felt the required changes would be too invasive (as we need to pass the path through the rust-to-c test machinery), but if you feel otherwise, I can give it a shot.
OK, I understand now. The strategy you chose makes sense. Note that we're goign to get rid of bn_test.cc soon so eventually this won't be a problem. We don't need a perfect solution for the interim state, just one that works. |
Thanks. This landed as in master in e4443e8. I changed the commit message to "Fix file-based tests on iOS." |
I agree to license my contributions to each file under the terms given
at the top of each file I changed.