diff --git a/.github/workflows/test-illumos.yml b/.github/workflows/test-illumos.yml new file mode 100644 index 000000000..c70772360 --- /dev/null +++ b/.github/workflows/test-illumos.yml @@ -0,0 +1,80 @@ +# Selected unit tests and the smoke test on illumos. OmniOS runs in a VM hosted on a Linux runner. +name: illumos + +on: workflow_call + +# Limit permissions on the repository +permissions: + contents: read + +jobs: + # Selected unit tests and the smoke test on OmniOS + omnios: + runs-on: ubuntu-24.04 + + steps: + - uses: actions/checkout@v6 + + - name: Start VM + uses: cross-platform-actions/action@v1.3.0 + with: + operating_system: omnios + version: r151058 + + # The custom shell runs the commands in the VM started above. Do not set this as a job default since the checkout step must + # run on the host. + - name: Install + shell: cpa.sh {0} + run: | + uname -a + sudo pkg refresh + + # The PostgreSQL versions supported by pgBackRest, oldest first, read from the generated header so the list never needs to + # be updated here. OmniOS leaves the dot out of the package name, e.g. 9.6 is postgresql-96. + pgSupport=$(sed -n 's/^#define PG_VERSION_[0-9_]*_Z *"\([0-9.]*\)".*/\1/p' \ + ${GITHUB_WORKSPACE?}/src/postgres/version.auto.h | tr -d . | sed 's/^/ooce\/database\/postgresql-/') + + # The versions that are both supported and available. The order comes from the supported list since these do not sort + # naturally, e.g. postgresql-96 is not greater than postgresql-10. + pgAvail=$(echo "${pgSupport}" | grep -xF "$(pkg list -aH 'ooce/database/postgresql-*' | awk '{print $1}')") + echo "postgresql available: $(echo ${pgAvail})" + + # Each PostgreSQL version installs into its own prefix, so the oldest and newest are installed together + pgOldest=$(echo "${pgAvail}" | head -1) + pgNewest=$(echo "${pgAvail}" | tail -1) + + # pkg exits with 4 when everything is already installed + sudo pkg install developer/build-essential developer/pkg-config developer/versioning/git library/python-3/meson-313 \ + library/python-3/pyyaml-313 ooce/developer/ninja library/libxml2 library/zlib library/security/openssl-3 \ + compress/bzip2 compress/lz4 compress/zstd ${pgOldest} ${pgNewest} || test $? -eq 4 + + # meson and ninja are not in the default path. /usr/bin/pkg-config is 32-bit and searches the 32-bit libraries, so the + # 64-bit pkgconfig directories are set explicitly, including the one for the libpq of the newest PostgreSQL. + echo "export PATH=/usr/lib/python3.13/bin:/opt/ooce/bin:${PATH?}" > ${HOME?}/omnios.env + echo "export PKG_CONFIG_PATH=/usr/lib/amd64/pkgconfig:/opt/ooce/pgsql-${pgNewest##*-}/lib/amd64/pkgconfig" \ + >> ${HOME?}/omnios.env + + . ${HOME?}/omnios.env + gcc --version | head -1 + meson --version + ninja --version + pkg-config --modversion libpq libxml-2.0 openssl zlib liblz4 libzstd + python3 -c 'import sys, yaml; print("python %s, PyYAML %s" % (sys.version.split()[0], yaml.__version__))' + + - name: Run Test + shell: cpa.sh {0} + run: | + . ${HOME?}/omnios.env + cd .. && ${GITHUB_WORKSPACE?}/test/test.py --vm-max=2 --no-coverage --no-valgrind --module=command/backup \ + --module=command/info --module=command/archive/push + + # The integration tests cannot run here because there are no containers, but the smoke test drives a backup/restore cycle + # against each PostgreSQL installed above, which covers the basics + - name: Run Smoke Test + shell: cpa.sh {0} + run: | + . ${HOME?}/omnios.env + cd .. + meson setup build ${GITHUB_WORKSPACE?} + ninja -C build src/pgbackrest + meson test -C build --suite smoke -v diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a41cd9ca..f740de40f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -49,6 +49,9 @@ jobs: bsd: uses: ./.github/workflows/test-bsd.yml + illumos: + uses: ./.github/workflows/test-illumos.yml + compile: uses: ./.github/workflows/test-compile.yml diff --git a/doc/xml/release/2020s/2026/2.60.0.xml b/doc/xml/release/2020s/2026/2.60.0.xml index f76f1e132..e375b17c5 100644 --- a/doc/xml/release/2020s/2026/2.60.0.xml +++ b/doc/xml/release/2020s/2026/2.60.0.xml @@ -106,6 +106,18 @@

