tests: strip macOS "-unsigned" suffix from binary name
PATCH 1/1 tests: strip macOS "-unsigned" suffix from binary name
On macOS, plain QEMU binaries are named qemu-system-<arch>-unsigned.
In libqtest, qtest_get_arch() extracts the architecture by splitting after "-system-", which yields "arm-unsigned" instead of "arm". This prevents the QOS graph from matching any machine node, causing all QOS-based tests to be silently skipped.
In the functional test framework, the same suffix causes the arch to be parsed as "unsigned", leading to wrong output directories and teardown failures.
Strip the "-unsigned" suffix on both code paths.
---
Address issues with liqtest and functional test framework when run from a macOS host.
Unsigned binaries on macOS may be appended an -unsigned suffix, which confuse these components that rely on the binary name to recover the guest architecture.
--- tests/functional/qemu_test/testcase.py | 2 ++ tests/qtest/libqtest.c | 6 ++++++ 2 files changed, 8 insertions(+)
tests/functional/qemu_test/testcase.py +2 -0
@@ -204,6 +204,8 @@ def setUp(self): self.qemu_bin = os.getenv('QEMU_TEST_QEMU_BINARY') self.assertIsNotNone(self.qemu_bin, 'QEMU_TEST_QEMU_BINARY must be set') self.arch = self.qemu_bin.split('-')[-1] + if sys.platform == 'darwin' and self.arch == "unsigned": + self.arch = self.qemu_bin.split('-')[-2] self.socketdir = None self.outputdir = self.build_file('tests', 'functional',
tests/qtest/libqtest.c +6 -0
@@ -1033,6 +1033,12 @@ const char *qtest_get_arch(void)g_auto (GStrv) tokens =g_strsplit_set (sysstr +strlen ("-system-" )," \t" ,2 );if (tokens && tokens[0 ]) { +#ifdef __APPLE__ +if (g_str_has_suffix (tokens[0 ],"-unsigned" )) { + tokens[0 ][strlen (tokens[0 ]) + -strlen ("-unsigned" )] ='\0' ; + } +#endif arch =g_steal_pointer (&tokens[0 ]); } }
---
base-commit: cc329c491768b2d91eb0b0984f3baa0bf805776d
change-id: 20260608-testing-macos-b95676cd3f86
Best regards,
Signature · 1 line
Emmanuel Blot <[email protected]>
Quoted 14 lines · Emmanuel Blot
On macOS, plain QEMU binaries are named qemu-system-<arch>-unsigned.
In libqtest,
qtest_get_arch()extracts the architecture by splitting after "-system-", which yields "arm-unsigned" instead of "arm". This prevents the QOS graph from matching any machine node, causing all QOS-based tests to be silently skipped.In the functional test framework, the same suffix causes the arch to be parsed as "unsigned", leading to wrong output directories and teardown failures.
Strip the "-unsigned" suffix on both code paths.
Quoted 8 lines
Signed-off-by Emmanuel Blot <[email protected]>---
Address issues with liqtest and functional test framework when run from a macOS host.Unsigned binaries on macOS may be appended an
-unsignedsuffix, which confuse these components that rely on the binary name to recover the guest architecture.
I still think this not the right thing to do. The "make" process on macos should produce and sign the binary in-place in the build tree, so that users and test cases don't have to care about this macos specific weirdness. (If the signing is location-specific and we need to sign again for "make install" that's fine. But we should produce a working binary with the usual name in the build tree, not a non-working one or one with a nonstandard name.)
See also this earlier thread:
https://lore.kernel.org/qemu-devel/CAFEAcA_txOHPLK+J546yjCmOEv0-ptaVkCEk5GfeL13DdqQd-w@mail.gmail.com/
thanks
-- PMM
Quoted 24 lines · Peter Maydell
Quoted 14 lines · Emmanuel Blot
On macOS, plain QEMU binaries are named qemu-system-<arch>-unsigned.
In libqtest,
qtest_get_arch()extracts the architecture by splitting after "-system-", which yields "arm-unsigned" instead of "arm". This prevents the QOS graph from matching any machine node, causing all QOS-based tests to be silently skipped.In the functional test framework, the same suffix causes the arch to be parsed as "unsigned", leading to wrong output directories and teardown failures.
Strip the "-unsigned" suffix on both code paths.
Quoted 8 lines
Signed-off-by Emmanuel Blot <[email protected]>---
Address issues with liqtest and functional test framework when run from a macOS host.Unsigned binaries on macOS may be appended an
-unsignedsuffix, which confuse these components that rely on the binary name to recover the guest architecture.
Quoted 8 lines
I still think this not the right thing to do. The "make" process on macos should produce and sign the binary in-place in the build tree, so that users and test cases don't have to care about this macos specific weirdness. (If the signing is location-specific and we need to sign again for "make install" that's fine. But we should produce a working binary with the usual name in the build tree, not a non-working one or one with a nonstandard name.)
Yes, I was just about to write similar when I saw your message. We should not have this custom "-unsigned" name in the build tree as specialcases like this break too many expectations, especially when most devs aren't ever testing for macOS and so won't see the special case.
With regards,
Daniel
Signature · 3 lines
|: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :|
Quoted 35 lines · Daniel P. Berrangé
Quoted 24 lines · Peter Maydell
Quoted 14 lines · Emmanuel Blot
On macOS, plain QEMU binaries are named qemu-system-<arch>-unsigned.
In libqtest,
qtest_get_arch()extracts the architecture by splitting after "-system-", which yields "arm-unsigned" instead of "arm". This prevents the QOS graph from matching any machine node, causing all QOS-based tests to be silently skipped.In the functional test framework, the same suffix causes the arch to be parsed as "unsigned", leading to wrong output directories and teardown failures.
Strip the "-unsigned" suffix on both code paths.
Quoted 8 lines
Signed-off-by Emmanuel Blot <[email protected]>---
Address issues with liqtest and functional test framework when run from a macOS host.Unsigned binaries on macOS may be appended an
-unsignedsuffix, which confuse these components that rely on the binary name to recover the guest architecture.Quoted 8 lines
I still think this not the right thing to do. The "make" process on macos should produce and sign the binary in-place in the build tree, so that users and test cases don't have to care about this macos specific weirdness. (If the signing is location-specific and we need to sign again for "make install" that's fine. But we should produce a working binary with the usual name in the build tree, not a non-working one or one with a nonstandard name.)
Quoted 5 lines
Yes, I was just about to write similar when I saw your message. We should not have this custom "-unsigned" name in the build tree as specialcases like this break too many expectations, especially when most devs aren't ever testing for macOS and so won't see the special case.
I think it's OK to have the -unsigned binary as an interim step, where we compile to qemu-foo-unsigned and then immediately sign to produce qemu-foo. The problem is that "make" is for some reason not actually doing the signing step. Alex notes in that other thread that you can make it do the signing part by manually running "make qemu-system-aarch64". We just don't have this working correctly so that "make all" does it.
-- PMM
Ok thanks, got it.
I need to use ninja -C build qemy-system-arm to generate the signed binary, because the default target only generates the -unsigned version (I guess this is the linker's default output, macOS requires an extra signing step).
The signed version is defined as an on-demand command which is not part of the default build (all).
Quoted 53 lines · Peter Maydell
Quoted 2 lines
Quoted 35 lines · Daniel P. Berrangé
Quoted 24 lines · Peter Maydell
Quoted 14 lines · Emmanuel Blot
On macOS, plain QEMU binaries are named qemu-system-<arch>-unsigned.
In libqtest,
qtest_get_arch()extracts the architecture by splitting after "-system-", which yields "arm-unsigned" instead of "arm". This prevents the QOS graph from matching any machine node, causing all QOS-based tests to be silently skipped.In the functional test framework, the same suffix causes the arch to be parsed as "unsigned", leading to wrong output directories and teardown failures.
Strip the "-unsigned" suffix on both code paths.
Quoted 8 lines
Signed-off-by Emmanuel Blot <[email protected]>---
Address issues with liqtest and functional test framework when run from a macOS host.Unsigned binaries on macOS may be appended an
-unsignedsuffix, which confuse these components that rely on the binary name to recover the guest architecture.Quoted 8 lines
I still think this not the right thing to do. The "make" process on macos should produce and sign the binary in-place in the build tree, so that users and test cases don't have to care about this macos specific weirdness. (If the signing is location-specific and we need to sign again for "make install" that's fine. But we should produce a working binary with the usual name in the build tree, not a non-working one or one with a nonstandard name.)
Quoted 5 lines
Yes, I was just about to write similar when I saw your message. We should not have this custom "-unsigned" name in the build tree as specialcases like this break too many expectations, especially when most devs aren't ever testing for macOS and so won't see the special case.
I think it's OK to have the -unsigned binary as an interim step, where we compile to qemu-foo-unsigned and then immediately sign to produce qemu-foo. The problem is that "make" is for some reason not actually doing the signing step. Alex notes in that other thread that you can make it do the signing part by manually running "make qemu-system-aarch64". We just don't have this working correctly so that "make all" does it.
-- PMM
Quoted 9 lines · Emmanuel Blot
Ok thanks, got it.
I need to use
ninja -C build qemy-system-armto generate the signed binary, because the default target only generates the-unsignedversion (I guess this is the linker's default output, macOS requires an extra signing step).
The signed version is defined as an on-demand command which is not part of the default build (all).
Right, this is the bug that needs fixing. The default target should build the signed binary.
-- PMM
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Emmanuel Blot
Ok thanks, got it.
I need to use
ninja -C build qemy-system-armto generate the signed binary, because the default target only generates the-unsignedversion (I guess this is the linker's default output, macOS requires an extra signing step).
The signed version is defined as an on-demand command which is not part of the default build (all).
Quoted 5 lines
Right, this is the bug that needs fixing. The default target should build the signed binary.
-- PMM
For information, I recently offered to Alex to do a rewrite of tcg makefiles in meson natively. It's not the first time, and certainly not the last time, that we waste hours/days debugging dependencies there, this has to stop.
After this weekend, I am close from a proof of concept covering aarch64 and multiarch tests. It fixes any issue we had with dependencies, among other improvements.
So hopefully the fix for that will be to wait for the meson version. If anyone wants to spend cycle and fix existing Makefiles, feel free to do it also, but they will be gone at some point.
Regards,
Pierrick
Quoted 13 lines · Pierrick Bouvier
Quoted 11 lines · Peter Maydell
Quoted 9 lines · Emmanuel Blot
Ok thanks, got it.
I need to use
ninja -C build qemy-system-armto generate the signed binary, because the default target only generates the-unsignedversion (I guess this is the linker's default output, macOS requires an extra signing step).
The signed version is defined as an on-demand command which is not part of the default build (all).
Quoted 7 lines
Quoted 2 lines
Right, this is the bug that needs fixing. The default target should build the signed binary.
For information, I recently offered to Alex to do a rewrite of tcg makefiles in meson natively. It's not the first time, and certainly not the last time, that we waste hours/days debugging dependencies there, this has to stop.
This isn't related at all to the TCG makefiles, though. It's purely an issue with the main meson build files (which is why it's shown up here with the qtest tests).
thanks
-- PMM