Skip to content

test: update tests to support ARM architecture#184

Merged
ericcurtin merged 4 commits intomainfrom
fix-tests-on-arm
Sep 29, 2025
Merged

test: update tests to support ARM architecture#184
ericcurtin merged 4 commits intomainfrom
fix-tests-on-arm

Conversation

@ilopezluna
Copy link
Copy Markdown
Contributor

@ilopezluna ilopezluna commented Sep 29, 2025

The test was failing because it didn't account for ARM64-specific arguments that are automatically added by NewDefaultLlamaCppConfig() when running on ARM64 architecture (like Apple Silicon Macs).

Solution:

Updated the test to be architecture-aware by:

  1. Building base expected arguments dynamically based on runtime.GOARCH
  2. Adding --threads argument when on ARM64 (matching the behavior in llamacpp_config.go)
  3. Using these base arguments consistently across all test cases

Summary by Sourcery

Tests:

  • Update TestGetArgs to generate base expected args dynamically and append ARM64-specific --threads flag for ARM64 architecture

Copilot AI review requested due to automatic review settings September 29, 2025 12:11
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai bot commented Sep 29, 2025

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Tests are enhanced to detect and include ARM64-specific flags by building a base argument list dynamically at runtime, conditionally inserting the --threads option on ARM64, and refactoring all test cases to reuse this new baseArgs slice instead of hard-coded literals.

File-Level Changes

Change Details Files
Introduce architecture-aware baseArgs construction
  • Initialize baseArgs slice with common flags
  • Check runtime.GOARCH for "arm64"
  • Compute thread count and append --threads flag dynamically
pkg/inference/backends/llamacpp/llamacpp_config_test.go
Refactor expected argument definitions to use baseArgs
  • Replace static expected slices with append(baseArgs, ...) pattern
  • Update all test cases to prepend baseArgs to their specific flags
pkg/inference/backends/llamacpp/llamacpp_config_test.go
Sync project ignore rules
  • Adjust .gitignore file (no test content change)
.gitignore

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@ilopezluna ilopezluna requested a review from a team September 29, 2025 12:11
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @ilopezluna, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses test failures on ARM64 architecture, particularly on Apple Silicon Macs, by making the llamacpp configuration tests architecture-aware. The changes ensure that the test expectations correctly account for ARM64-specific arguments, thus preventing erroneous test failures and improving the reliability of the test suite across different platforms.

Highlights

  • Architecture-Aware Test Arguments: The test suite has been updated to dynamically build expected arguments based on the runtime.GOARCH variable, ensuring tests adapt to the underlying system architecture.
  • ARM64-Specific Thread Argument: The --threads argument is now conditionally added to the expected arguments when running on ARM64 architecture, aligning with the behavior of NewDefaultLlamaCppConfig().
  • Consistent Argument Usage: A baseArgs variable is introduced and consistently used across all test cases, simplifying maintenance and ensuring uniformity in expected argument sets.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Updates tests to support ARM architecture by making them architecture-aware, fixing test failures on ARM64 systems like Apple Silicon Macs.

  • Makes test arguments dynamically adapt to the runtime architecture
  • Adds --threads argument for ARM64 systems to match production behavior
  • Refactors test structure to use shared base arguments across all test cases

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the tests to support ARM architecture by dynamically building the expected arguments. The approach is sound, but I've identified a potential issue in the thread calculation logic that could cause problems on single-core ARM machines. Additionally, I've suggested some readability improvements for constructing test data by using slices.Clone() from the standard library, which is more idiomatic for the Go version in use.

Copilot AI review requested due to automatic review settings September 29, 2025 14:30
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ericcurtin ericcurtin merged commit c733ed7 into main Sep 29, 2025
5 checks passed
@ericcurtin ericcurtin deleted the fix-tests-on-arm branch September 29, 2025 15:32
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.

4 participants