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

Feature/34/support wasm #35

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

azriel91
Copy link
Contributor

@azriel91 azriel91 commented May 15, 2020

(this is based over #33)

Closes #34.

Attempt to support WASM. This builds and runs in a WASM application, but requires the following PRs:

@antifuchs
Copy link
Collaborator

Holy heck! That's amazing!!

Thanks so much for these contributions - I'm somewhat time-constrained this week, but I'll try to get them merged this weekend!

@azriel91
Copy link
Contributor Author

Sweet ✌️, both the PRs are merged, simply waiting on their release, so we can refer to the released versions in here 🚀

@antifuchs
Copy link
Collaborator

So, I love this! Two things that I'd like to see in this PR still:

  • some way to test this in CI, would hate to accidentally undo this work (if you're not sure how to do that, feel free to send me a snippet that I can try with - I have zero experience with wasm-targeted rust code, but have an idea how to integrate it in the ci system)

  • a Changelog entry crediting you! (:

@azriel91
Copy link
Contributor Author

Heya, quality checkboxes, my favourite ✌️. I'm halfway through writing CI tests, but it needs a change in wasm-pack (rustwasm/wasm-pack#851) so that wasm-pack doesn't try to compile native crates on the wasm32-unknown-unknown target.

@azriel91 azriel91 force-pushed the feature/34/support-wasm branch 3 times, most recently from ad66116 to 4cf4910 Compare May 18, 2020 07:57
@azriel91
Copy link
Contributor Author

azriel91 commented May 18, 2020

Heya, I got tests running through wasm-pack:

$ wasm-pack test --headless --firefox -- --no-default-features --features "std wasm-bindgen"
Running target/wasm32-unknown-unknown/debug/deps/direct-8375365da32962c5.wasm
Set timeout to 20 seconds...
Running headless tests in Firefox on `http://127.0.0.1:39841/`
Try find `webdriver.json` for configure browser's capabilities:
Not found
running 7 tests                                   

test direct::correct_wait_time ... ok
test direct::all_capacity_check_rejects_excess ... ok
test direct::rejects_too_many_all ... ok
test direct::never_allows_more_than_capacity_all ... ok
test direct::all_1_identical_to_1 ... ok
test direct::rejects_too_many ... ok
test direct::accepts_first_cell ... ok

test result: ok. 7 passed; 0 failed; 0 ignored
# .. more output

Something that happens in the sinks and streams tests is the elapsed time is not strictly greater than the boundary value, so the > assertion sometimes fails. I've set it to be >= in a6c15a5, but I think for true correctness it should be strictly greater than?

Also, the error message from the browser web driver only includes the panic message and no true line number, which is why I copied the assertion operation, so we get:

    error output:
-        panicked at 'elapsed: 200ms', tests/sinks.rs:1:1
+        panicked at 'expected i.elapsed() > Duration::from_millis(200), elapsed: 200ms', tests/sinks.rs:1:1

I haven't updated .circleci config yet, but may call it a day today.

@azriel91
Copy link
Contributor Author

I've updated circleci config, though I wouldn't know if it works until it's run. Also, there is a way to run tests without wasm-pack, which I've tried and works, so if the wasm-pack PR doesn't have any activity for a while then I may switch the implementation.

@azriel91
Copy link
Contributor Author

Heya, long break, but the two dependencies above are published. I've taken them in and rebased over master.
The one item still pending is CI, the PR to update wasm-pack is still pending -- I've just refreshed that as well, so hopefully it's accepted.

@antifuchs
Copy link
Collaborator

Oooh, that's super exciting - I'll check your changes out this weekend, hopefully we can get wasm support shipped soon!

@antifuchs
Copy link
Collaborator

bors try

bors bot added a commit that referenced this pull request Sep 26, 2020
@bors
Copy link
Contributor

bors bot commented Sep 26, 2020

try

Build failed:

@antifuchs
Copy link
Collaborator

It looks like the wasm tests you added are failing because it doesn't have jq available... this is weird.

Since the circleci config is auto-generated by cargo template-ci (and so will get overwritten unless we perform trickery), maybe it's easier to install a github action to run the tests in a wasm environment? Maybe https://github.com/marketplace/actions/wasm-pack-action could work there?

@azriel91
Copy link
Contributor Author

Gotcha, shall try that in the next two days ✌️

@azriel91
Copy link
Contributor Author

azriel91 commented Oct 3, 2020

Heya, been spending time on getting wasm-pack to pass through features correctly, need to get that working for the download action to pick it up. Shall come back to this when that one is resolved.

@azriel91 azriel91 force-pushed the feature/34/support-wasm branch 2 times, most recently from 6472e22 to 241e544 Compare June 29, 2021 03:54
@codecov
Copy link

codecov bot commented Jun 29, 2021

Codecov Report

Merging #35 (d4984e5) into master (dbc4ce5) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #35      +/-   ##
==========================================
+ Coverage   99.35%   99.36%   +0.01%     
==========================================
  Files          30       31       +1     
  Lines        2011     2043      +32     
==========================================
+ Hits         1998     2030      +32     
  Misses         13       13              
Impacted Files Coverage Δ
src/clock/with_std.rs 100.00% <ø> (ø)
src/gcra.rs 100.00% <ø> (ø)
src/jitter.rs 100.00% <ø> (ø)
src/lib.rs 100.00% <ø> (ø)
tests/direct.rs 100.00% <ø> (ø)
tests/keyed_hashmap.rs 100.00% <ø> (ø)
tests/future.rs 100.00% <100.00%> (ø)
tests/keyed_dashmap.rs 100.00% <100.00%> (ø)
tests/macros.rs 100.00% <100.00%> (ø)
tests/memory_leaks.rs 100.00% <100.00%> (ø)
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbc4ce5...d4984e5. Read the comment docs.

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.

Support WASM
2 participants