Some tests are broken when built in tree

17 views
Skip to first unread message

Mark Jonas

unread,
Jun 7, 2025, 12:25:41 PM6/7/25
to swupdate, Daniel Braunwarth, Stefano Babic
Hi Daniel and Stefano,

When making an in tree build and then running for example the
mbedtls_defconfig tests the following error occurs:

# make mbedtls_defconfig
# make
# make tests
RUN FileNotFoundTest
1+0 records in
1+0 records out
1024 bytes (1.0 kB, 1.0 KiB) copied, 4.5295e-05 s, 22.6 MB/s
RUN CrapFileTest
MKSWU scripts/acceptance-tests/ImgNameError.swu
sw-description
hello.txt
2 blocks
RUN ImgNameErrorTest
RUN InvOptsNoImg
RUN InvOptsCheckWithWeb
tests passed
CC test/test_crypt.o
CC test/test_hash.o
cp: cannot copy a directory, '/mnt/test/data', into itself,
'/mnt/test/data/data'
make[1]: *** [/mnt/test/Makefile:95: PREPARE_DATA] Error 1
make: *** [Makefile:504: test] Error 2

I bisected the problem.

60d90b59b0d9f5e4bc94da01b51305aad66f9001 is the first bad commit
commit 60d90b59b0d9f5e4bc94da01b51305aad66f9001
Author: Daniel Braunwarth <o...@braunwarth.dev>
Date: Sun Feb 23 17:38:47 2025 +0100

test: copy test data from source to build path

For out-of-tree builds the test data should be copied to build
directory. This makes it easier for the actual tests to use the correct
path.

@Daniel Would it be possible for you to send a fix for the regression?

The following tests are probably all broken because of the same reason.

mbedtls_defconfig
with_lua_handlers_defconfig
with_systemd_defconfig
with_rdiff_defconfig
with_ebg_defconfig
without_lua_defconfig
suricatta_all_modules_defconfig
with_lua_nohandlers_defconfig
without_libconfig_defconfig
test_defconfig

Cheers,
Mark

Daniel Braunwarth

unread,
Jun 8, 2025, 12:23:42 PM6/8/25
to Mark Jonas, swupdate, Stefano Babic
Hi Mark
GitHub CI is pretty happy:
https://github.com/sbabic/swupdate/actions/runs/15460960262/job/43522033485#step:5:1871

And I cannot reproduce this on my local setup, too.

Must be a problem related to your local setup.



Regards
Daniel

Mark Jonas

unread,
Jun 8, 2025, 1:46:32 PM6/8/25
to Daniel Braunwarth, swupdate, Stefano Babic
Hi Daniel,

Thanks for looking into this. I think GitHub CI is happy because it
does an out-of-tree build. And I see the problem when doing an
in-tree-build.

You patch https://github.com/sbabic/swupdate/commit/60d90b59b0d9f5e4bc94da01b51305aad66f9001
adds the following copy command:

$(Q)cp -r $(srctree)/test/data $(objtree)/test/data

And that looks like a very good match to the error message I get:

cp: cannot copy a directory, '/mnt/test/data', into itself,
'/mnt/test/data/data'

To fix the problem the cp must be skipped if $(srctree) and $(objtree)
point to the same directory. The fix:

$(Q)[ "$(srctree)" -ef "$(objtree)" ] || cp -r $(srctree)/test/data
$(objtree)/test/data

I'll send a patch in a few minutes.

Cheers,
Mark

Stefano Babic

unread,
Jun 8, 2025, 1:49:49 PM6/8/25
to Daniel Braunwarth, Mark Jonas, swupdate
Hi Mark,Daniel,
I could reproduce once, and the cause is in test/Makefile:

PHONY += PREPARE_DATA
PREPARE_DATA:
$(Q)cp -r $(srctree)/test/data $(objtree)/test/data

when srctree == objtree, cp returns with error. It should be enough to
make a check before.

Regards,
Stefano
Reply all
Reply to author
Forward
0 new messages