Add context to block map read errors during backup.

+ + + + + + + + + + +

Support building on illumos.

+
diff --git a/doc/xml/release/contributor.xml b/doc/xml/release/contributor.xml index 13c507521..43e777829 100644 --- a/doc/xml/release/contributor.xml +++ b/doc/xml/release/contributor.xml @@ -760,6 +760,11 @@ ImTheKai + + Kalevi Kolttonen + retrodood + + krmozejko krmozejko diff --git a/meson.build b/meson.build index 2caa895a1..c3d1cc9a2 100644 --- a/meson.build +++ b/meson.build @@ -50,6 +50,8 @@ if host_machine.system() == 'linux' add_global_arguments('-D_POSIX_C_SOURCE=200809L', language: 'c') elif host_machine.system() == 'darwin' add_global_arguments('-D_DARWIN_C_SOURCE', language: 'c') +elif host_machine.system() == 'sunos' + add_global_arguments('-D_POSIX_C_SOURCE=200809L', '-D__EXTENSIONS__', language: 'c') endif #################################################################################################################################### @@ -223,6 +225,13 @@ lib_z = dependency('zlib') configuration.set('ZLIB_CONST', true, description: 'Require zlib const input buffer') +# Find socket library on illumos/Solaris, where sockets are not in libc +lib_socket = dependency('', required: false) + +if host_machine.system() == 'sunos' + lib_socket = cc.find_library('socket') +endif + # Find optional systemd library lib_systemd = dependency('libsystemd', required: get_option('libsystemd')) diff --git a/src/meson.build b/src/meson.build index 434f7290a..3d01cff81 100644 --- a/src/meson.build +++ b/src/meson.build @@ -260,6 +260,7 @@ pgbackrest_exe = executable( lib_lz4, lib_systemd, lib_pq, + lib_socket, lib_ssh2, lib_xml, lib_z, diff --git a/test/lib/command/test/build.py b/test/lib/command/test/build.py index e9a5cf728..a8fafdb98 100644 --- a/test/lib/command/test/build.py +++ b/test/lib/command/test/build.py @@ -359,6 +359,7 @@ class TestBuild: + " lib_openssl,\n" + " lib_lz4,\n" + " lib_pq,\n" + + " lib_socket,\n" + " lib_ssh2,\n" + " lib_xml,\n" + " lib_z,\n" diff --git a/test/smoke.py b/test/smoke.py index e7dd59ade..878855dda 100755 --- a/test/smoke.py +++ b/test/smoke.py @@ -143,7 +143,7 @@ def pg_bin_candidates(extra_dirs): """Candidate bin directories to search for a PostgreSQL installation. This is a superset of the list in test/src/harness/host.c since the smoke test also runs where the integration tests - cannot, i.e. MacOS and FreeBSD.""" + cannot, i.e. MacOS, FreeBSD, and OmniOS.""" candidates = [] candidates += sorted(glob.glob("/usr/lib/postgresql/*/bin")) # Debian @@ -152,6 +152,7 @@ def pg_bin_candidates(extra_dirs): candidates += sorted(glob.glob("/opt/homebrew/opt/postgresql@*/bin")) # MacOS (Homebrew on ARM) candidates += sorted(glob.glob("/usr/local/opt/postgresql@*/bin")) # MacOS (Homebrew on Intel) candidates += ["/usr/local/bin"] # FreeBSD + candidates += sorted(glob.glob("/opt/ooce/pgsql-*/bin")) # OmniOS candidates += ["/usr/bin"] # Native (e.g. RHEL application stream) candidates += list(extra_dirs) diff --git a/test/src/module/test/command/test/build_test.py b/test/src/module/test/command/test/build_test.py index f4ae0bca3..721512cb1 100644 --- a/test/src/module/test/command/test/build_test.py +++ b/test/src/module/test/command/test/build_test.py @@ -287,6 +287,7 @@ MESON_LIB = ( " lib_openssl,\n" " lib_lz4,\n" " lib_pq,\n" + " lib_socket,\n" " lib_ssh2,\n" " lib_xml,\n" " lib_z,\n"