Skip to content

Commit e291573

Browse files
committed
ci: Test NetBSD and OpenBSD
NetBSD and OpenBSD Postgres CI images are now generated [1], but aren't yet utilized for Postgres' CI. This commit adds CI support for them. For now the tasks will be manually triggered, to save on CI credits. [1] https://github.com/anarazel/pg-vm-images Author: Nazir Bilal Yavuz <byavuz81@gmail.com> Discussion: https://postgr.es/m/CAN55FZ32ySyYa06k9MFd+VY5vHhUyBpvgmJUZae5PihjzaurVg@mail.gmail.com
1 parent b64d831 commit e291573

File tree

3 files changed

+103
-1
lines changed

3 files changed

+103
-1
lines changed

.cirrus.tasks.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,98 @@ task:
216216
cores_script: src/tools/ci/cores_backtrace.sh freebsd /tmp/cores
217217

218218

219+
task:
220+
depends_on: SanityCheck
221+
trigger_type: manual
222+
223+
env:
224+
# Below are experimentally derived to be a decent choice.
225+
CPUS: 4
226+
BUILD_JOBS: 8
227+
TEST_JOBS: 8
228+
229+
# Default working directory is /tmp, but its total size (1.2 GB) is not
230+
# enough, so different working and cache directory are set.
231+
CIRRUS_WORKING_DIR: /home/postgres/postgres
232+
CCACHE_DIR: /home/postgres/cache
233+
234+
PATH: /usr/sbin:$PATH
235+
236+
matrix:
237+
- name: NetBSD - Meson
238+
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*netbsd.*'
239+
env:
240+
IMAGE_FAMILY: pg-ci-netbsd-postgres
241+
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/pkg/lib/pkgconfig'
242+
# initdb fails with: 'invalid locale settings' error on NetBSD.
243+
# Force 'LANG' and 'LC_*' variables to be 'C'.
244+
# See https://postgr.es/m/2490325.1734471752%40sss.pgh.pa.us
245+
LANG: "C"
246+
LC_ALL: "C"
247+
# -Duuid is not set for the NetBSD, see the comment below, above
248+
# configure_script, for more information.
249+
setup_additional_packages_script: |
250+
#pkgin -y install ...
251+
<<: *netbsd_task_template
252+
253+
- name: OpenBSD - Meson
254+
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*openbsd.*'
255+
env:
256+
IMAGE_FAMILY: pg-ci-openbsd-postgres
257+
PKGCONFIG_PATH: '/usr/lib/pkgconfig:/usr/local/lib/pkgconfig'
258+
UUID: -Duuid=e2fs
259+
TCL: -Dtcl_version=tcl86
260+
setup_additional_packages_script: |
261+
#pkg_add -I ...
262+
<<: *openbsd_task_template
263+
264+
sysinfo_script: |
265+
locale
266+
id
267+
uname -a
268+
ulimit -a -H && ulimit -a -S
269+
env
270+
271+
ccache_cache:
272+
folder: $CCACHE_DIR
273+
274+
create_user_script: |
275+
useradd postgres
276+
chown -R postgres:users /home/postgres
277+
mkdir -p ${CCACHE_DIR}
278+
chown -R postgres:users ${CCACHE_DIR}
279+
280+
# -Duuid=bsd is not set since 'bsd' uuid option
281+
# is not working on NetBSD & OpenBSD. See
282+
# https://www.postgresql.org/message-id/17358-89806e7420797025@postgresql.org
283+
# And other uuid options are not available on NetBSD.
284+
configure_script: |
285+
su postgres <<-EOF
286+
meson setup \
287+
--buildtype=debugoptimized \
288+
--pkg-config-path ${PKGCONFIG_PATH} \
289+
-Dcassert=true -Dinjection_points=true \
290+
-Dssl=openssl ${UUID} ${TCL} \
291+
-DPG_TEST_EXTRA="$PG_TEST_EXTRA" \
292+
build
293+
EOF
294+
295+
build_script: su postgres -c 'ninja -C build -j${BUILD_JOBS}'
296+
upload_caches: ccache
297+
298+
test_world_script: |
299+
su postgres <<-EOF
300+
ulimit -c unlimited
301+
# Otherwise tests will fail on OpenBSD, due to inability to start enough
302+
# processes.
303+
ulimit -p 256
304+
meson test $MTEST_ARGS --num-processes ${TEST_JOBS}
305+
EOF
306+
307+
on_failure:
308+
<<: *on_failure_meson
309+
310+
219311
# configure feature flags, shared between the task running the linux tests and
220312
# the CompilerWarnings task
221313
LINUX_CONFIGURE_FEATURES: &LINUX_CONFIGURE_FEATURES >-

.cirrus.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ default_freebsd_task_template: &freebsd_task_template
5252
PLATFORM: freebsd
5353
<<: *cirrus_community_vm_template
5454

55+
default_netbsd_task_template: &netbsd_task_template
56+
env:
57+
PLATFORM: netbsd
58+
<<: *cirrus_community_vm_template
59+
60+
default_openbsd_task_template: &openbsd_task_template
61+
env:
62+
PLATFORM: openbsd
63+
<<: *cirrus_community_vm_template
64+
5565

5666
default_windows_task_template: &windows_task_template
5767
env:

src/tools/ci/README

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Controlling CI via commit messages
6161
The behavior of CI can be controlled by special content in commit
6262
messages. Currently the following controls are available:
6363

64-
- ci-os-only: {(freebsd|linux|macos|windows|mingw)}
64+
- ci-os-only: {(freebsd|linux|macos|mingw|netbsd|openbsd|windows)}
6565

6666
Only runs CI on operating systems specified. This can be useful when
6767
addressing portability issues affecting only a subset of platforms.

0 commit comments

Comments
 (0)