0

Newbie here, trying to learn and setup Yocto to build and run unit tests for my recipe that fetches code from FooImpl but getting errors and unable to understand the root cause. So my recipe file is foo-impl-git.bb and the contents are

SUMMARY = "FooImpl"
DESCRIPTION = "FooImpl Recipe"
LICENSE = "CLOSED"

DEPENDS = "foo-interface googletest"

SRC_URI = "xxx/FooImpl;protocol=ssh;branch=mainline; \
           file://run-ptest \
          "
SRCREV = "yyyyy"

S = "${WORKDIR}/git"

inherit cmake ptest

do_install_ptest() {
    mkdir -p ${D}${PTEST_PATH}/tests
    cp -rf ${B}/test/foo-impl-unittest ${D}${PTEST_PATH}/tests
}

IMAGE_INSTALL:append = "foo-impl-ptest"

The error i am getting is

buildfarm-ssh] NOTE: recipe foo-impl-git-r0: task do_install_ptest_base: Started
[buildfarm-ssh] ERROR: foo-impl-git-r0 do_install_ptest_base: ExecutionError('zzz/tmp/work/core2-64-poky-linux/foo-impl/git-r0/temp/run.do_install_ptest_base.23883', 1, None, None)
[buildfarm-ssh] ERROR: Logfile of failure stored in: zzz/tmp/work/core2-64-poky-linux/foo-impl/git-r0/temp/log.do_install_ptest_base.23883
[buildfarm-ssh] Log data follows:
| DEBUG: Executing shell function do_install_ptest_base
| grep: Makefile: No such file or directory
| cp: cannot stat 'zzz/tmp/work/core2-64-poky-linux/foo/git-r0/foo-impl-git//test/foo-impl-unittest': No such file or directory 

my run-ptest file is as follows

#!/bin/sh

tests/foo-impl-unittest
if [ $? -eq 0 ]; then
    echo "PASS: $i"
else
    echo "FAIL: $i"
fi

I have some clarifications *) in do_install_ptest is foo-impl-unittest arbitrary , if not what the correct naming conventions.

*) in IMAGE_INSTALL:append = "foo-impl-ptest" is foo-impl-ptest arbitary. if not what the correct naming conventions.

*) in run-ptest file is tests/foo-impl-unittest arbitatry.if not what the correct naming conventions.

I must admit that i found another recipe that was setting up ptest and tried to replicate it for my own recipe but clearly i am doing something wrong and do not understand the bigger picture. Would be great if i can get some answers to my questions and feedback/insights as to what i am missing here.

FooImpl package has the following directory structure

  • src
    • test
      • FooTest.cpp
      • CmakeLists.txt
    • CMakeLists.txt
    • Foo.cpp
  • CMakeLists.txt
  • .gitignore
bourne
  • 1,083
  • 4
  • 14
  • 27
  • When you do `cp -rf ${B}/test/foo-impl-unittest ...`, you are copying the compiled binary to its final place. In your CMakeLists.txt, what is the name of the binary you are creating? Also, are you creating it in `test` subfolder? Or just in the top of build (`${B}`) folder? – skandigraun Aug 23 '23 at 09:36
  • @skandigraun thank you so much for thsi information, this helped me get pass this current issue, i am still not able to run my test through ptest and encountering another issue, i have another question related to it [here] (https://stackoverflow.com/questions/76957250/having-issues-making-ptest-works-with-yocto) , incase you have any other helpful tips for me please do let me know. – bourne Aug 28 '23 at 04:16

0 Answers0