Skip to content

test: Тест проверки выделяемой памяти пустого бенчмарка #20

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

Merged
merged 2 commits into from
May 31, 2025

Conversation

Stivo182
Copy link
Owner

@Stivo182 Stivo182 commented May 31, 2025

Summary by CodeRabbit

  • Tests
    • Added a new test to verify allocated memory for an empty benchmark.
    • Improved existing memory allocation test for clarity and accuracy.

Copy link

coderabbitai bot commented May 31, 2025

Walkthrough

A test procedure was renamed for clarity, and the method for accessing allocated memory in benchmark results was updated. Additionally, a new test procedure was added to verify memory allocation for an empty benchmark, including assertions on memory usage. Another test procedure was modified to check memory allocation via run statistics instead of report tables.

Changes

File(s) Change Summary
tests/ТестыЗамеров.os Renamed a test procedure, updated memory access logic, added a new test for empty benchmark memory allocation, and invoked the new test.
tests/ТестыКонфигурации.os Modified a test procedure to verify allocated memory via run statistics instead of report tables.

Sequence Diagram(s)

sequenceDiagram
    participant TestRunner
    participant Benchmark
    participant Result

    TestRunner->>Benchmark: Run benchmark with memory monitoring enabled
    Benchmark-->>Result: Return run results including memory statistics
    TestRunner->>Result: Access allocated memory in run statistics
    TestRunner->>TestRunner: Assert memory allocation is within expected bounds
Loading

Poem

In the warren of code, where the benchmarks run,
A new test was added, more memory fun!
With bytes counted closely, assertions in place,
The rabbits ensure there's no memory waste.
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 121e81f and aaa0f7e.

📒 Files selected for processing (2)
  • tests/ТестыЗамеров.os (2 hunks)
  • tests/ТестыКонфигурации.os (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • tests/ТестыЗамеров.os
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: sonar / test
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (macos-latest, dev)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (macos-latest, dev)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: sonar / test
🔇 Additional comments (1)
tests/ТестыКонфигурации.os (1)

316-316: LGTM! Improved memory allocation verification approach.

The change to access allocated memory data directly from run statistics (РезультатыЗапусков[0].Статистика.ВыделяемаяПамять) instead of report table structure is a good improvement. This provides a more direct and clear way to verify memory allocation functionality in the test.


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d20d71c and 121e81f.

📒 Files selected for processing (1)
  • tests/ТестыЗамеров.os (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: sonar / test
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (windows-latest, dev)
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (macos-latest, dev)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: sonar / test
  • GitHub Check: build (macos-latest, stable)
  • GitHub Check: build (ubuntu-latest, stable)
  • GitHub Check: build (macos-latest, dev)
  • GitHub Check: build (windows-latest, stable)
  • GitHub Check: build (ubuntu-latest, dev)
  • GitHub Check: build (windows-latest, dev)
🔇 Additional comments (2)
tests/ТестыЗамеров.os (2)

8-8: Good naming improvement!

The procedure rename makes the test intent more explicit and follows better naming conventions for test methods.


27-43: ⚠️ Potential issue

Fix syntax error and consider narrowing assertion range.

The new test procedure for empty benchmark memory allocation is well-structured, but has issues:

  1. Syntax Error: Missing semicolon after line 32
  2. Assertion Range: The range 1-600 bytes seems quite wide for an empty benchmark test

Apply this diff to fix the syntax error:

-	Конфигурация = Новый КонфигурацияБенчмарков(Тип)
+	Конфигурация = Новый КонфигурацияБенчмарков(Тип);

Consider narrowing the assertion range for more precise testing. For an empty benchmark, the memory allocation should be more predictable:

-	Ожидаем.Что(ВыделеноБайт).Между(1, 600);
+	Ожидаем.Что(ВыделеноБайт).Между(1, 100);

Likely an incorrect or invalid review comment.

ВыделеноБайт = Результат.Отчет.Таблица[0][КолонкиОтчетаБенчмарков.ВыделяемаяПамять];


ВыделеноБайт = Результат.РезультатыЗапусков[0].Статистика.ВыделяемаяПамять;
Copy link

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

API update looks good - verify consistency across codebase.

The new way of accessing allocated memory statistics through РезультатыЗапусков[0].Статистика.ВыделяемаяПамять is more direct and clear than the previous table-based access.

Ensure that all other occurrences of the old API pattern are updated consistently:


🏁 Script executed:

#!/bin/bash
# Description: Search for any remaining usage of the old memory access pattern
# Expected: No occurrences of the old pattern should remain

# Search for old pattern usage
rg "Отчет\.Таблица.*ВыделяемаяПамять" --type os
rg "КолонкиОтчетаБенчмарков\.ВыделяемаяПамять" --type os

Length of output: 162


🏁 Script executed:

#!/usr/bin/env bash
# Re-run search for old memory access pattern without file-type restriction
# Expected: no matches if all old API calls have been replaced

rg "Отчет\.Таблица.*ВыделяемаяПамять"
rg "КолонкиОтчетаБенчмарков\.ВыделяемаяПамять"

Length of output: 354


Fix remaining old memory API references

The search uncovered two places still using the old Отчет.Таблица…ВыделяемаяПамять pattern. Please update these to use the new РезультатыЗапусков[0].Статистика.ВыделяемаяПамять API (or remove them if no longer needed):

• tests/ТестыКонфигурации.os

// before  
Ожидаем.Что(Результат.Отчет.Таблица[0]["ВыделяемаяПамять"]).Заполнено();  
// after  
Ожидаем.Что(Результат.РезультатыЗапусков[0].Статистика.ВыделяемаяПамять).Заполнено();  

• src/BenchmarkOneScript/columns/Модули/КолонкаОтчетаБенчмарковВыделяемаяПамять.os

// before  
Колонка = Новый КолонкаОтчетаБенчмарков(КолонкиОтчетаБенчмарков.ВыделяемаяПамять);  
// after (example)  
Колонка = Новый КолонкаСтатистики(Статистика.ВыделяемаяПамять);  

(Or remove this column if the table-based report is deprecated.)

🤖 Prompt for AI Agents
In tests/ТестыЗамеров.os at line 20 and related files tests/ТестыКонфигурации.os
and
src/BenchmarkOneScript/columns/Модули/КолонкаОтчетаБенчмарковВыделяемаяПамять.os,
update all remaining old API references accessing allocated memory statistics
via Отчет.Таблица or КолонкиОтчетаБенчмарков.ВыделяемаяПамять to use the new
direct API РезультатыЗапусков[0].Статистика.ВыделяемаяПамять. Replace
expressions like Результат.Отчет.Таблица[0]["ВыделяемаяПамять"] with
Результат.РезультатыЗапусков[0].Статистика.ВыделяемаяПамять, and refactor or
remove column definitions relying on the old table-based pattern accordingly.

Copy link

@Stivo182 Stivo182 merged commit 73f1dd8 into main May 31, 2025
19 of 20 checks passed
@Stivo182 Stivo182 deleted the tests/allocations-of-empty-bench branch May 31, 2025 18:42
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.

1 participant