[PATCH] test_sack: fix number of arches if "athlon" if not available
authorFrédéric Pierret (fepitre) <frederic.pierret@qubes-os.org>
Sun, 1 Nov 2020 12:32:10 +0000 (13:32 +0100)
committerFrédéric Pierret <frederic.pierret@qubes-os.org>
Wed, 14 Apr 2021 19:26:57 +0000 (20:26 +0100)
It's the case for Debian and openSUSE

Gbp-Pq: Name 0010-test_sack-fix-number-of-arches-if-athlon-if-not-avai.patch

tests/hawkey/test_sack.cpp

index 5eab83b3f579fbdb618d6407659963c975eaea79..e528cd94cd9f3be36880ad406757be9234a7bf75 100644 (file)
@@ -83,14 +83,25 @@ START_TEST(test_list_arches)
     const char ** arches = dnf_sack_list_arches(sack);
 
     /* noarch, x86_64, athlon, i686, i586, i486, i386 */
-    fail_unless(g_strv_length((gchar**)arches) == 7);
+    fail_unless(g_strv_length((gchar**)arches) >= 6 && g_strv_length((gchar**)arches) <= 7);
 
-    if (strcmp(arches[2], "athlon") == 0) {
+    if (g_strv_length((gchar**)arches) == 7) {
         // Fedora, Mageia
+        ck_assert_str_eq(arches[0], "noarch");
+        ck_assert_str_eq(arches[1], "x86_64");
+        ck_assert_str_eq(arches[2], "athlon");
         ck_assert_str_eq(arches[3], "i686");
+        ck_assert_str_eq(arches[4], "i586");
+        ck_assert_str_eq(arches[5], "i486");
+        ck_assert_str_eq(arches[6], "i386");
     } else {
-        // openSUSE - "athlon" is not available
+        // openSUSE, Debian - "athlon" is not available
+        ck_assert_str_eq(arches[0], "noarch");
+        ck_assert_str_eq(arches[1], "x86_64");
+        ck_assert_str_eq(arches[2], "i686");
         ck_assert_str_eq(arches[3], "i586");
+        ck_assert_str_eq(arches[4], "i486");
+        ck_assert_str_eq(arches[5], "i386");
     }
 
     g_free(arches);