(t *testing.T)
| 577 | } |
| 578 | |
| 579 | func TestWasmExport(t *testing.T) { |
| 580 | t.Parallel() |
| 581 | |
| 582 | type testCase struct { |
| 583 | name string |
| 584 | target string |
| 585 | buildMode string |
| 586 | scheduler string |
| 587 | file string |
| 588 | noOutput bool |
| 589 | command bool // call _start (command mode) instead of _initialize |
| 590 | } |
| 591 | |
| 592 | tests := []testCase{ |
| 593 | // "command mode" WASI |
| 594 | { |
| 595 | name: "WASIp1-command", |
| 596 | target: "wasip1", |
| 597 | command: true, |
| 598 | }, |
| 599 | // "reactor mode" WASI (with -buildmode=c-shared) |
| 600 | { |
| 601 | name: "WASIp1-reactor", |
| 602 | target: "wasip1", |
| 603 | buildMode: "c-shared", |
| 604 | }, |
| 605 | // Make sure reactor mode also works without a scheduler. |
| 606 | { |
| 607 | name: "WASIp1-reactor-noscheduler", |
| 608 | target: "wasip1", |
| 609 | buildMode: "c-shared", |
| 610 | scheduler: "none", |
| 611 | file: "wasmexport-noscheduler.go", |
| 612 | }, |
| 613 | // Test -target=wasm-unknown with the default build mode (which is |
| 614 | // c-shared). |
| 615 | { |
| 616 | name: "wasm-unknown-reactor", |
| 617 | target: "wasm-unknown", |
| 618 | file: "wasmexport-noscheduler.go", |
| 619 | noOutput: true, // wasm-unknown cannot produce output |
| 620 | }, |
| 621 | // Test -target=wasm-unknown with -buildmode=default, which makes it run |
| 622 | // in command mode. |
| 623 | { |
| 624 | name: "wasm-unknown-command", |
| 625 | target: "wasm-unknown", |
| 626 | buildMode: "default", |
| 627 | file: "wasmexport-noscheduler.go", |
| 628 | noOutput: true, // wasm-unknown cannot produce output |
| 629 | command: true, |
| 630 | }, |
| 631 | // Test buildmode=wasi-legacy with WASI. |
| 632 | { |
| 633 | name: "WASIp1-legacy", |
| 634 | target: "wasip1", |
| 635 | buildMode: "wasi-legacy", |
| 636 | scheduler: "none", |
nothing calls this directly
no test coverage detected