-
Notifications
You must be signed in to change notification settings - Fork 1
Add integration tests for Meson #47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRemoves a Changes
Sequence Diagram(s)sequenceDiagram
participant Test as Integration Test
participant CLI as packager CLI
participant Validator as BuildSystem Validator
participant Builder as Meson/CMake Build
Test->>CLI: invoke run_packager with package config
CLI->>Validator: parse build config (defines/options)
alt invalid/empty/wrong-type
Validator-->>CLI: return CONTEXT_ERROR
CLI-->>Test: exit with expected failure
else valid
Validator->>Builder: construct build commands
Builder-->>CLI: build success or failure
CLI-->>Test: return success or failure code
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (6)
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. Comment |
There was a problem hiding this 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
🧹 Nitpick comments (3)
tests/integration_tests/test_build_package.py (3)
756-770: Add image support check for consistency.For consistency with other tests and to avoid unnecessary CI resource usage, add an image support check at the beginning of the test.
Apply this diff:
def test_27_cmake_invalid_define(test_image, packager_binary, context, test_repo): - """Test building a package with an CMake define with invalid characters.""" + """Test building a package with a CMake define with invalid characters.""" package = "test_package_1_27" prepare_packages([package]) + if not does_package_support_image(package, test_image): + return run_packager( packager_binary,
844-860: Fix grammar in docstring.Minor grammar correction needed in the docstring.
Apply this diff:
def test_32_cmake_empty_define(test_image, packager_binary, context, test_repo): - """Test building a package with an CMake define with empty name.""" + """Test building a package with a CMake define with empty name.""" package = "test_package_1_32"
862-878: Fix grammar in docstring.Minor grammar correction needed in the docstring.
Apply this diff:
def test_33_cmake_wrong_define_type(test_image, packager_binary, context, test_repo): - """Test building a package with an CMake define with non-string value.""" + """Test building a package with a CMake define with non-string value.""" package = "test_package_1_33"
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (10)
tests/conftest.py(0 hunks)tests/integration_tests/test_build_package.py(1 hunks)tests/test_data/test_packages/test_package_10/c_example_debug.json(1 hunks)tests/test_data/test_packages/test_package_10_28/c_example_debug.json(1 hunks)tests/test_data/test_packages/test_package_10_29/c_example_debug.json(1 hunks)tests/test_data/test_packages/test_package_10_30/c_example_debug.json(1 hunks)tests/test_data/test_packages/test_package_10_31/c_example_debug.json(1 hunks)tests/test_data/test_packages/test_package_1_27/zlib_release.json(1 hunks)tests/test_data/test_packages/test_package_1_32/zlib_release.json(1 hunks)tests/test_data/test_packages/test_package_1_33/zlib_release.json(1 hunks)
💤 Files with no reviewable changes (1)
- tests/conftest.py
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: mikusaq
Repo: bacpack-system/packager PR: 46
File: internal/config/Config.go:134-141
Timestamp: 2025-09-24T10:05:00.810Z
Learning: The BuildSystem.CheckPrerequisites method in internal/build/BuildSystem.go already validates that both CMake and Meson cannot be set simultaneously, so additional validation in Config.fillBuildStructure is not needed.
📚 Learning: 2025-08-29T09:50:44.695Z
Learnt from: mikusaq
Repo: bacpack-system/packager PR: 43
File: tests/test_data/test_packages/test_package_1_18/zlib_release.json:3-6
Timestamp: 2025-08-29T09:50:44.695Z
Learning: For the bacpack-system/packager repository, Git revision tags (like "v1.2.11") are acceptable in test data JSON files and do not need to be replaced with commit SHAs.
Applied to files:
tests/test_data/test_packages/test_package_1_33/zlib_release.jsontests/test_data/test_packages/test_package_10_29/c_example_debug.jsontests/test_data/test_packages/test_package_1_27/zlib_release.jsontests/test_data/test_packages/test_package_1_32/zlib_release.jsontests/test_data/test_packages/test_package_10/c_example_debug.jsontests/test_data/test_packages/test_package_10_31/c_example_debug.jsontests/test_data/test_packages/test_package_10_30/c_example_debug.json
📚 Learning: 2025-08-29T09:51:15.354Z
Learnt from: mikusaq
Repo: bacpack-system/packager PR: 43
File: tests/test_data/test_packages/test_package_1_25/zlib_debug.json:4-6
Timestamp: 2025-08-29T09:51:15.354Z
Learning: In the bacpack-system/packager repository, test files with invalid Git revisions like "not_real_version_tag" in tests/test_data/test_packages/test_package_1_25/ are intentional negative test cases designed to test error handling, not actual issues that need fixing.
Applied to files:
tests/test_data/test_packages/test_package_1_33/zlib_release.jsontests/test_data/test_packages/test_package_10_29/c_example_debug.jsontests/test_data/test_packages/test_package_1_32/zlib_release.jsontests/integration_tests/test_build_package.pytests/test_data/test_packages/test_package_10_31/c_example_debug.jsontests/test_data/test_packages/test_package_10_30/c_example_debug.json
🧬 Code graph analysis (1)
tests/integration_tests/test_build_package.py (4)
tests/conftest.py (4)
test_image(45-52)packager_binary(71-79)context(56-57)test_repo(61-62)tests/test_utils/test_utils.py (3)
prepare_packages(79-86)does_package_support_image(165-182)run_packager(193-294)tests/test_utils/common.py (2)
PackagerExpectedResult(20-29)PackagerReturnCode(4-17)internal/packager_error/PackagerError.go (1)
CONTEXT_ERROR(10-10)
🔇 Additional comments (15)
tests/test_data/test_packages/test_package_10/c_example_debug.json (1)
1-32: Valid baseline test configuration.Clean Meson debug configuration that matches directory structure and appears to serve as a valid baseline case for the integration tests.
tests/test_data/test_packages/test_package_1_32/zlib_release.json (2)
15-15: Package name does not match directory structure.Line 15 specifies
"Name": "test_package_1_33", but the file is located intest_package_1_32/directory. Verify whether this mismatch is intentional or if the package name should betest_package_1_32.
9-11: Empty define key is intentional negative test case.The empty string
""key in CMake Defines is an intentional invalid configuration to test error handling for empty define names. This is consistent with the PR objective to test incorrect/wrong defines.tests/test_data/test_packages/test_package_10_30/c_example_debug.json (1)
1-35: Valid negative test case for empty Meson define.This configuration intentionally includes an empty
""key in Meson Defines to test error handling for invalid (empty) define names, aligning with the PR objective.tests/test_data/test_packages/test_package_10_28/c_example_debug.json (1)
1-35: Valid negative test case for invalid Meson define name.The
"INVALID$DEFINE"key intentionally contains a special character to test error handling for malformed define names.tests/test_data/test_packages/test_package_1_27/zlib_release.json (2)
16-16: Package name does not match directory structure.Line 16 specifies
"Name": "test_package_1_26", but the file is located intest_package_1_27/directory. Verify whether this mismatch is intentional or if the package name should betest_package_1_27.
9-12: Valid negative test case with mixed valid and invalid CMake defines.The
"INVALID$DEFINE"key intentionally contains a special character to test error handling, whileCMAKE_BUILD_TYPE: Releaseis a valid define. This mixed scenario tests validation logic.tests/test_data/test_packages/test_package_10_29/c_example_debug.json (1)
1-33: Valid negative test case for invalid Meson option.The
"invalid_option": "option"key tests how the build system handles unrecognized Meson options, whilebuildtype: debugis valid. This mixed scenario validates option validation logic.tests/test_data/test_packages/test_package_10_31/c_example_debug.json (1)
1-32: Valid negative test case for empty Meson option key.The empty
""key in Meson Options tests error handling for invalid (empty) option names.tests/test_data/test_packages/test_package_1_33/zlib_release.json (2)
16-16: Package name does not match directory structure.Line 16 specifies
"Name": "test_package_1_35", but the file is located intest_package_1_33/directory. Verify whether this mismatch is intentional or if the package name should betest_package_1_33.
7-13: Valid negative test case with boolean CMake define value.The
"SOME_DEFINE": trueintentionally uses a boolean value instead of a string to test type validation, whileCMAKE_BUILD_TYPE: Releaseis valid. This tests whether the build system validates that define values should be strings.tests/integration_tests/test_build_package.py (4)
772-788: LGTM!The test correctly validates invalid Meson defines, checks image support, and expects the appropriate error code.
790-806: LGTM!The test correctly validates invalid Meson options, checks image support, and expects the appropriate error code.
808-824: LGTM!The test correctly validates empty Meson define names, checks image support, and expects the appropriate error code.
826-842: LGTM!The test correctly validates empty Meson option names, checks image support, and expects the appropriate error code.
|
Moved to #49, closing this PR. |
Add integration tests for Meson #47 and for local repo. Adds using test Context with simple Packages and Apps only for test purposes instead of external real dependencies, which can be unstable. Add setup before running tests to ensure consistency - building Packager binary, removing and building Docker images.
Add integration test for Meson build system and some wrong defines/options for both CMake and Meson.
Summary by CodeRabbit
Tests
Chores