diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 6ce7fb9a..2e260047 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -13,9 +13,13 @@ variables: # See Infrastructure/Infrastructure#97. TEST_ARGS: -t 10 + # Locale used for unit tests. See notes in test/test-engine.vala and + # test/test-client.vala. + TEST_LOCALE: en_US.UTF-8 + # Build BUILD_DIR: build - CONFIG_CMD: meson --buildtype=debug build + CONFIG_CMD: meson --buildtype=debug $BUILD_DIR BUILD_CMD: ninja -v -C $BUILD_DIR TEST_CMD: xvfb-run meson test -v --no-stdsplit -C $BUILD_DIR $TEST_ARGS INSTALL_CMD: ninja -v -C $BUILD_DIR install @@ -28,7 +32,7 @@ variables: libappstream-glib-devel libgee-devel libhandy-devel libpeas-devel libsecret-devel libunwind-devel libxml2-devel libytnef-devel sqlite-devel webkitgtk4-devel - FEDORA_TEST_DEPS: Xvfb tar xz + FEDORA_TEST_DEPS: glibc-langpack-en tar xz Xvfb # Ubuntu packages UBUNTU_DEPS: @@ -39,32 +43,14 @@ variables: libjson-glib-dev libmessaging-menu-dev libpeas-dev libsecret-1-dev libsqlite3-dev libunity-dev libunwind-dev libwebkit2gtk-4.0-dev libxml2-dev libytnef0-dev - UBUNTU_TEST_DEPS: xauth xvfb + UBUNTU_TEST_DEPS: locales xauth xvfb -# fedora: -# stage: build -# image: fedora:rawhide -# before_script: -# - dnf update -y --nogpgcheck -# - dnf install -y --nogpgcheck $FEDORA_DEPS $FEDORA_TEST_DEPS -# script: -# - $CONFIG_CMD -Dtnef-support=false -# - $BUILD_CMD -# - $TEST_CMD -# - $INSTALL_CMD -# artifacts: -# when: 'always' -# paths: -# - '$BUILD_DIR/meson-logs/meson-log.txt' -# - '$BUILD_DIR/meson-logs/testlog.txt' -# expire_in: 2 days - -ubuntu: +fedora: stage: build - image: ubuntu:devel + image: fedora:rawhide before_script: - - apt-get update - - apt-get install -q -y --no-install-recommends $UBUNTU_DEPS $UBUNTU_TEST_DEPS + - dnf update -y --nogpgcheck + - dnf install -y --nogpgcheck $FEDORA_DEPS $FEDORA_TEST_DEPS script: - $CONFIG_CMD - $BUILD_CMD @@ -73,8 +59,27 @@ ubuntu: artifacts: when: 'always' paths: - - '_build/meson-logs/meson-log.txt' - - '_build/meson-logs/testlog.txt' + - '$BUILD_DIR/meson-logs/meson-log.txt' + - '$BUILD_DIR/meson-logs/testlog.txt' + expire_in: 2 days + +ubuntu: + stage: build + image: ubuntu:devel + before_script: + - apt-get update + - apt-get install -q -y --no-install-recommends $UBUNTU_DEPS $UBUNTU_TEST_DEPS + - locale-gen $TEST_LOCALE + script: + - $CONFIG_CMD + - $BUILD_CMD + - $TEST_CMD + - $INSTALL_CMD + artifacts: + when: 'always' + paths: + - '$BUILD_DIR/meson-logs/meson-log.txt' + - '$BUILD_DIR/meson-logs/testlog.txt' expire_in: 2 days flatpak: diff --git a/test/engine/imap-db/imap-db-database-test.vala b/test/engine/imap-db/imap-db-database-test.vala index 5b758c2a..1341f2d8 100644 --- a/test/engine/imap-db/imap-db-database-test.vala +++ b/test/engine/imap-db/imap-db-database-test.vala @@ -143,23 +143,13 @@ class Geary.ImapDB.DatabaseTest : TestCase { db.exec(""" CREATE TABLE Test (id INTEGER PRIMARY KEY, test_str TEXT); INSERT INTO Test (test_str) VALUES ('a'); + INSERT INTO Test (test_str) VALUES ('b'); INSERT INTO Test (test_str) VALUES ('B'); INSERT INTO Test (test_str) VALUES ('BB'); - INSERT INTO Test (test_str) VALUES ('🤯'); + INSERT INTO Test (test_str) VALUES ('á'); """); - string[] expected = { "a", "BB", "B", "🤯" }; - // Distros don't ship well-known locales other than C.UTF-8 by - // default, but Flatpak does not currently ship C.UTF-8 at - // all, so need to support both. :( - // - // See test-engine.vala and - // https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/812 - if (GLib.Intl.setlocale(LocaleCategory.COLLATE, null) != "C.UTF-8") { - // en_US.UTF-8: - expected = { "BB", "B", "a", "🤯" }; - } - + string[] expected = { "BB", "B", "b", "á", "a" }; Db.Result result = db.query( "SELECT test_str FROM Test ORDER BY test_str COLLATE UTF8COLL DESC" ); diff --git a/test/test-client.vala b/test/test-client.vala index 6665582b..25567a3a 100644 --- a/test/test-client.vala +++ b/test/test-client.vala @@ -27,8 +27,11 @@ int main(string[] args) { */ // Ensure things like e.g. GLib's formatting routines uses a - // UTF-8-based locale rather ASCII - GLib.Intl.setlocale(LocaleCategory.ALL, "C.UTF-8"); + // well-known UTF-8-based locale rather ASCII. Would like to use + // C.UTF-8 here, but currently only Debian et al and Fedora ship + // it, and as of Fedora 32 they disagree on collation order for + // non-ASCII chars. + GLib.Intl.setlocale(LocaleCategory.ALL, "en_US.UTF-8"); Gtk.init(ref args); Test.init(ref args); diff --git a/test/test-engine.vala b/test/test-engine.vala index 0f28510a..d8cc5c6d 100644 --- a/test/test-engine.vala +++ b/test/test-engine.vala @@ -11,16 +11,11 @@ int main(string[] args) { */ // Ensure things like e.g. GLib's formatting routines uses a - // well-known UTF-8-based locale rather ASCII. - // - // Distros don't ship well-known locales other than C.UTF-8 by - // default, but Flatpak does not currently support C.UTF-8, so - // need to try both. :( - // https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/812 - string? locale = GLib.Intl.setlocale(LocaleCategory.ALL, "C.UTF-8"); - if (locale == null) { - GLib.Intl.setlocale(LocaleCategory.ALL, "en_US.UTF-8"); - } + // well-known UTF-8-based locale rather ASCII. Would like to use + // C.UTF-8 here, but currently only Debian et al and Fedora ship + // it, and as of Fedora 32 they disagree on collation order for + // non-ASCII chars. + GLib.Intl.setlocale(LocaleCategory.ALL, "en_US.UTF-8"); Test.init(ref args);