Commit Graph

29 Commits

Author SHA1 Message Date
omochimetaru 6cc68d3ba8
Show stdout/stderr from Wasm in terminal (#472) 2024-05-25 09:06:24 +09:00
omochimetaru 3cb3877d98
Send stdout/stderr from WasmRunner to dev server without decoding as UTF-8 (#471)
* Enable WasmRunner to handle stdout as raw binary

* catch other errors

* move devDeps

* use browser exception handling

* comment out
2024-05-25 01:33:13 +09:00
Yuta Saito d16f59aa5d Report about dangling continuation 2024-05-08 12:18:22 +00:00
Yuta Saito 52f65cb692 Use JavaScriptKit's main entrypoint handler if available
The latest JavaScriptKit added main() method to handle main()/__main_argc_argv()
function call. It also handles some quirks of async-main & JavaScriptEventLoop.
2024-05-08 12:11:38 +00:00
Yuta Saito d487abb3b3 Inject default imported function implementation
Just throws exception
2024-05-07 21:34:09 +09:00
Yuta Saito faee016aca Stop writing static files in ~/.carton/static
Instead, write them under plugin work directory
2024-04-26 23:13:51 +09:00
Yuta Saito a10be40f36 Follow-up fix for f286203b0d
Node test runner also has to have argv0 but even though user doesn't
provide extra args, empty args are passed to the runner, so default
["main.wasm"] was not used. Changed to provide file base name as argv0
explicitly.
2024-04-18 16:40:37 +09:00
Yuta Saito 662d29d305 Map proc_exit to process exit on Node.js 2024-04-18 09:45:55 +09:00
Yuta Saito 5894a86bac Update StaticArchive.swift 2024-04-18 09:45:55 +09:00
omochimetaru 3abdbd2386 migrate to TypeScript 2024-04-18 01:31:11 +09:00
Yuta Saito f286203b0d Fix test harness for the latest main XCTest
The latest XCTest bundled in Swift SDK for Wasm requires `Bundle.main` access to
minimize behavior difference from other platforms. `Bundle.main`
requires `argv[0]` and file system access to get the main bundle path.
2024-04-05 03:24:37 +09:00
Yuta Saito 5b4b870aa5 Use mangled `__main_argc_argv` for Swift 6 and later 2024-03-09 23:24:09 +09:00
Yuta Saito 2e62088305 Version 1.0.0: SwiftPM Plugin Support
See CHANGELOG.md
2024-02-26 18:48:01 +09:00
Yuta Saito 7a7ab8cdfa Fix WASI stub syscall
The object key for Import entry was wrong.
2024-01-25 14:20:49 +00:00
Yuta Saito ac491662d8 swift run carton-release hash-archive 2024-01-16 22:06:14 +09:00
Yuta Saito b79fe9a260
Update SwiftPM branch to 5.8 and fix build errors (#395)
* Update SwiftPM branch to 5.8 and fix build errors

* Make swift-format 5.8 happy :)

* Make swift-format 5.8 happy for Tests

* Fix wrong formatting

* Resolve AbsolutePath(validating:) rename warnings

* Fix wrong formatting

* Resolve remaining deprecation warnings

* Fix Linux build failure
2023-05-04 18:40:16 +09:00
Yuta Saito 2fa2568a16
Exit non-zero status when test fail on browser (#370)
* Add crash test case

* Exit non-zero status when test fail

also handle JS exception
2022-07-19 01:28:40 +09:00
Max Desiatov 1ba7dd5d82
Use JSKit runtime from SwiftPM resources (#335)
* Use JSKit runtime from SwiftPM resources

* Fix Node.js test runner

* Remove unused webpack npm packages

* Update Swift version in `.swiftformat`

* Fix browser and Node.js CJS/ESM handling

* Fix one of the tests, add CI time limit

* Use Tokamak `update-jskit` branch to fix tests

* Use latest Vapor with `.mjs` content-type fix

* Use dynamic import to detect JSKit presence

* Fix missing `runtimeConstructor` reference

* Update `StaticArchive.swift`

* Reduce the diff

* Address PR feedback

* Fix Node.js <-> JSKit integration test

* Update SwiftPM dependencies

* Fix comment typo in `testNode.js`

* Reuse `__stack_sanitizer` across entrypoints
2022-05-20 13:12:45 +01:00
Yuta Saito ad9f73ceb1
Embed static.zip in Swift code instead of downloading from remote (#334)
* Embed static.zip in Swift code instead of downloading from remote

* Make base64 decode logic failure

* Add rationale for the use of base64
2022-05-11 15:42:45 +00:00
Antonio Candinho 505a9b81a2
Add support for running tests using NodeJS (#328)
### 🎩 What is the goal?

Implement NodeJS as another test runner. 

### 📄 How is it being implemented?

In this PR, I include the following changes:

 - Create an abstraction for the different Test Runners (Wasmer, browser and now Node)
 - Implement the new Node test runner (quite similar to the Wasmer one)
 - Unify Javascript client code, so we can make sure we apply the same patches and load in the same way all the different targets
 - Create a new entry point for testing with node
 - Add that new entry point to the static bundle
 
### 👀 Any consideration?

The Node test runner does not use the TestsParser as it heavily impacts execution time. I will try to figure out what's going on later.
 
###  How can it be tested?

Testing is automated 🤖 . You can also check this in your own project by running:

```bash
carton test --environment node
```
2022-05-11 13:52:44 +00:00
Max Desiatov 0b44e11222 Update entrypoint hashes and `static.zip` URL 2022-04-30 11:43:48 +01:00
Yuta Saito 9c4021d262
Several fixes for 5.6 toolchain (#310)
- Reactor model support
- Update sanitizer support object

This is required to resolve https://github.com/TokamakUI/Tokamak/pull/475
2022-04-09 13:37:34 +00:00
Max Desiatov a15023d881
Bump JavaScriptKit dependency to 0.13.0 (#306) 2022-04-01 08:53:53 +01:00
yonihemi 7bd54d6c0c
Bump JavaScriptKit and Tokamak (#294) 2022-02-16 11:02:53 +00:00
yonihemi 4514347a25
Update JavaScriptKit to v0.11.1 (#265)
* Update JavaScriptKit to v0.11.1

* Update static.zip URL
2021-11-23 17:02:41 +08:00
Max Desiatov f6ae632383 Update error message in `Server.swift` 2021-09-02 20:52:51 +01:00
Max Desiatov ae8015413b
Fix `carton dev` crashing with SO sanitizer (#239)
Previously, the file we need to include with the build to enable the stack overflow sanitizer was written as a temporary file. This didn't happen though on watcher rebuilds with `carton dev` and caused crashes when a code line containing `try!` relying on this file to be present was executed.

I think it's easier and more efficient to bundle this file in the `static.zip` file that already includes our JS entrypoints. We require `static.zip` to be downloaded and unpacked successfully into `~/.carton/static` before every build anyway. It makes more sense to sense the sanitizer file in `~/.carton/static/so_sanitizer.wasm` and use that instead writing and deleting it at a temporary path on every build.

I've also updated the JSKit dependency and cleaned up some linter warnings by moving large tuple values into a separate `BuildDescription` type.
2021-05-24 12:03:38 +01:00
Yuta Saito 1acf9c3ad7
Integrate stack sanitizer (#230)
* Update WasmTransformer

* Add build flavor to determine build options

* Enable stack overflow sanitizer pass

* Embed import entry in binary

* Remove sanitize support from bundle command

* Update WasmTransformer and add --stack-first option

* Fix carton-release hash-archive for CartonKit renaming

* Run carton-release hash-archive

* Update WasmTransformer

* Use run-p

* Use matrix in CI

* Build and install pre-released resource

* Exclude fixture directory from linting

* Fix failing tests

* Turn off sanitizer on test command
2021-04-18 16:45:10 +09:00
thecb4 5fe8c8edac
Changes to project structure to allow for better testability (#191)
* Changed sources folder to separate the CLI from the 'Kit' to allow for testability of each command

* Fixed Swift 5.2 Support

* Removed Path.swift (for now)

* Fixed OpenCombine and other version issues for 5.2 support

* Removed Path.swift from test target dependency

Co-authored-by: thecb4 <cavelle@tehcb4.io>
2020-12-21 05:14:24 -05:00