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

Build XCTest for the wasm32-unknown-wasi triple #597

Closed
MaxDesiatov opened this issue Apr 7, 2020 · 5 comments · Fixed by #1175
Closed

Build XCTest for the wasm32-unknown-wasi triple #597

MaxDesiatov opened this issue Apr 7, 2020 · 5 comments · Fixed by #1175
Labels
bug Something isn't working

Comments

@MaxDesiatov
Copy link

MaxDesiatov commented Apr 7, 2020

Currently the XCTest module is not bult as a part of CI run, so swift test --triple wasm32-unknown-wasi fails with this error:

LifeGameTests.swift:1:8: error: could not find module 'XCTest' for target 'wasm32-unknown-wasi'; found: x86_64-apple-ios-macabi, x86_64, x86_64-apple-macos
import XCTest
       ^
LifeGameTests.swift:1:8: error: could not find module 'XCTest' for target 'wasm32-unknown-wasi'; found: x86_64-apple-ios-macabi, x86_64, x86_64-apple-macos
import XCTest
       ^

I understand that just building it for the triple probably won't fix swift test and it needs to learn how to call Wasmer for a test run, but buliding XCTest for the triple is probably a good first step.

@MaxDesiatov MaxDesiatov added the bug Something isn't working label Apr 7, 2020
@MaxDesiatov
Copy link
Author

Most likely this is blocked by #592 as XCTest has a dependency on Foundation.

@MaxDesiatov
Copy link
Author

MaxDesiatov commented Apr 19, 2020

Quick update, I currently have a version of XCTest building for the WASI triple, it did require turning off a lot of things that aren't available in either WASI or WASIFoundation yet, namely anything related to Bundle, asynchronous testing with expectations, parallel test runs etc. But at least it builds 🙂 I can't run any tests on macOS yet, I know test runs on macOS work differently because they don't use LinuxMain, which have to be used when testing with the WASI triple. I tried to run some tests on Linux, but that's blocked by #713.

@MaxDesiatov MaxDesiatov removed the in progress The issue is currently being worked on label Apr 22, 2020
@MaxDesiatov
Copy link
Author

MaxDesiatov commented Apr 24, 2020

It now works with my custom build on macOS 🎉 (on Linux it's still blocked by #713)

% wasmer .build/wasm32-unknown-wasi/debug/swift-base64-kitPackageTests.xctest      
Test Suite 'All tests' started at 2020-04-24 16:31:33.338
Test Suite 'testBundle.xctest' started at 2020-04-24 16:31:33.339
Test Suite 'DecodingTests' started at 2020-04-24 16:31:33.339
Test Case 'DecodingTests.testBase64DecodingAllTheBytesSequentially' started at 2020-04-24 16:31:33.339
Test Case 'DecodingTests.testBase64DecodingAllTheBytesSequentially' passed (0.001 seconds)
Test Case 'DecodingTests.testBase64DecodingArrayOfNulls' started at 2020-04-24 16:31:33.340
Test Case 'DecodingTests.testBase64DecodingArrayOfNulls' passed (0.0 seconds)
Test Case 'DecodingTests.testBase64DecodingWithInvalidLength' started at 2020-04-24 16:31:33.341
Test Case 'DecodingTests.testBase64DecodingWithInvalidLength' passed (0.0 seconds)
Test Case 'DecodingTests.testBase64DecodingWithPoop' started at 2020-04-24 16:31:33.341
Test Case 'DecodingTests.testBase64DecodingWithPoop' passed (0.0 seconds)
Test Case 'DecodingTests.testBase64UrlDecodingAllTheBytesSequentially' started at 2020-04-24 16:31:33.341
Test Case 'DecodingTests.testBase64UrlDecodingAllTheBytesSequentially' passed (0.001 seconds)
Test Case 'DecodingTests.testDecodeEmptyString' started at 2020-04-24 16:31:33.342
Test Case 'DecodingTests.testDecodeEmptyString' passed (0.0 seconds)
Test Suite 'DecodingTests' passed at 2020-04-24 16:31:33.342
	 Executed 6 tests, with 0 failures (0 unexpected) in 0.003 (0.003) seconds
Test Suite 'EncodingTests' started at 2020-04-24 16:31:33.343
Test Case 'EncodingTests.testBase64EncodingAllTheBytesSequentially' started at 2020-04-24 16:31:33.343
Test Case 'EncodingTests.testBase64EncodingAllTheBytesSequentially' passed (0.001 seconds)
Test Case 'EncodingTests.testBase64EncodingArrayOfNulls' started at 2020-04-24 16:31:33.344
Test Case 'EncodingTests.testBase64EncodingArrayOfNulls' passed (0.0 seconds)
Test Case 'EncodingTests.testBase64UrlEncodingAllTheBytesSequentially' started at 2020-04-24 16:31:33.344
Test Case 'EncodingTests.testBase64UrlEncodingAllTheBytesSequentially' passed (0.001 seconds)
Test Case 'EncodingTests.testEncodeEmptyData' started at 2020-04-24 16:31:33.345
Test Case 'EncodingTests.testEncodeEmptyData' passed (0.0 seconds)
Test Suite 'EncodingTests' passed at 2020-04-24 16:31:33.345
	 Executed 4 tests, with 0 failures (0 unexpected) in 0.002 (0.002) seconds
Test Suite 'IntegrationTests' started at 2020-04-24 16:31:33.345
Test Case 'IntegrationTests.testEncodeAndDecodingĨ' started at 2020-04-24 16:31:33.345
swift-base64-kit/Tests/Base64KitTests/IntegrationTests.swift:16: error: IntegrationTests.testEncodeAndDecodingĨ : XCTAssertEqual failed: ("Ĩ") is not equal to ("Ĩg=p/.") - 
Test Case 'IntegrationTests.testEncodeAndDecodingĨ' failed (0.0 seconds)
Test Suite 'IntegrationTests' failed at 2020-04-24 16:31:33.346
	 Executed 1 test, with 1 failure (0 unexpected) in 0.0 (0.0) seconds
Test Suite 'testBundle.xctest' failed at 2020-04-24 16:31:33.346
	 Executed 11 tests, with 1 failure (0 unexpected) in 0.006 (0.006) seconds
Test Suite 'All tests' failed at 2020-04-24 16:31:33.346
	 Executed 11 tests, with 1 failure (0 unexpected) in 0.006 (0.006) seconds

A test failed, which is interesting, but at least XCTest built for WASI helped in discovering that failure 😄

@kateinoigakukun
Copy link
Member

@MaxDesiatov Wow, this is really great work!
After resolving some issues related to #592, can we merge our forked version of XCTest into upstream?

@MaxDesiatov
Copy link
Author

Yes, upstreaming everything is high on my list, just wanted to get something working first 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants