Skip to content

fix: use PostgreSQL mode for meson test initdb template#1180

Merged
gaoxueyu merged 5 commits intoIvorySQL:masterfrom
OreoYang:feat/meson_test_by_bigmodel
Feb 10, 2026
Merged

fix: use PostgreSQL mode for meson test initdb template#1180
gaoxueyu merged 5 commits intoIvorySQL:masterfrom
OreoYang:feat/meson_test_by_bigmodel

Conversation

@OreoYang
Copy link
Copy Markdown
Collaborator

@OreoYang OreoYang commented Jan 28, 2026

Summary

  • Fix meson test failures by specifying PostgreSQL mode (-m pg) when creating initdb template
  • Remove Oracle-specific tests from meson test suite (available via make oracle-check)
  • Add missing gb18030_and_gbk encoding to meson build
  • fix: ensure meson build generates non-empty ivorysql_ora--1.0.sql

Problem

IvorySQL's initdb defaults to Oracle mode (-m oracle). The meson build creates an initdb template without specifying the mode, which resulted in:

  • Oracle-specific types being present (oracharchar, number, binary_float, etc.)
  • Oracle system tables (dual table)
  • PostgreSQL regression tests expecting a pure PostgreSQL environment

Solution

Add -m pg option to the initdb_cache test in meson.build to create the template in PostgreSQL mode.

Test Plan

  • Regression tests: 228/228 passed
  • Full meson test: 315 passed, 24 skipped, 0 failed

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added support for the gb18030_and_gbk character encoding.
  • Tests

    • Removed automated test configurations for several Oracle-compatible modules.
    • Pl/ISQL tests are no longer run via the Meson test suite; use the traditional oracle-check workflow.
  • Chores

    • Adjusted database initialization mode for test runs.
    • CI: added a Meson-based GitHub Actions workflow to build, run tests, and collect logs.
    • Unified SQL file generation to better handle both Meson and Make modes.

✏️ Tip: You can customize this high-level summary in your review settings.

IvorySQL's initdb defaults to Oracle mode (-m oracle), which caused
meson tests to fail because the initdb template contained Oracle-
specific types and extensions (oracharchar, number, dual table, etc.).

Changes:
- Add `-m pg` option to initdb_cache test in meson.build
- Remove Oracle-specific tests from meson (ivorysql_ora, ora_btree_gin,
  ora_btree_gist, plisql) - they are still available via make
- Add missing gb18030_and_gbk encoding to meson.build

Test results:
- Regression tests: 228/228 passed
- Full meson test: 315 passed, 24 skipped, 0 failed
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Removed Meson test declarations from three contrib modules, added a multibyte encoding entry, changed an initdb invocation to include -m pg, adjusted PL/ISQL Meson test instructions, updated gensql.pl I/O behavior for Meson vs Make, and added a GitHub Actions Meson build/test workflow.

Changes

Cohort / File(s) Summary
Contrib test removals
contrib/ivorysql_ora/meson.build, contrib/ora_btree_gin/meson.build, contrib/ora_btree_gist/meson.build
Removed tests blocks (regress/TAP test declarations) from three contrib Meson build files, eliminating their declared test suites.
PL/ISQL test target
src/pl/plisql/src/meson.build
Removed Meson test target entries and replaced with comments/instructions to use make oracle-check.
Encoding addition
src/backend/utils/mb/conversion_procs/meson.build
Added new encoding entry gb18030_and_gbk mapping to gb18030_and_gbk/gb18030_and_gbk.c.
initdb arg change
meson.build
Added -m pg to the initdb invocation inside the test_initdb_cache block.
gensql I/O adjustments
contrib/ivorysql_ora/gensql.pl
Unified file-handle logic: Meson uses STDOUT, Make uses OUTFILE; conditional deletion/closing adjusted; merged SQL writes use a single filehandle variable.
CI: Meson build & test workflow
.github/workflows/meson_build_pg_test.yml
Added GitHub Actions workflow to install deps, configure Meson, build with Ninja, run Meson tests (with timeout), collect/compress logs, and upload artifacts on failure.

Sequence Diagram(s)

