Skip to content

Commit

Permalink
wasm: test (not for upstream)
Browse files Browse the repository at this point in the history
Change-Id: Id221e8395516d3b7227267fecacc0ef78118041c
  • Loading branch information
neelance committed May 22, 2018
1 parent ee6dd4a commit 5997f9c
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM golang:1.10-alpine

RUN apk add --no-cache bash build-base nodejs

ENV GOROOT=/usr/local/go-wasm
ADD src $GOROOT/src
ADD misc $GOROOT/misc
ADD test $GOROOT/test
RUN ln -s $GOROOT/misc/wasm/go_js_wasm_exec /usr/local/bin/go_js_wasm_exec

RUN echo "dev" > $GOROOT/VERSION
RUN cd $GOROOT/src && ./make.bash
ENV PATH=$GOROOT/bin:$PATH
RUN cd $GOROOT/test && go build run.go

ENV GOARCH=wasm
ENV GOOS=js
RUN go install -v std
RUN go test -short std
RUN cd $GOROOT/test && ./run -v
26 changes: 26 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -ex

# cd src/cmd/compile/internal/ssa/gen
# go run *.go
# cd -

env GOROOT=$PWD toolstash go install -v -toolexec=toolstash cmd

# env GOOS=js GOARCH=wasm GOSSAFUNC=$SSA ./bin/go build -gcflags '-l -c 1' runtime/internal/sys
env GOOS=js GOARCH=wasm GOSSAFUNC=$SSA ./bin/go build -a -gcflags '-l -c 1' -o ~/src/test2/test.wasm test2
# env GOOS=js GOARCH=wasm GOSSAFUNC=$SSA ./bin/go test -c -a -gcflags '-l -c 1' -o ~/src/test2/test.wasm go/printer

# wasm2wast --no-check ~/src/test2/test.wasm > ~/src/test2/test.wat
# wast2wasm ~/src/test2/test.wat > /dev/null

go_js_wasm_exec ~/src/test2/test.wasm -test.v -test.short -test.run=TestLargeStringWrites

# cd ~/src/test2/
# wasm-opt test.wasm -o test.wasm --debuginfo
# wasm2wast test.wasm > test.wat

# wasm-opt test.wasm -o test-opt.wasm --debuginfo -Oz
# wasm2wast test-opt.wasm > test-opt.wat

# diff -w -u test.wat test-opt.wat > wat.diff
Binary file added test/run
Binary file not shown.
11 changes: 11 additions & 0 deletions test_core.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
set -ex

env GOROOT=$PWD toolstash go install -v -toolexec=toolstash cmd

export PATH=$PWD/bin:$PATH
export GOOS=js
export GOARCH=wasm

cd test
./run -v

0 comments on commit 5997f9c

Please sign in to comment.