Skip to content

Add config filter flag to test runner script - #3027

Open
HDCharles wants to merge 1 commit into
mainfrom
HDCharles/add-config-filter-flag
Open

Add config filter flag to test runner script#3027
HDCharles wants to merge 1 commit into
mainfrom
HDCharles/add-config-filter-flag

Conversation

@HDCharles

@HDCharles HDCharles commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Adds a -f flag to tests/e2e/run_tests_in_python.sh that filters config files by substring match on filename
  • E.g., -f nvfp4 runs only configs with "nvfp4" in their name, skipping the rest
  • Non-matching configs are logged as skipped for visibility

Companion PR: https://github.com/neuralmagic/llm-compressor-testing/pull/332

Test plan

  • Run bash tests/e2e/run_tests_in_python.sh -c tests/lmeval/configs -f nvfp4 locally and verify only nvfp4 configs are selected
  • Run without -f and verify all configs still run (no behavior change)

🤖 Generated with Claude Code

Allows filtering which config files are run by substring match on the
filename. E.g., `-f nvfp4` will only run configs containing "nvfp4" in
their name, skipping the rest.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7f065a57-f5f7-43e2-9ddb-6be0ab4d439b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

@mergify

mergify Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Require one maintainer review

All PRs must have at least one approving review from a maintainer before merging.

  • #changes-requested-reviews-by = 0
  • any of:
    • approved-reviews-by=brian-dellabetta
    • approved-reviews-by=kylesayrs
    • approved-reviews-by=HDCharles
    • approved-reviews-by=dsikka
    • approved-reviews-by=yiliu30

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

Copy link
Copy Markdown
Contributor

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 introduces a new -f command-line option to run_tests_in_python.sh to filter configuration files by a substring pattern. The feedback suggests several improvements to the Bash script: using the more idiomatic [ -n "$FILTER" ] instead of [ ! -z "$FILTER" ], handling cases where the glob pattern does not match any files to prevent errors, and replacing the external basename command with Bash's built-in parameter expansion ${MODEL_CONFIG##*/} inside the loop to improve performance.

Comment on lines +38 to +40
if [ ! -z "$FILTER" ]; then
echo "Config filter is specified: $FILTER"
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using [ -n "$FILTER" ] is the standard and more readable way to check if a string is non-empty in Bash, rather than negating -z with !.

Suggested change
if [ ! -z "$FILTER" ]; then
echo "Config filter is specified: $FILTER"
fi
if [ -n "$FILTER" ]; then
echo "Config filter is specified: $FILTER"
fi

# Parse list of configs.
for MODEL_CONFIG in "$CONFIG"/*
do
LOCAL_SUCCESS=0

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

When the config directory is empty or does not exist, the glob "$CONFIG"/* will not expand and will instead evaluate to the literal string "/path/to/configs/*". This causes the loop to run once with a non-existent path, leading to misleading skip logs or cat errors.

Adding a check to ensure the file actually exists before proceeding avoids this issue.

Suggested change
LOCAL_SUCCESS=0
LOCAL_SUCCESS=0
# Ensure the config file exists (handles cases where the glob doesn't match any files)
[[ -e "$MODEL_CONFIG" ]] || continue

Comment on lines +48 to +54
if [ ! -z "$FILTER" ]; then
config_basename=$(basename "$MODEL_CONFIG")
if [[ "$config_basename" != *"$FILTER"* ]]; then
echo "=== SKIPPING MODEL (filter): $MODEL_CONFIG ==="
continue
fi
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

Using the external basename command inside a loop forks a new process for every single configuration file, which is inefficient.

We can use Bash's built-in parameter expansion ${MODEL_CONFIG##*/} to extract the filename directly in-memory, which is significantly faster and more efficient. Additionally, we can use the more idiomatic [ -n "$FILTER" ] instead of [ ! -z "$FILTER" ].

Suggested change
if [ ! -z "$FILTER" ]; then
config_basename=$(basename "$MODEL_CONFIG")
if [[ "$config_basename" != *"$FILTER"* ]]; then
echo "=== SKIPPING MODEL (filter): $MODEL_CONFIG ==="
continue
fi
fi
if [ -n "$FILTER" ]; then
if [[ "${MODEL_CONFIG##*/}" != *"$FILTER"* ]]; then
echo "=== SKIPPING MODEL (filter): $MODEL_CONFIG ==="
continue
fi
fi

@brian-dellabetta brian-dellabetta left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

cool, gemini comments seems appropriate

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