sequenceDiagram
  participant GH as "GitHub Actions\n(runner)" rgba(59,130,246,0.5)
  participant Meson as "Meson/Ninja build" rgba(16,185,129,0.5)
  participant InitDB as "initdb (-m pg)" rgba(234,88,12,0.5)
  participant Test as "meson test\n(regress/TAP runner)" rgba(168,85,247,0.5)
  participant Artifacts as "Artifact storage\n/log collector" rgba(250,204,21,0.5)

  GH->>Meson: configure (build dir, cassert=true, buildtype=debug)
  GH->>Meson: ninja build
  Meson->>InitDB: start cluster (test_initdb_cache with -m pg)
  Meson->>Test: run tests (meson test)
  Test->>Artifacts: stream logs
  GH->>Artifacts: compress & upload test-logs.tar.gz on failure
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • NotHimmel

Poem

🐇 I hopped through meson files with glee,
Tests tucked away and encodings set free.
Initdb now marches with -m pg in tow,
CI hums, builds, and gathers logs aglow.
I nibble changes—oh what a show!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: use PostgreSQL mode for meson test initdb template' directly addresses the main change: adding -m pg flag to initdb invocation in meson.build to fix Oracle mode defaults interfering with PostgreSQL regression tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/meson_build_pg_test.yml:
- Around line 46-51: The CI step named "run postgres test" currently uses both
"meson test || true" and "continue-on-error: true", which hides failures; to
make test failures visible but non-blocking, remove the "|| true" from the run
command so the step records a failure (retain continue-on-error: true to keep
the job continuing), or if you want CI to fail on test failures remove
"continue-on-error: true" instead; update the run block for the "run postgres
test" step accordingly.

Comment thread .github/workflows/meson_build_pg_test.yml Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @.github/workflows/meson_build_pg_test.yml:
- Line 18: The job name value "dependancy - linux" contains a typo; update the
YAML key value for the job name (the 'name' entry currently set to "dependancy -
linux") to read "dependency - linux" so the workflow label is spelled correctly.
🧹 Nitpick comments (3)
.github/workflows/meson_build_pg_test.yml (3)

17-17: Consider updating to actions/checkout@v4.

Version 4 is the current release with improved performance and Node.js 20 support.

Suggested change
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4

27-33: Use pip install instead of deprecated setup.py install.

setup.py install is deprecated. Consider using pip for a more maintainable and modern installation approach.

Suggested fix
        curl -L "https://github.com/mesonbuild/meson/releases/download/1.0.1/meson-1.0.1.tar.gz" -o meson-1.0.1.tar.gz
        curl -L "https://github.com/ninja-build/ninja/releases/download/v1.10.1/ninja-linux.zip" -o ninja-linux.zip
        unzip -o ninja-linux.zip
        sudo cp ninja /usr/bin/
-        tar xzf meson-1.0.1.tar.gz
-        cd meson-1.0.1
-        sudo python3 setup.py install
+        sudo pip3 install meson==1.0.1

Alternatively, consider using GitHub-hosted runner's package manager or a setup action for reproducible tooling.


90-99: Consider uploading a minimal artifact on success for audit/debugging.

Currently, artifacts are only uploaded on failure. The compressed test-logs.tar.gz is created in the prior step but not uploaded on success. For traceability of flaky tests or historical debugging, consider adding a conditional upload-on-success with shorter retention.

Example addition for success case
    - name: upload test summary
      if: success()
      uses: actions/upload-artifact@v4
      with:
        name: postgres-test-summary-${{ github.sha }}
        path: ${{ github.workspace }}/test-logs/SUMMARY.txt
        retention-days: 7

Comment thread .github/workflows/meson_build_pg_test.yml Outdated
  In meson mode, the script was opening the output file with truncate
  mode (>), which created an empty file before meson could capture the
  STDOUT output. This resulted in an empty extension file.

  Now in meson mode:
  - Do not open the output file (avoiding the truncate)
  - Output all content to STDOUT, which meson captures via --capture

  Make mode remains unchanged - it opens and writes to the file directly.

  This aligns with the pattern used by other scripts like
  generate-plerrcodes.pl and gb18030_2022's generation.
@jiaoshuntian jiaoshuntian self-requested a review February 2, 2026 06:57
@gaoxueyu gaoxueyu merged commit 3a40b6a into IvorySQL:master Feb 10, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants