From c6a7c0199cd138196ea8b2a21c42af555688d0a2 Mon Sep 17 00:00:00 2001 From: Jason Tibbitts Date: Fri, 2 Jun 2017 16:50:48 -0500 Subject: [PATCH] Fix enianness issues, enable more tests. Both test suites are now run on all architectures. A few Cassandane tests need to be excluded on 32-bit and big-endian architectures, but the built-in test suite passes in its entirety and the vast majority of Cassandane runs just fine. --- cyrus-imapd.spec | 161 +++++++++++++++++++----------- patch-cyrus-fix-endianness-checks | 66 ++++++++++++ 2 files changed, 170 insertions(+), 57 deletions(-) create mode 100644 patch-cyrus-fix-endianness-checks diff --git a/cyrus-imapd.spec b/cyrus-imapd.spec index 6b9d140..40e960d 100644 --- a/cyrus-imapd.spec +++ b/cyrus-imapd.spec @@ -9,7 +9,7 @@ Name: cyrus-imapd Version: 3.0.1 -Release: 1%{?dist} +Release: 2%{?dist} %define ssl_pem_file /etc/pki/%name/%name.pem @@ -31,6 +31,7 @@ Patch1: patch-cyrus-testsuite-endianness2 Patch2: patch-cyrus-testsuite-endianness3 Patch3: patch-cyrus-testsuite-endianness4 Patch4: patch-cyrus-autoreconf-keep-version +Patch5: patch-cyrus-fix-endianness-checks Source10: cyrus-imapd.logrotate Source11: cyrus-imapd.pam-config @@ -399,14 +400,12 @@ find %buildroot -name ".packlist" -exec rm {} \; %check -# The test suite fails on big-endian machines currently. This is tracked at -# https://github.com/cyrusimap/cyrus-imapd/issues/1993 -%ifnarch s390x ppc64 make %{?_smp_mflags} check || exit 1 + +%if %{without cassandane} +exit 0 %endif -%if %{with cassandane} -%ifnarch s390x ppc64 i686 armv7hl # Run the Cassandane test suite. This will exhaustively test the various # server components, but running it in a mock chroot is rather an exercise. # Sadly Cassandane simply can't run on a 32-bit host at the moment. It needs @@ -432,62 +431,105 @@ export CYRUS_USER=$USER # Most Cassandane tests pass, but using snapshots includes new tests which # aren't supposed to pass on released versions of cyrus. So we have a big # exclusion list. + # Note that Cassandane::Test::Core must always be excluded; it can't possibly # work. The others are expected on 3.0.1 and should be removed and re-checked # at each release. - #!JMAPCalendars.creationids \ +exclude=('!Cassandane::Test::Core') + +tests=( + Admin.imap_admins Fetch.fetch_flags_before_exists Quota.num_folders_rename + SearchFuzzy.cjk_words SearchFuzzy.xattachmentname +) +for i in ${tests[@]}; do exclude+=("!$i"); done + +tests=( + creationids + getcalendareventlist + getcalendareventlist_date + getcalendareventlist_datetime + getcalendareventlist_text + getcalendarevents_privacy + getcalendarevents_properties + getcalendarevents_relatedto + getcalendarevents_simple + getcalendareventupdates + setcalendarevents_alerts + setcalendarevents_caldav + setcalendarevents_endtimezone + setcalendarevents_endtimezone_recurrence + setcalendarevents_isallday + setcalendarevents_links + setcalendarevents_localizations + setcalendarevents_locations + setcalendarevents_move + setcalendarevents_participantid + setcalendarevents_participants + setcalendarevents_prodid + setcalendarevents_recurrenceoverrides + setcalendarevents_relatedto + setcalendarevents_recurrence + setcalendarevents_schedule_cancel + setcalendarevents_schedule_reply + setcalendarevents_schedule_request + setcalendarevents_simple +) +for i in ${tests[@]}; do exclude+=("!JMAPCalendars.$i"); done + +tests=( + getmessagelist_attachments + getmessagelist_window + getmessages_attachment_name + getmessages_body_nontext + setmailboxes_destroy_empty + setmessages_attachments +) +for i in ${tests[@]}; do exclude+=("!JMAPMail.$i"); done + +%ifarch ppc64 s390x +# Some failures only on little-endian machines for some reason +tests=( + ClamAV.remove_infected # Only on ppc64, actually + JMAPContacts.getcontactgroupupdates + JMAPContacts.getcontactupdates + JMAPMail.getmailboxupdates + JMAPMail.getmessageupdates + JMAPMail.getthreadupdates +) +for i in ${tests[@]}; do exclude+=("!$i"); done +%endif + +%ifarch i686 armv7hl +# Some additional failures only on 32-bit machines. +# 14 failures are due to Fedora's perl not supporting quad types in unpack. +# This is due to be fixed in rawhide soon, so some of these can go away. +tests=( + JMAPContacts.setcontacts_importance_later + Metadata.expunge_messages + Metadata.msg_replication_new_mas_partial_wwd + Metadata.msg_replication_new_rep + Metadata.msg_replication_new_mas + Metadata.msg_replication_exp_bot + Metadata.msg_replication_new_mas_partial_wwsw + Metadata.msg_replication_exp_mas + Metadata.msg_replication_mod_mas + Metadata.msg_replication_exp_rep + Metadata.msg_replication_mod_bot_msl + Metadata.msg_replication_new_bot_mse_gul + Metadata.msg_replication_mod_bot_msh + Metadata.msg_replication_new_bot_mse_guh + Metadata.msg_replication_mod_rep + Reconstruct.reconstruct_removedfile + Reconstruct.reconstruct_truncated + Reconstruct.reconstruct_zerouid + Quota.reconstruct + Quota.reconstruct_orphans +) +for i in ${tests[@]}; do exclude+=("!$i"); done +%endif # Add -vvv for too much output -./testrunner.pl %{?_smp_mflags} -f pretty \ - !Cassandane::Test::Core \ - !Admin.imap_admins \ - !Fetch.fetch_flags_before_exists \ -\ - !JMAPCalendars.creationids \ - !JMAPCalendars.getcalendareventlist \ - !JMAPCalendars.getcalendareventlist_date \ - !JMAPCalendars.getcalendareventlist_datetime \ - !JMAPCalendars.getcalendareventlist_text \ - !JMAPCalendars.getcalendarevents_privacy \ - !JMAPCalendars.getcalendarevents_properties \ - !JMAPCalendars.getcalendarevents_relatedto \ - !JMAPCalendars.getcalendarevents_simple \ - !JMAPCalendars.getcalendareventupdates \ -\ - !JMAPCalendars.setcalendarevents_alerts \ - !JMAPCalendars.setcalendarevents_caldav \ - !JMAPCalendars.setcalendarevents_endtimezone \ - !JMAPCalendars.setcalendarevents_endtimezone_recurrence \ - !JMAPCalendars.setcalendarevents_isallday \ - !JMAPCalendars.setcalendarevents_links \ - !JMAPCalendars.setcalendarevents_localizations \ - !JMAPCalendars.setcalendarevents_locations \ - !JMAPCalendars.setcalendarevents_move \ - !JMAPCalendars.setcalendarevents_participantid \ - !JMAPCalendars.setcalendarevents_participants \ - !JMAPCalendars.setcalendarevents_prodid \ - !JMAPCalendars.setcalendarevents_recurrenceoverrides \ - !JMAPCalendars.setcalendarevents_relatedto \ - !JMAPCalendars.setcalendarevents_recurrence \ - !JMAPCalendars.setcalendarevents_schedule_cancel \ - !JMAPCalendars.setcalendarevents_schedule_reply \ - !JMAPCalendars.setcalendarevents_schedule_request \ - !JMAPCalendars.setcalendarevents_simple \ -\ - !JMAPMail.getmessagelist_attachments \ - !JMAPMail.getmessagelist_window \ - !JMAPMail.getmessages_body_nontext \ - !JMAPMail.getmessages_attachment_name \ - !JMAPMail.setmailboxes_destroy_empty \ - !JMAPMail.setmessages_attachments \ -\ - !Quota.num_folders_rename \ - !SearchFuzzy.cjk_words \ - !SearchFuzzy.xattachmentname \ - 2>&1 - -%endif -%endif +./testrunner.pl %{?_smp_mflags} -f pretty ${exclude[@]} 2>&1 %pre @@ -581,6 +623,11 @@ getent passwd cyrus >/dev/null || /usr/sbin/useradd -c "Cyrus IMAP Server" -d /v %changelog +* Fri Jun 02 2017 Jason L Tibbitts III - 3.0.1-2 +- Add patch to fix up some endianness issues. +- Enable both test suites on all architectures. +- Add arch-specific excludes for a few Cassandane tests. + * Thu Apr 20 2017 Jason L Tibbitts III - 3.0.1-1 - Initial attempt at importing 3.0. Many new dependencies. - Use a stock sample imapd.conf file instead of a Fedora-provided one. diff --git a/patch-cyrus-fix-endianness-checks b/patch-cyrus-fix-endianness-checks new file mode 100644 index 0000000..7d518b2 --- /dev/null +++ b/patch-cyrus-fix-endianness-checks @@ -0,0 +1,66 @@ +diff --git a/lib/crc32.c b/lib/crc32.c +index c42e7d6..4193f0f 100644 +--- a/lib/crc32.c ++++ b/lib/crc32.c +@@ -611,7 +611,7 @@ static const uint32_t crc32_lookup[16][256] = + } + }; + +-#ifndef LITTLE_ENDIAN ++#if BYTE_ORDER != LITTLE_ENDIAN + /* swap endianness */ + static uint32_t swap(uint32_t x) + { +@@ -634,7 +634,7 @@ static uint32_t crc32_slice8(uint32_t prev, const void *data, size_t length) + + /* process eight bytes at once (Slicing-by-8) */ + while (length >= 8) { +-#ifdef LITTLE_ENDIAN ++#if BYTE_ORDER == LITTLE_ENDIAN + uint32_t one = *current++ ^ crc; + uint32_t two = *current++; + crc = crc32_lookup[0][(two>>24) & 0xFF] ^ +@@ -682,7 +682,7 @@ static uint32_t crc32_slice16(uint32_t prev, const void *data, size_t length) + while (length >= bytes_at_once) { + size_t unrolling; + for (unrolling = 0; unrolling < unroll; unrolling++) { +-#ifdef LITTLE_ENDIAN ++#if BYTE_ORDER == LITTLE_ENDIAN + uint32_t one = *current++ ^ crc; + uint32_t two = *current++; + uint32_t three = *current++; +diff --git a/lib/crc32c.c b/lib/crc32c.c +index e33e793..66fc16e 100644 +--- a/lib/crc32c.c ++++ b/lib/crc32c.c +@@ -591,7 +591,7 @@ static const uint32_t crc32c_lookup[4][256] = { + }, + }; + +-#ifndef LITTLE_ENDIAN ++#if BYTE_ORDER != LITTLE_ENDIAN + /* swap endianness */ + static uint32_t swap(uint32_t x) + { +@@ -615,7 +615,7 @@ static uint32_t crc32c_sw(uint32_t crc, const void *buf, size_t len) { + + /* process four bytes at once (slicing-by-4) */ + while (len >= 4) { +-#ifdef LITTLE_ENDIAN ++#if BYTE_ORDER == LITTLE_ENDIAN + crc1 = *cur++ ^ crc0; + crc0 = crc32c_lookup[0][(crc1>>24) & 0xff] ^ + crc32c_lookup[1][(crc1>>16) & 0xff] ^ +diff --git a/lib/xsha1.c b/lib/xsha1.c +index 1c4547e..6e41eee 100644 +--- a/lib/xsha1.c ++++ b/lib/xsha1.c +@@ -89,7 +89,7 @@ struct _SHA_CTX { + /* blk0() and blk() perform the initial expand. */ + /* I got the idea of expanding during the round function from SSLeay */ + +-#ifdef LITTLE_ENDIAN ++#if BYTE_ORDER == LITTLE_ENDIAN + #define blk0(i) (block->l[i] = (rol(block->l[i],24)&(sha1_quadbyte)0xFF00FF00) \ + |(rol(block->l[i],8)&(sha1_quadbyte)0x00FF00FF)) + #else