From dc523c0b91a71320faa981cc9d4c290feac1fc85 Mon Sep 17 00:00:00 2001 From: MatejKastak Date: Sat, 28 May 2022 19:47:57 +0200 Subject: [PATCH] Magic tests fix (#1714) * test: Relax pe32 condition in magic tests Turns out different versions of libmagic return different file identification for the PE32 sample in magic tests. Relax this condition to the common part of the identification to make tests less reliant on the testing platform. * test: Relax macho condition in magic tests --- tests/test-magic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test-magic.c b/tests/test-magic.c index adb0971e70..ff2f34c868 100644 --- a/tests/test-magic.c +++ b/tests/test-magic.c @@ -23,7 +23,7 @@ int main(int argc, char** argv) assert_true_rule_blob( "import \"magic\" rule test { condition: \ - magic.type() contains \"PE32\" and \ + magic.type() contains \"MS-DOS executable\" and \ magic.mime_type() == \"application/x-dosexec\" }", PE32_FILE); @@ -31,7 +31,7 @@ int main(int argc, char** argv) assert_true_rule_blob( "import \"magic\" rule test { condition: \ magic.type() contains \"Mach-O\" and \ - magic.mime_type() == \"application/x-mach-binary\" and \ + (magic.mime_type() == \"application/x-mach-binary\" or magic.mime_type() == \"application/octet-stream\") and \ magic.type() contains \"Mach-O\"}", MACHO_X86_FILE);