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

run tests on wasm32-unknown-unknown #80

Merged
merged 8 commits into from
Aug 20, 2018
Merged

Conversation

gnzlbg
Copy link
Contributor

@gnzlbg gnzlbg commented Aug 11, 2018

Closes #79

@gnzlbg gnzlbg force-pushed the wasm_runner branch 5 times, most recently from 1861d87 to fe45e0f Compare August 16, 2018 15:57
@gnzlbg
Copy link
Contributor Author

gnzlbg commented Aug 16, 2018

@alexcrichton this runs the full testsuite on wasm32-unknown-unknown except for the #[should_panic] tests which I have currently disabled.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Aug 16, 2018

Having to use the #[wasm_bindgen_macro], pub mod, pub fn, etc. for tests, disable #[should_panic], are the only "issues" i've encountered.

I think we could have a tiny compiler feature(plugin) that replaces #[test] with the appropriate stuff, and that it would be enough to include that for the wasm target in the top-level Cargo.toml.

That would make testing Rust crates for wasm a two-liner change on nightly, instead of something that one has to take care of for every test.

Obviously, the long term solution would be to use a custom test framework.

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Aug 16, 2018

@alexcrichton

https://travis-ci.org/rust-lang-nursery/packed_simd/jobs/416883709#L1479

{ Error: Cannot find module 'env'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/checkout/target/wasm32-unknown-unknown/wbg-tmp/wasm-bindgen-test_bg.js:6:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3) code: 'MODULE_NOT_FOUND' }

This happens in debug builds. I am trying to run the tests in release mode to see if the issue persists.

#[test]
fn write_to_slice_unaligned() {
#[cfg_attr(not(target_arch = "wasm32"), test)] #[cfg_attr(target_arch = "wasm32", wasm_bindgen_test)]
pub fn write_to_slice_unaligned() {
Copy link
Member

Choose a reason for hiding this comment

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

While the modules need to be publich (a known bug) you shouldn't need to use pub on the methods themselves

@alexcrichton
Copy link
Member

Hm that basically means that there was an unresolved symbol, do you know if the test expect a symbol from libc or a C library or something like that?

@gnzlbg gnzlbg force-pushed the wasm_runner branch 2 times, most recently from 4a08295 to cc74e3b Compare August 16, 2018 21:27
@gnzlbg gnzlbg force-pushed the wasm_runner branch 2 times, most recently from 02dbb87 to 41e937e Compare August 20, 2018 19:33
@gnzlbg gnzlbg merged commit 8d99100 into rust-lang:master Aug 20, 2018
@gnzlbg
Copy link
Contributor Author

gnzlbg commented Aug 20, 2018

Hm that basically means that there was an unresolved symbol, do you know if the test expect a symbol from libc or a C library or something like that?

It fails only in debug mode; in release everything works as expected.

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