Hi,

NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks are
not added to the upstream Postgres yet. The attached patch adds NetBSD and
OpenBSD tasks to the Postgres CI.

I made these tasks triggered manually like MinGW task to save CI credits
but a related line is commented out for now to trigger CFBot.

CPU: 2 and TEST_JOBS: 8 are chosen based on manual tests.

╔══════════════════════╦════════╦═════════╗
║      CI Run Tim      ║        ║         ║
║   (Only Test Step)   ║ NetBSD ║ OpenBSD ║
║ (in minutes:seconds) ║        ║         ║
╠══════════════════════╬════════╬═════════╣
║     CPU: 2, TJ: 4    ║  13:18 ║  17:07  ║
╠══════════════════════╬════════╬═════════╣
║     CPU: 2, TJ: 6    ║  11:01 ║  16:23  ║
╠══════════════════════╬════════╬═════════╣
║     CPU: 2, TJ: 8    ║  10:14 ║  15:41  ║
╠══════════════════════╬════════╬═════════╣
║     CPU: 4, TJ: 4    ║  11:46 ║  16:03  ║
╠══════════════════════╬════════╬═════════╣
║     CPU: 4, TJ: 6    ║  09:56 ║  14:59  ║
╠══════════════════════╬════════╬═════════╣
║     CPU: 4, TJ: 8    ║  10:02 ║  15:09  ║
╚══════════════════════╩════════╩═════════╝

Any kind of feedback would be appreciated.

[1] https://github.com/anarazel/pg-vm-images

--
Regards,
Nazir Bilal Yavuz
Microsoft
From 18acef23ac64ec8906d05d19f47f097c96ef3b45 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavu...@gmail.com>
Date: Fri, 1 Nov 2024 12:02:29 +0300
Subject: [PATCH v1] Add NetBSD and OpenBSD tasks to the Postgres CI

NetBSD and OpenBSD Postgres CI images are generated [1] but their tasks
are not added to the upstream Postgres yet. This patch adds them.

Note: These tasks will be triggered manually to save CI credits but a
related line is commented out for now to trigger CFBot.

[1] https://github.com/anarazel/pg-vm-images
---
 .cirrus.tasks.yml | 82 +++++++++++++++++++++++++++++++++++++++++++++++
 .cirrus.yml       | 10 ++++++
 2 files changed, 92 insertions(+)

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index 90cb95c8681..6c57584bdf9 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -214,6 +214,88 @@ task:
     cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
 
 
+task:
+  depends_on: SanityCheck
+  # trigger_type: manual
+
+  env:
+    # Below are experimentally derived to be a decent choice.
+    CPUS: 2
+    BUILD_JOBS: 8
+    TEST_JOBS: 8
+
+    CIRRUS_WORKING_DIR: /home/postgres/postgres
+    CCACHE_DIR: /tmp/ccache_dir
+
+    PATH: /usr/sbin:$PATH
+
+    # Postgres interprets LANG as a 'en_US.UTF-8' but it is 'C', then
+    # Postgres tries to set 'LC_COLLATE' to 'en_US.UTF-8' but it is not
+    # changeable. Initdb fails because of that. So, LANG is forced to be 'C'.
+    LANG: "C"
+    LC_ALL: "C"
+
+  matrix:
+    - name: NetBSD - 10 - Meson
+      only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
+      env:
+        IMAGE_FAMILY: pg-ci-netbsd-postgres
+        INCLUDE_DIRS: -Dextra_lib_dirs=/usr/pkg/lib -Dextra_include_dirs=/usr/pkg/include
+      <<: *netbsd_task_template
+
+    - name: OpenBSD - 7 - Meson
+      only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
+      env:
+        IMAGE_FAMILY: pg-ci-openbsd-postgres
+        INCLUDE_DIRS: -Dextra_include_dirs=/usr/local/include -Dextra_lib_dirs=/usr/local/lib
+        UUID: -Duuid=e2fs
+      <<: *openbsd_task_template
+
+  sysinfo_script: |
+    locale
+    id
+    uname -a
+    ulimit -a -H && ulimit -a -S
+    env
+
+  ccache_cache:
+    folder: $CCACHE_DIR
+
+  create_user_script: |
+    useradd postgres
+    chown -R postgres:users /home/postgres
+    mkdir -p ${CCACHE_DIR}
+    chown -R postgres:users ${CCACHE_DIR}
+
+  # -Duuid=bsd is not set since 'bsd' uuid option
+  # is not working on NetBSD & OpenBSD. See
+  # https://www.postgresql.org/message-id/17358-89806e7420797...@postgresql.org
+  # And other uuid options are not available on NetBSD.
+  configure_script: |
+    su postgres <<-EOF
+      meson setup \
+        --buildtype debug \
+        -Dcassert=true -Dssl=openssl ${UUID} \
+        -DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
+        ${INCLUDE_DIRS} \
+        build
+    EOF
+
+  build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
+  upload_caches: ccache
+
+  test_world_script: |
+    su postgres <<-EOF
+      ulimit -c unlimited
+      # Otherwise tests will fail on OpenBSD, due to the lack of enough processes.
+      ulimit -p 256
+      meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
+    EOF
+
+  on_failure:
+    <<: *on_failure_meson
+
+
 # configure feature flags, shared between the task running the linux tests and
 # the CompilerWarnings task
 LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-
diff --git a/.cirrus.yml b/.cirrus.yml
index a83129ae46d..33c6e481d74 100644
--- a/.cirrus.yml
+++ b/.cirrus.yml
@@ -52,6 +52,16 @@ default_freebsd_task_template: &freebsd_task_template
     PLATFORM: freebsd
   <<: *cirrus_community_vm_template
 
+default_netbsd_task_template: &netbsd_task_template
+  env:
+    PLATFORM: netbsd
+  <<: *cirrus_community_vm_template
+
+default_openbsd_task_template: &openbsd_task_template
+  env:
+    PLATFORM: openbsd
+  <<: *cirrus_community_vm_template
+
 
 default_windows_task_template: &windows_task_template
   env:
-- 
2.45.2

Reply via email to