Closed Adnan-Elhammoudi closed 6 months ago
Hi, author of test/py/tests/test_cleanup_build.py
here.
This portion of your test case
build_dir = lb.workdir
# ...
uboot.testpy(
build_dir,
causes that tbots hook script directory "$workdir/uboot-testpy-tbot" becomes a subdirectory of build_dir
. test_cleanup_build.py
recursively copies build_dir
, which now accidentally contains named pipes from the hooks scripts. Named pipes can't be copied with shutil.copytree
, thus the exception.
The immediate solution is to keep hook scripts out of the U-Boot build directory, e.g. by using build_dir = lb.workdir / "u-boot"
.
I'm afraid this won't suffice though. I wrote test_cleanup_build.py
under the assumption that U-Boots test/py/test.py
always has an out-of-source U-Boot build. See commit 42c0e5b for reasoning. tbot on the other hand seems to expect an in-source build. See how it calls ./test/py/test.py --build-dir .
. This is incompatible, test_cleanup_build.py
will fail when running against in-source builds. As both expectations are hard coded, I don't see a solution other than changing either tbot or U-Boot code.
@rahix What do you think? Is there a way to configure an out-of-source U-Boot build directory for tbot_contrib.uboot.testpy
right now? If not, would it be feasible to implement it by extending the API like uboot.testpy(source_dir, build_dir, ...)
?
There are a number of things here to unpack. First of all, regarding your original question @Adnan-Elhammoudi: As @haxtibal correctly identified, this section of the testcase code is not right:
build_dir = lb.workdir
# ...
uboot.testpy(
build_dir,
You really should not use your U-Boot source directory as the workdir for tbot. tbot expects that it can just dump a lot of files into the workdir and that is bound to lead to problems when the workdir is really a U-Boot source tree. The structure should look like this instead, as was suggested above as well:
+-workdir/
|
+-u-boot/
And then your code becomes
build_dir = lb.workdir / "u-boot"
# ...
uboot.testpy(
build_dir,
This should solve the problem of trying to copy FIFO files.
Now regarding your message @haxtibal: I think both sides need to improve here:
I wrote test_cleanup_build.py under the assumption that U-Boots test/py/test.py always has an out-of-source U-Boot build.
I think this must not be assumed. I think the easiest solution is to just skip your tests when an in-source build is performed. This will allow people to run tests against a board "the easy way" (where they probably don't care about your buildsystem tests) and in the U-Boot CI, your tests continue to run normally as part of an out-of-tree build.
If not, would it be feasible to implement it by extending the API like
uboot.testpy(source_dir, build_dir, ...)
?
On the other hand I agree that this needs to happen just as much so people can use the test/py
wrapper in environments where they build out-of-tree.
I've opened #108 for the out-of-tree support in contrib.uboot.testpy
.
Thank you for your reply @haxtibal @Rahix
I have changed the working directory as suggested, and now I am getting an assert error for test_clean and test_mrproper below.
My problem has been extended because certain tests, located in the test/py/tests/ directory, are hanging and producing an error that says "channel is currently borrowed by another machine," which is described in issue #106 . I have excluded a list of the tests that are causing this issue, and I have excluded them from further testing. I noticed that most of these tests are utilizing the boardenv.
...boot/scene_internal.h, net/arp.h, net/wol.h, net/bootp.h, net/eth_internal.h, net/dhcpv6.h, net/cdp.h, net/link_local.h, net/net_rand.h, net/rarp.h, net/nfs.h, net/ping.h, net/dns.h
│ │ │ │ ## E assert not [PosixPath('api/api.c'), PosixPath('api/api_net.c'), PosixPath('api/api_platform-powerpc.c'), PosixPath('api/api_platform-mips.c'), PosixPath('api/api_platform-arm.c'), PosixPath('api/api_storage.c'), ...]
│ │ │ │ ## ----------------------------------------- Captured stdout call ------------------------------------------
│ │ │ │ ## +make O=/tmp/pytest-of-adnanelhammoudi/pytest-33/test_mrproper0 mrproper
│ │ │ │ ## make[1]: Entering directory '/tmp/pytest-of-adnanelhammoudi/pytest-33/test_mrproper0'
│ │ │ │ ## CLEAN dts/../arch/arm/dts
│ │ │ │ ## CLEAN dts
│ │ │ │ ## CLEAN lib/efi_loader
│ │ │ │ ## CLEAN tools
│ │ │ │ ## CLEAN tools/generated
│ │ │ │ ## CLEAN include/autoconf.mk include/autoconf.mk.dep include/bmp_logo.h include/bmp_logo_data.h include/config.h include/generated/env.in include/generated/env.txt drivers/video/u_boot_logo.S u-boot-nodtb.bin u-boot.lds u-boot.map u-boot.cfg u-boot.bin u-boot.srec u-boot u-boot.sym System.map
│ │ │ │ ## CLEAN scripts/basic
│ │ │ │ ## CLEAN scripts/dtc
│ │ │ │ ## CLEAN scripts/kconfig
│ │ │ │ ## CLEAN include/config include/generated
│ │ │ │ ## CLEAN .config .config.old
│ │ │ │ ## make[1]: Leaving directory '/tmp/pytest-of-adnanelhammoudi/pytest-33/test_mrproper0'
│ │ │ │ ## ======================================== short test summary info ========================================
│ │ │ │ ## FAILED test/py/tests/test_cleanup_build.py::test_clean - AssertionError: leftovers: api/api.c, api/api...
│ │ │ │ ## FAILED test/py/tests/test_cleanup_build.py::test_mrproper - AssertionError: leftovers: api/api.c, api/...
│ │ │ │ ## ============================ 2 failed, 204 skipped, 223 deselected in 9.05s =============================
│ │ │ └─Fail. (9.976s)
│ │ ├─POWEROFF (imx8q)
│ │ └─Fail. (11.495s)
FAILED
@Rahix
I think this must not be assumed. I think the easiest solution is to just skip your tests when an in-source build is performed. This will allow people to run tests against a board "the easy way" (where they probably don't care about your buildsystem tests) and in the U-Boot CI, your tests continue to run normally as part of an out-of-tree build.
Agreed. Just submitted a patch to U-Boot.
@Adnan-Elhammoudi
now I am getting an assert error for test_clean and test_mrproper below.
Yes, that's what I've said above with "I'm afraid this won't suffice though [...]". Your options as of now are
-k not (test_clean or test_mrproper)
.certain tests [...] are hanging and producing an error that says "channel is currently borrowed by another machine,"
I've not looked into it, but my guess would be it's unrelated to the build directory stuff we just discussed here in #107.
I've not looked into it, but my guess would be it's unrelated to the build directory stuff we just discussed here in https://github.com/Rahix/tbot/issues/107.
This is true.