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 - name: run llgo test
run: | run: |
llgo test ./...
cd _demo cd _demo
llgo test -v ./runtest llgo test -v ./runtest

View File

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

View File

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

View File

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

View File

@@ -175,6 +175,14 @@ func Do(args []string, conf *Config) ([]Package, error) {
} }
case ModeRun: case ModeRun:
return nil, fmt.Errorf("cannot run multiple packages") 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 package build
import ( import (

View File

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

View File

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

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
/* /*
* Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved. * 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) pyobjs := make(map[string]PyObjRef)
pymods := make(map[string]Global) pymods := make(map[string]Global)
strs := make(map[string]llvm.Value) strs := make(map[string]llvm.Value)
goStrs := make(map[string]llvm.Value)
chkabi := make(map[types.Type]bool) chkabi := make(map[types.Type]bool)
glbDbgVars := make(map[Expr]bool) glbDbgVars := make(map[Expr]bool)
// Don't need reset p.needPyInit here // Don't need reset p.needPyInit here
// p.needPyInit = false // p.needPyInit = false
ret := &aPackage{ ret := &aPackage{
mod: mod, vars: gbls, fns: fns, stubs: stubs, 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, chkabi: chkabi, Prog: p,
di: nil, cu: nil, glbDbgVars: glbDbgVars, 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. * Copyright (c) 2024 The GoPlus Authors (goplus.org). All rights reserved.
* *

View File

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

View File

@@ -1,3 +1,6 @@
//go:build !llgo
// +build !llgo
package abi package abi
import ( 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. * Copyright (c) 2022 The GoPlus Authors (goplus.org). All rights reserved.
* *