Skip to content

MDEV-36107: Add expression support to mysqltest #4114

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

KhaledR57
Copy link
Contributor

  • The Jira issue number for this PR is: MDEV-36107

Description

The let command can now evaluate mathematical and logical expressions.

Release Notes

This patch integrates a recursive descent parser to handle arithmetic, comparisons, and logical operators.

TODO: Still working on it
To maintain backward compatibility, a heuristic function first checks if the right-hand side of an assignment looks like an expression. If not, the original string assignment logic is used.

How can this PR be tested?

$ ./mtr main.mysqltest_expression_evaluation

Basing the PR against the correct MariaDB version

  • This is a new feature or a refactoring, and the PR is based against the main branch.
  • This is a bug fix, and the PR is based against the earliest maintained branch in which the bug can be reproduced.

PR quality check

  • I checked the CODING_STANDARDS.md file and my PR conforms to this where appropriate.
  • For any trivial modifications to the PR, I am ok with the reviewer making the changes themselves.

@svoj svoj added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Jun 13, 2025
@KhaledR57 KhaledR57 force-pushed the MDEV-36107-mysqltest-expressions branch from bdfa044 to 12584b8 Compare June 17, 2025 14:56
@KhaledR57 KhaledR57 force-pushed the MDEV-36107-mysqltest-expressions branch 2 times, most recently from 8b9df35 to ddfb470 Compare July 2, 2025 04:58
Add support for evaluating complex expressions within mysqltest to
enable more powerful and dynamic testing.

A new, explicit `$(...)` syntax is introduced for the `let`, `if`, and
`while` commands. This allows for safe evaluation of expressions
without affecting the behavior of existing tests.

The engine includes an simple internal type system that distinguishes between
integers and strings, ensuring that operations are type-safe and behave
predictably. This foundation supports arithmetic, comparison, and logical
operators, making it possible to write more sophisticated and readable
test logic.
@KhaledR57 KhaledR57 force-pushed the MDEV-36107-mysqltest-expressions branch from ddfb470 to a29a805 Compare July 3, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.
Development

Successfully merging this pull request may close these issues.

2 participants