Merge pull request #1030 from cpunion/run-llgo-test

ci: run llgo test
This commit is contained in:
xushiwei
2025-03-19 12:47:31 +08:00
committed by GitHub
18 changed files with 73 additions and 2 deletions

View File

@@ -165,6 +165,7 @@ jobs:
- name: run llgo test
run: |
llgo test ./...
cd _demo
llgo test -v ./runtest

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package main
import (

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package main
import (

View File

@@ -175,6 +175,14 @@ func Do(args []string, conf *Config) ([]Package, error) {
}
case ModeRun:
return nil, fmt.Errorf("cannot run multiple packages")
case ModeTest:
newInitial := make([]*packages.Package, 0, len(initial))
for _, pkg := range initial {
if needLink(pkg, mode) {
newInitial = append(newInitial, pkg)
}
}
initial = newInitial
}
}

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package build
import (

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package buildtags
import (

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package env
import (

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*

View File

@@ -387,14 +387,13 @@ func (p Program) NewPackage(name, pkgPath string) Package {
pyobjs := make(map[string]PyObjRef)
pymods := make(map[string]Global)
strs := make(map[string]llvm.Value)
goStrs := make(map[string]llvm.Value)
chkabi := make(map[types.Type]bool)
glbDbgVars := make(map[Expr]bool)
// Don't need reset p.needPyInit here
// p.needPyInit = false
ret := &aPackage{
mod: mod, vars: gbls, fns: fns, stubs: stubs,
pyobjs: pyobjs, pymods: pymods, strs: strs, goStrs: goStrs,
pyobjs: pyobjs, pymods: pymods, strs: strs,
chkabi: chkabi, Prog: p,
di: nil, cu: nil, glbDbgVars: glbDbgVars,
}

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
*

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package ssatest
import (

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package abi
import (

21
test/c_test.go Normal file
View File

@@ -0,0 +1,21 @@
//go:build llgo
// +build llgo
package test
import (
"testing"
"github.com/goplus/llgo/c"
)
// Can't put it in c/ package because it is marked as 'decl'
func TestCstr(t *testing.T) {
cstr := c.Str("foo")
if cstr == nil {
t.Fatal("cstr() returned nil")
}
if c.Strlen(cstr) != 3 {
t.Fatal("cstr() returned invalid length")
}
}

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/*
* Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved.
*