Skip to contentSkip to conversation

How to run the recipe Go tests on Yocto

yocto Javier Tia 1 participant 1 message Mar 4, 2021 1 message not in the archive

lore
Share & tools
lore

Javier Tia

author
#1 lore raw
In reply to a message not in the archive

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 🖊

Quoted 43 lines · Javier Tia

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 🖊