Re: How to run the recipe Go tests on Yocto


Javier Tia <javier.tia@...>
 

Found the root cause. The Go UT binaries files generated by the recipes
with ptest or generated manually need to be executed with the same ld
command from the toolchain used to build them. In this case, it is the
default GNU toolchain native provided by poky.

Thanks,

▷ Javier's 🖊

On 3/2/21 5:10 PM, Javier Tia wrote:
Hi,

Is there a way to run the recipe Go tests in Yocto?

I have tried several ways (1. Manually and 2. ptest) with unsuccess.

1. Manually exporting all the toolchain variables:

GOARCH="${BUILD_GOARCH}"
CGO_ENABLED="1"
CFLAGS="${BUILD_CFLAGS}"
LDFLAGS="${BUILD_LDFLAGS}"
CGO_CFLAGS="${BUILD_CFLAGS}"
CGO_LDFLAGS="${BUILD_LDFLAGS}"
CC="${BUILD_CC}"
LD="${BUILD_LD}"

and run it with the Go test native version.


2. Using ptest, and adding to the Go recipe:

do_compile_ptest() {
${GO} test -vet off $(go_list_package_tests)
}

In both cases the error messages are like this:

fork/exec .../recipe_name/1.0-r0/go-tmp/go-build7113/b338/util.test: no
such file or directory
FAIL util 0.000s

It's happening with Yocto Zeus (v3.0.4) and Go v1.4.17


Regards,

▷ Javier's 🖊




Join yocto@lists.yoctoproject.org to automatically receive all group messages.