Unable to run tests in Fedora as part of a `mock` build in some cases due to what appears to be redirect issues
carlosrodfern opened this issue · 4 comments
How to reproduce:
This scenario works:
$ podman run -it fedora:rawhide
# dnf install -y diffutils mk-configure gcc zlib
# cd $HOME
# curl -LO https://github.com/cheusov/libmaa/archive/refs/tags/1.4.7/libmaa-1.4.7.tar.gz
# tar xf libmaa-1.4.7.tar.gz
# cd libmaa-1.4.7
# export export MKCOMPILERSETTINGS=yes
# mkcmake
# mkcmake test
This scenario doesn't (it does virtually the same but with mock
, see the libmaa.spec file):
$ podman run --privileged -it fedora:rawhide
# dnf install -y mock rpkg rpmdevtools
# cd $HOME
# curl -LO https://gitlab.com/carlosrodfern/rpms-libmaa/-/raw/main/libmaa.spec
# spectool -g libmaa.spec
# rpkg srpm --outdir .
# mock -r fedora-rawhide-x86_64 *.src.rpm
...
(cut for brevity)
--- test-tests/basics ---
0a1
> --- test_output ---
FAILED
*** [test] Error code 1
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/basics
1 error
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/basics
--- all-tests/stack ---
--- stacktest ---
--- all-tests/set ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- test-tests/basics ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- all-tests/stack ---
gcc -o stacktest stacktest.o -L/builddir/build/BUILD/libmaa-1.4.7/maa -lmaa -Wl,-z,relro -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld-errors -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-package-notes
--- all-tests/sl ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- test-tests/prime ---
1d0
< 10007
--- test-tests/memstr ---
1,14d0
< Statistics for string memory manager at 0xF00DBEAF
< 0 strings, using 0 bytes
< str1=Peter Hammill
< Statistics for string memory manager at 0xF00DBEAF
< 1 strings, using 14 bytes
< str2=King Crimson
< Statistics for string memory manager at 0xF00DBEAF
< 2 strings, using 27 bytes
< str3=Van Der Graaf Generator
< Statistics for string memory manager at 0xF00DBEAF
< 3 strings, using 51 bytes
< str4=Led Zeppelin
< Statistics for string memory manager at 0xF00DBEAF
< 4 strings, using 64 bytes
--- test-tests/prime ---
FAILED
*** [test] Error code 1
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/prime
1 error
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/prime
--- test-tests/memstr ---
FAILED
*** [test] Error code 1
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/memstr
1 error
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/memstr
--- test-tests/prime ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- all-tests/err ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- test-tests/memstr ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- all-tests/string ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- test-tests/log ---
0a1
> --- test_output ---
--- all-tests/hash ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- test-tests/log ---
FAILED
*** [test] Error code 1
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/log
1 error
bmake[1]: stopped in /builddir/build/BUILD/libmaa-1.4.7/tests/log
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- test-tests/memobj ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- all-tests/stack ---
...
This program built for x86_64-redhat-linux-gnu
Report bugs to <bug-make@gnu.org>
--- all-tests/prm ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
--- all-tests/stack ---
bmake: stopped in /builddir/build/BUILD/libmaa-1.4.7
error: Bad exit status from /var/tmp/rpm-tmp.J7KuaO (%check)
...
The mk-configure
in Fedora is built this way: https://src.fedoraproject.org/rpms/mk-configure/tree/rawhide
In the case of the basics
tests, for example, this is what's happening (notice the --- test_output ---
string that go into the output):
# cat /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILD/libmaa-1.4.7/tests/basics/expect.out
version: 999.999.999
# cat /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILD/libmaa-1.4.7/tests/basics/basics.test.out
--- test_output ---
version: 999.999.999
In the case of the memstr
test (the test output is totally missing):
# cat /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILD/libmaa-1.4.7/tests/memstr/expect.out
Statistics for string memory manager at 0xF00DBEAF
0 strings, using 0 bytes
str1=Peter Hammill
Statistics for string memory manager at 0xF00DBEAF
1 strings, using 14 bytes
str2=King Crimson
Statistics for string memory manager at 0xF00DBEAF
2 strings, using 27 bytes
str3=Van Der Graaf Generator
Statistics for string memory manager at 0xF00DBEAF
3 strings, using 51 bytes
str4=Led Zeppelin
Statistics for string memory manager at 0xF00DBEAF
4 strings, using 64 bytes
# cat /var/lib/mock/fedora-rawhide-x86_64/root/builddir/build/BUILD/libmaa-1.4.7/tests/memstr/memstr.test.out
(nothing)
So it appears to be an nondeterministic issue with the redirection of the tests outputs when we run it with mock
.
I'm currently looking into the root cause, and see if I can ensure the redirection mk-configure
sets up works in all scenarios. If anything rings the bell that can help to troubleshoot the issue please let me know. Thank you.
I figured it out. It is a concurrency issue. The tests can't be run with the %{?_smp_mflags}
flag.
I figured it out. It is a concurrency issue. The tests can't be run with the
%{?_smp_mflags}
flag.
It's well known issue. The target "configure" does not work in parallel. So, you have to build libmaa like the following:
mkcmake -j1 configure
mkcmake %{?_smp_mflags}
Also, it's safer to run tests with -j1 option.
mkcmake -j1 test
Thank you @cheusov. I removed the smp flag from the macro, and let the packager decides the parallelism part.
Thank you @cheusov. I removed the smp flag from the macro, and let the packager decides the parallelism part.
If you are interested, have a look at packaging of mk-configure and libmaa for OpenSuSE https://build.opensuse.org/package/show/devel:tools:building/mk-configure
https://build.opensuse.org/package/show/Education/libmaa