ci: use llgo test instead
ci: use llgo test instead
This commit is contained in:
5
.github/workflows/go.yml
vendored
5
.github/workflows/go.yml
vendored
@@ -52,11 +52,6 @@ jobs:
|
|||||||
if: ${{!startsWith(matrix.os, 'macos')}}
|
if: ${{!startsWith(matrix.os, 'macos')}}
|
||||||
run: go test ./...
|
run: go test ./...
|
||||||
|
|
||||||
- name: Test Baremetal GC
|
|
||||||
if: ${{!startsWith(matrix.os, 'macos')}}
|
|
||||||
working-directory: runtime/internal/runtime/tinygogc
|
|
||||||
run: go test -tags testGC .
|
|
||||||
|
|
||||||
- name: Test with coverage
|
- name: Test with coverage
|
||||||
if: startsWith(matrix.os, 'macos')
|
if: startsWith(matrix.os, 'macos')
|
||||||
run: go test -coverprofile="coverage.txt" -covermode=atomic ./...
|
run: go test -coverprofile="coverage.txt" -covermode=atomic ./...
|
||||||
|
|||||||
8
.github/workflows/llgo.yml
vendored
8
.github/workflows/llgo.yml
vendored
@@ -61,7 +61,7 @@ jobs:
|
|||||||
if ${{ startsWith(matrix.os, 'macos') }}; then
|
if ${{ startsWith(matrix.os, 'macos') }}; then
|
||||||
DEMO_PKG="cargs_darwin_arm64.zip"
|
DEMO_PKG="cargs_darwin_arm64.zip"
|
||||||
else
|
else
|
||||||
DEMO_PKG="cargs_linux_amd64.zip"
|
DEMO_PKG="cargs_linux_amd64.zip"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
mkdir -p ./_demo/c/cargs/libs
|
mkdir -p ./_demo/c/cargs/libs
|
||||||
@@ -186,11 +186,15 @@ jobs:
|
|||||||
uses: actions/setup-go@v6
|
uses: actions/setup-go@v6
|
||||||
with:
|
with:
|
||||||
go-version: ${{matrix.go}}
|
go-version: ${{matrix.go}}
|
||||||
|
- name: Test Baremetal GC
|
||||||
|
if: ${{!startsWith(matrix.os, 'macos')}}
|
||||||
|
working-directory: runtime/internal/runtime/tinygogc
|
||||||
|
run: llgo test -tags testGC .
|
||||||
- name: run llgo test
|
- name: run llgo test
|
||||||
run: |
|
run: |
|
||||||
llgo test ./...
|
llgo test ./...
|
||||||
|
|
||||||
|
|
||||||
hello:
|
hello:
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
timeout-minutes: 30
|
timeout-minutes: 30
|
||||||
|
|||||||
@@ -10,14 +10,6 @@ import (
|
|||||||
//go:linkname getsp llgo.stackSave
|
//go:linkname getsp llgo.stackSave
|
||||||
func getsp() unsafe.Pointer
|
func getsp() unsafe.Pointer
|
||||||
|
|
||||||
// link here for testing
|
|
||||||
//
|
|
||||||
//go:linkname memset C.memset
|
|
||||||
func memset(unsafe.Pointer, int, uintptr) unsafe.Pointer
|
|
||||||
|
|
||||||
//go:linkname memcpy C.memcpy
|
|
||||||
func memcpy(unsafe.Pointer, unsafe.Pointer, uintptr)
|
|
||||||
|
|
||||||
//go:linkname _heapStart _heapStart
|
//go:linkname _heapStart _heapStart
|
||||||
var _heapStart [0]byte
|
var _heapStart [0]byte
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
package tinygogc
|
package tinygogc
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"unsafe"
|
|
||||||
_ "unsafe"
|
_ "unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -22,14 +21,3 @@ var _stackStart [0]byte
|
|||||||
var _globals_start [0]byte
|
var _globals_start [0]byte
|
||||||
|
|
||||||
var _globals_end [0]byte
|
var _globals_end [0]byte
|
||||||
|
|
||||||
//go:linkname memclrNoHeapPointers runtime.memclrNoHeapPointers
|
|
||||||
func memclrNoHeapPointers(unsafe.Pointer, uintptr) unsafe.Pointer
|
|
||||||
|
|
||||||
//go:linkname memcpy runtime.memmove
|
|
||||||
func memcpy(to unsafe.Pointer, from unsafe.Pointer, size uintptr)
|
|
||||||
|
|
||||||
func memset(ptr unsafe.Pointer, n int, size uintptr) unsafe.Pointer {
|
|
||||||
memclrNoHeapPointers(ptr, size)
|
|
||||||
return ptr
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ func initGC() {
|
|||||||
endBlock = (uintptr(metadataStart) - heapStart) / bytesPerBlock
|
endBlock = (uintptr(metadataStart) - heapStart) / bytesPerBlock
|
||||||
stackTop = uintptr(unsafe.Pointer(&_stackStart))
|
stackTop = uintptr(unsafe.Pointer(&_stackStart))
|
||||||
|
|
||||||
memset(metadataStart, 0, metadataSize)
|
c.Memset(metadataStart, 0, metadataSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
func lazyInit() {
|
func lazyInit() {
|
||||||
@@ -339,7 +339,7 @@ func Alloc(size uintptr) unsafe.Pointer {
|
|||||||
}
|
}
|
||||||
unlock(&gcMutex)
|
unlock(&gcMutex)
|
||||||
// Return a pointer to this allocation.
|
// Return a pointer to this allocation.
|
||||||
return memset(gcPointerOf(thisAlloc), 0, size)
|
return c.Memset(gcPointerOf(thisAlloc), 0, size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -363,7 +363,7 @@ func Realloc(ptr unsafe.Pointer, size uintptr) unsafe.Pointer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
newAlloc := Alloc(size)
|
newAlloc := Alloc(size)
|
||||||
memcpy(newAlloc, ptr, oldSize)
|
c.Memcpy(newAlloc, ptr, oldSize)
|
||||||
free(ptr)
|
free(ptr)
|
||||||
|
|
||||||
return newAlloc
|
return newAlloc
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ package tinygogc
|
|||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
c "github.com/goplus/llgo/runtime/internal/clite"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -95,7 +97,7 @@ func (env *mockGCEnv) setupMockGC() {
|
|||||||
endBlock = (uintptr(metadataStart) - heapStart) / bytesPerBlock
|
endBlock = (uintptr(metadataStart) - heapStart) / bytesPerBlock
|
||||||
|
|
||||||
// Clear metadata using memset like initGC does
|
// Clear metadata using memset like initGC does
|
||||||
memset(metadataStart, 0, metadataSize)
|
c.Memset(metadataStart, 0, metadataSize)
|
||||||
|
|
||||||
// Reset allocator state (initGC doesn't reset these, but we need to)
|
// Reset allocator state (initGC doesn't reset these, but we need to)
|
||||||
nextAlloc = 0
|
nextAlloc = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user