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

external files in test support on iOS #429

Closed
wants to merge 1 commit into from
Closed

Conversation

kali
Copy link
Contributor

@kali kali commented Jan 26, 2017

I agree to license my contributions to each file under the terms given
at the top of each file I changed.

I agree to license my contributions to each file under the terms given
at the top of each file I changed.
@kali kali mentioned this pull request Jan 26, 2017
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.185% when pulling 692b2bb on kali:master into 200edfc on briansmith:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.3%) to 93.185% when pulling 692b2bb on kali:master into 200edfc on briansmith:master.

@@ -38,6 +38,7 @@ macro_rules! bssl_test {
}

init::init_once();
::std::env::set_current_dir(::test::ring_src_path()).unwrap();
Copy link
Owner

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?

ring/mk/travis.sh

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?

Copy link
Contributor Author

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.

@briansmith
Copy link
Owner

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.

@briansmith
Copy link
Owner

Thanks. This landed as in master in e4443e8. I changed the commit message to "Fix file-based tests on iOS."

@briansmith briansmith closed this Jan 28, 2017
@briansmith briansmith added this to the 0.6.4 milestone Jan 28, 2017
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.

3 participants