Throwaway prototypes for Sausage v3. Plan and decisions: ~/research/sausage-v3/PLAN.md. Results and evidence: the spike READMEs.
20 lines
925 B
Nu
20 lines
925 B
Nu
# Compare Go initialization and exact runtime clock calls with the stock adapter.
|
|
def main [] {
|
|
let fixture = $env.FILE_PWD
|
|
let root = '/tmp/s6-esbuild'
|
|
with-env {GOOS: wasip1, GOARCH: wasm} {
|
|
^go build -o $'($root)/hello-http.wasm' ($fixture | path join hello.go)
|
|
if $env.LAST_EXIT_CODE != 0 { error make {msg: 'Go probe build failed'} }
|
|
}
|
|
for probe in [
|
|
{input: $'($root)/hello-http.wasm', output: hello-http},
|
|
{input: ($fixture | path join clocks.wat), output: clocks}
|
|
] {
|
|
^wasm-tools component new $probe.input --adapt $'wasi_snapshot_preview1=($root)/adapter-v49.wasm' -o $'($root)/($probe.output).component.wasm'
|
|
if $env.LAST_EXIT_CODE != 0 { error make {msg: 'probe adaptation failed'} }
|
|
^wasmtime run $'($root)/($probe.output).component.wasm'
|
|
if $env.LAST_EXIT_CODE != 0 { error make {msg: 'probe execution failed'} }
|
|
print $'PASS stock adapter: ($probe.output)'
|
|
}
|
|
}
|