From bca5313af3368a78addedea55525b560c780b275 Mon Sep 17 00:00:00 2001 From: WorksButNotTested <62701594+WorksButNotTested@users.noreply.github.com> Date: Wed, 2 Apr 2025 14:53:29 +0100 Subject: [PATCH 1/2] Skip slow tests --- tests/test-compiler.vala | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/tests/test-compiler.vala b/tests/test-compiler.vala index 95204d31a..ccdb3c84a 100644 --- a/tests/test-compiler.vala +++ b/tests/test-compiler.vala @@ -13,7 +13,7 @@ namespace Frida.CompilerTest { namespace Performance { private static async void build_simple_agent (Harness h) { - if (Frida.Test.os () == Frida.Test.OS.IOS && !GLib.Test.slow ()) { + if (skip_slow_test ()) { stdout.printf (" "); h.done (); return; @@ -70,7 +70,7 @@ namespace Frida.CompilerTest { } private static async void watch_simple_agent (Harness h) { - if (Frida.Test.os () == Frida.Test.OS.IOS && !GLib.Test.slow ()) { + if (skip_slow_test ()) { stdout.printf (" "); h.done (); return; @@ -137,6 +137,30 @@ namespace Frida.CompilerTest { h.done (); } + + private static bool skip_slow_test () { + if (GLib.Test.slow ()) { + return false; + } + + if (Frida.Test.os () == Frida.Test.OS.IOS) { + return true; + } + + /* + * If we are running on a big-endian ARM system, we are very likely running + * in an emulator. So skip the slow tests unless the user explicitly asks + * for them at the command line. + */ + if (Frida.Test.cpu () == Frida.Test.CPU.ARM_32 || Frida.Test.cpu () == Frida.Test.CPU.ARM_64) + { + if (GLib.ByteOrder.HOST == GLib.ByteOrder.BIG_ENDIAN) { + return true; + } + } + + return false; + } } private class Harness : Frida.Test.AsyncHarness { From ad402e9d99bd40c1cee8a996d2c8eb043de2bf70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Andr=C3=A9=20Vadla=20Ravn=C3=A5s?= Date: Thu, 17 Apr 2025 14:45:31 +0200 Subject: [PATCH 2/2] Tweak style --- tests/test-compiler.vala | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/tests/test-compiler.vala b/tests/test-compiler.vala index ccdb3c84a..5bdafb359 100644 --- a/tests/test-compiler.vala +++ b/tests/test-compiler.vala @@ -139,24 +139,22 @@ namespace Frida.CompilerTest { } private static bool skip_slow_test () { - if (GLib.Test.slow ()) { + if (GLib.Test.slow ()) return false; - } - if (Frida.Test.os () == Frida.Test.OS.IOS) { + if (Frida.Test.os () == Frida.Test.OS.IOS) return true; - } - /* - * If we are running on a big-endian ARM system, we are very likely running - * in an emulator. So skip the slow tests unless the user explicitly asks - * for them at the command line. - */ - if (Frida.Test.cpu () == Frida.Test.CPU.ARM_32 || Frida.Test.cpu () == Frida.Test.CPU.ARM_64) - { - if (GLib.ByteOrder.HOST == GLib.ByteOrder.BIG_ENDIAN) { - return true; + switch (Frida.Test.cpu ()) { + case ARM_32: + case ARM_64: { + bool likely_running_in_an_emulator = ByteOrder.HOST == ByteOrder.BIG_ENDIAN; + if (likely_running_in_an_emulator) + return true; + break; } + default: + break; } return false;