Skip to content

Commit 5833894

Browse files
committed
[DO NOT MERGE] testing Windows CI failures
1 parent e12da15 commit 5833894

File tree

8 files changed

+125
-39
lines changed

8 files changed

+125
-39
lines changed

.github/workflows/build-macos.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ jobs:
2626
goarch: arm64
2727
runs-on: ${{ matrix.os }}
2828
steps:
29+
- name: exit early
30+
run: command-does-not-exist
2931
- name: Install Dependencies
3032
run: |
3133
HOMEBREW_NO_AUTO_UPDATE=1 brew install qemu binaryen
@@ -128,6 +130,8 @@ jobs:
128130
matrix:
129131
version: [16, 17, 18]
130132
steps:
133+
- name: exit early
134+
run: command-does-not-exist
131135
- name: Set up Homebrew
132136
uses: Homebrew/actions/setup-homebrew@master
133137
- name: Fix Python symlinks

.github/workflows/linux.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ jobs:
2222
outputs:
2323
version: ${{ steps.version.outputs.version }}
2424
steps:
25+
- name: exit early
26+
run: command-does-not-exist
2527
- name: Install apk dependencies
2628
# tar: needed for actions/cache@v4
2729
# git+openssh: needed for checkout (I think?)
@@ -171,6 +173,8 @@ jobs:
171173
# potential bugs.
172174
runs-on: ubuntu-latest
173175
steps:
176+
- name: exit early
177+
run: command-does-not-exist
174178
- name: Checkout
175179
uses: actions/checkout@v4
176180
with:

.github/workflows/nix.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
nix-test:
1616
runs-on: ubuntu-latest
1717
steps:
18+
- name: exit early
19+
run: command-does-not-exist
1820
- name: Uninstall system LLVM
1921
# Hack to work around issue where we still include system headers for
2022
# some reason.

.github/workflows/sizediff.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515
permissions:
1616
pull-requests: write
1717
steps:
18+
- name: exit early
19+
run: command-does-not-exist
1820
# Prepare, install tools
1921
- name: Add GOBIN to $PATH
2022
run: |

.github/workflows/windows.yml

Lines changed: 37 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,26 +23,30 @@ jobs:
2323
minimum-size: 8GB
2424
maximum-size: 24GB
2525
disk-root: "C:"
26-
- uses: brechtm/setup-scoop@v2
27-
with:
28-
scoop_update: 'false'
29-
- name: Install Dependencies
30-
shell: bash
31-
run: |
32-
scoop install ninja binaryen
26+
#- uses: brechtm/setup-scoop@v2
27+
# with:
28+
# scoop_update: 'false'
29+
#- name: Install Dependencies
30+
# shell: bash
31+
# run: |
32+
# scoop install ninja binaryen
3333
- name: Checkout
3434
uses: actions/checkout@v4
35-
with:
36-
submodules: true
35+
- name: submodules
36+
shell: bash
37+
run: git submodule update --init lib/mingw-w64
3738
- name: Extract TinyGo version
3839
id: version
3940
shell: bash
4041
run: ./.github/workflows/tinygo-extract-version.sh | tee -a "$GITHUB_OUTPUT"
41-
- name: Install Go
42-
uses: actions/setup-go@v5
43-
with:
44-
go-version: '1.23'
45-
cache: true
42+
- name: command
43+
shell: bash
44+
run: go env
45+
#- name: Install Go
46+
# uses: actions/setup-go@v5
47+
# with:
48+
# go-version: '1.23'
49+
# cache: true
4650
- name: Restore cached LLVM source
4751
uses: actions/cache/restore@v4
4852
id: cache-llvm-source
@@ -91,6 +95,25 @@ jobs:
9195
with:
9296
key: ${{ steps.cache-llvm-build.outputs.cache-primary-key }}
9397
path: llvm-build
98+
- name: Restore Go cache
99+
uses: actions/cache/restore@v4
100+
with:
101+
key: go-cache-v2
102+
path: |
103+
C:/Users/runneradmin/AppData/Local/go-build
104+
C:/Users/runneradmin/go/pkg/mod
105+
- name: Test TinyGo
106+
shell: bash
107+
run: make test GOTESTFLAGS="-short -run=TestBuild -v"
108+
- name: Save Go cache
109+
uses: actions/cache/save@v4
110+
with:
111+
key: go-cache-v2
112+
path: |
113+
C:/Users/runneradmin/AppData/Local/go-build
114+
C:/Users/runneradmin/go/pkg/mod
115+
- name: exit
116+
run: command-does-not-exist
94117
- name: Cache wasi-libc sysroot
95118
uses: actions/cache@v4
96119
id: cache-wasi-libc
@@ -105,9 +128,6 @@ jobs:
105128
scoop install [email protected]
106129
- name: make gen-device
107130
run: make -j3 gen-device
108-
- name: Test TinyGo
109-
shell: bash
110-
run: make test GOTESTFLAGS="-short"
111131
- name: Build TinyGo release tarball
112132
shell: bash
113133
run: make build/release -j4

GNUmakefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ gen-device: gen-device-stm32
191191
endif
192192

193193
gen-device-avr:
194-
@if [ ! -e lib/avr/README.md ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi
194+
#@if [ ! -e lib/avr/README.md ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi
195195
$(GO) build -o ./build/gen-device-avr ./tools/gen-device-avr/
196196
./build/gen-device-avr lib/avr/packs/atmega src/device/avr/
197197
./build/gen-device-avr lib/avr/packs/tiny src/device/avr/
@@ -263,7 +263,7 @@ endif
263263
.PHONY: wasi-libc
264264
wasi-libc: lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a
265265
lib/wasi-libc/sysroot/lib/wasm32-wasi/libc.a:
266-
@if [ ! -e lib/wasi-libc/Makefile ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi
266+
#@if [ ! -e lib/wasi-libc/Makefile ]; then echo "Submodules have not been downloaded. Please download them using:\n git submodule update --init"; exit 1; fi
267267
cd lib/wasi-libc && $(MAKE) -j4 EXTRA_CFLAGS="-O2 -g -DNDEBUG -mnontrapping-fptoint -msign-ext" MALLOC_IMPL=none CC="$(CLANG)" AR=$(LLVM_AR) NM=$(LLVM_NM)
268268

269269
# Generate WASI syscall bindings
@@ -292,8 +292,8 @@ endif
292292
tinygo: ## Build the TinyGo compiler
293293
@if [ ! -f "$(LLVM_BUILDDIR)/bin/llvm-config" ]; then echo "Fetch and build LLVM first by running:"; echo " $(MAKE) llvm-source"; echo " $(MAKE) $(LLVM_BUILDDIR)"; exit 1; fi
294294
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GOENVFLAGS) $(GO) build -buildmode exe -o build/tinygo$(EXE) -tags "byollvm osusergo" .
295-
test: wasi-libc check-nodejs-version
296-
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -buildmode exe -tags "byollvm osusergo" $(GOTESTPKGS)
295+
test: #wasi-libc check-nodejs-version
296+
CGO_CPPFLAGS="$(CGO_CPPFLAGS)" CGO_CXXFLAGS="$(CGO_CXXFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" $(GO) test $(GOTESTFLAGS) -timeout=1h -race -buildmode exe -tags "byollvm osusergo" .
297297

298298
# Standard library packages that pass tests on darwin, linux, wasi, and windows, but take over a minute in wasi
299299
TEST_PACKAGES_SLOW = \

main_test.go

Lines changed: 69 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"bufio"
88
"bytes"
99
"context"
10+
"crypto/sha256"
1011
"errors"
1112
"flag"
1213
"io"
@@ -15,6 +16,7 @@ import (
1516
"reflect"
1617
"regexp"
1718
"runtime"
19+
"strconv"
1820
"strings"
1921
"sync"
2022
"testing"
@@ -27,7 +29,6 @@ import (
2729
"github.com/tetratelabs/wazero/sys"
2830
"github.com/tinygo-org/tinygo/builder"
2931
"github.com/tinygo-org/tinygo/compileopts"
30-
"github.com/tinygo-org/tinygo/diagnostics"
3132
"github.com/tinygo-org/tinygo/goenv"
3233
)
3334

@@ -114,10 +115,15 @@ func TestBuild(t *testing.T) {
114115
return
115116
}
116117

117-
t.Run("Host", func(t *testing.T) {
118-
t.Parallel()
119-
runPlatTests(optionsFromTarget("", sema), tests, t)
118+
t.Run("Debugging", func(t *testing.T) {
119+
for i := 0; i < 5; i++ {
120+
t.Run(strconv.Itoa(i), func(t *testing.T) {
121+
options := optionsFromTarget("", sema)
122+
runTest("alias.go", options, t, nil, nil)
123+
})
124+
}
120125
})
126+
return
121127

122128
// Test a few build options.
123129
t.Run("build-options", func(t *testing.T) {
@@ -420,21 +426,67 @@ func runTestWithConfig(name string, t *testing.T, options compileopts.Options, c
420426

421427
// Build the test binary.
422428
stdout := &bytes.Buffer{}
423-
_, err = buildAndRun(pkgName, config, stdout, cmdArgs, environmentVars, time.Minute, func(cmd *exec.Cmd, result builder.BuildResult) error {
424-
return cmd.Run()
425-
})
429+
_, fileExt := config.EmulatorFormat()
430+
tmpdir := t.TempDir()
431+
result, err := builder.Build(pkgName, fileExt, tmpdir, config)
426432
if err != nil {
427-
w := &bytes.Buffer{}
428-
diagnostics.CreateDiagnostics(err).WriteTo(w, "")
429-
for _, line := range strings.Split(strings.TrimRight(w.String(), "\n"), "\n") {
430-
t.Log(line)
431-
}
432-
if stdout.Len() != 0 {
433-
t.Logf("output:\n%s", stdout.String())
434-
}
435-
t.Fail()
436-
return
433+
t.Fatal("build failed:", err)
434+
}
435+
436+
data, err := os.ReadFile(result.Executable)
437+
if err != nil {
438+
t.Fatal("failed to read executable:", err)
439+
}
440+
hash := sha256.Sum256(data)
441+
t.Logf("executable hash and size: %d %x", len(data), hash)
442+
443+
for i := 0; i < 100; i++ {
444+
i := i
445+
t.Run(strconv.Itoa(i), func(t *testing.T) {
446+
t.Parallel()
447+
stdout := &bytes.Buffer{}
448+
cmd := exec.Command(result.Executable)
449+
cmd.Stdout = stdout
450+
cmd.Stderr = stdout
451+
err := cmd.Run()
452+
if err != nil {
453+
t.Log("run error:", err)
454+
}
455+
time.Sleep(time.Second)
456+
checkOutput(t, expectedOutputPath, stdout.Bytes())
457+
})
437458
}
459+
return
460+
461+
//_, err = buildAndRun(pkgName, config, stdout, cmdArgs, environmentVars, time.Minute, func(cmd *exec.Cmd, result builder.BuildResult) error {
462+
// data, err := os.ReadFile(result.Executable)
463+
// if err != nil {
464+
// t.Fatal("failed to read executable:", err)
465+
// }
466+
// hash := sha256.Sum256(data)
467+
// t.Logf("executable hash and size: %d %x", len(data), hash)
468+
469+
// t.Log("command:", cmd)
470+
// err = cmd.Run()
471+
// if err == nil {
472+
// t.Log(" error is nil!")
473+
// } else {
474+
// t.Log(" error:", err)
475+
// }
476+
// return err
477+
//})
478+
//if err != nil {
479+
// w := &bytes.Buffer{}
480+
// diagnostics.CreateDiagnostics(err).WriteTo(w, "")
481+
// for _, line := range strings.Split(strings.TrimRight(w.String(), "\n"), "\n") {
482+
// t.Log(line)
483+
// }
484+
// if stdout.Len() != 0 {
485+
// t.Logf("output:\n%s", stdout.String())
486+
// }
487+
// t.Fail()
488+
// return
489+
//}
438490

439491
actual := stdout.Bytes()
440492
if config.EmulatorName() == "simavr" {

src/runtime/runtime_windows.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,9 @@ func os_runtime_args() []string {
9292
}
9393

9494
func putchar(c byte) {
95-
libc_putchar(int(c))
95+
if libc_putchar(int(c)) < 0 {
96+
libc_exit(42)
97+
}
9698
}
9799

98100
var heapSize uintptr = 128 * 1024 // small amount to start

0 commit comments

Comments
 (0)