Skip to content
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

feat: print test text when the test fails #1927

Merged
merged 3 commits into from
Feb 7, 2025
Merged

Conversation

oneirocosm
Copy link
Member

No description provided.

Copy link
Contributor

coderabbitai bot commented Feb 7, 2025

Walkthrough

The pull request introduces changes to the tests/copytests/runner.sh script by adding new variables to track the total number of copy tests run and passed. Two variables, TOTAL_COPY_TESTS_RUN and TOTAL_COPY_TESTS_PASSED, are initialized to zero and updated during the test execution process. The script increments TOTAL_COPY_TESTS_RUN after each test, while TOTAL_COPY_TESTS_PASSED is incremented only for passing tests. Additionally, the formatting of failure messages is adjusted to eliminate the newline after the error output, and the contents of the failing test script are displayed immediately after the failure message, followed by an additional newline. A summary message indicating the number of tests passed out of the total run is printed at the end of the execution loop. No changes were made to the declarations of exported or public entities.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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
Contributor

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

🧹 Nitpick comments (1)
tests/copytests/runner.sh (1)

10-12: Enhanced Failure Output for Debugging
The revised error handling prints the failure message and immediately outputs the content of the failing test script. This is beneficial for debugging since it provides immediate context. Consider whether additional headers or separators would improve readability in cases of extensive output.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6139fee and 63dfbcb.

📒 Files selected for processing (1)
  • tests/copytests/runner.sh (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (go)
  • GitHub Check: Build for TestDriver.ai

Copy link
Contributor

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

🧹 Nitpick comments (14)
tests/copytests/cases/test032.sh (1)

1-1: Add Shebang Directive

It’s advisable to add a shebang (for example, #!/usr/bin/env bash) at the very top of the script. This directly addresses Shellcheck’s SC2148 warning and ensures that the script runs with the intended shell interpreter.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test034.sh (1)

1-1: Add Shebang Directive

For better portability and to satisfy Shellcheck recommendations, consider adding a shebang (e.g. #!/usr/bin/env bash) as the first line of the script.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test036.sh (1)

1-1: Add Shebang Directive

Adding a shebang (e.g. #!/usr/bin/env bash) at the top will ensure the script is executed with the proper shell and eliminates Shellcheck warnings.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test037.sh (1)

1-1: Add Shebang Directive

To improve script clarity and avoid shell-detection warnings, please consider inserting a shebang (e.g. #!/usr/bin/env bash) at the very start of the script.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test038.sh (1)

1-1: Add Shebang Directive

As with the other test scripts, adding a shebang (e.g. #!/usr/bin/env bash) at the top is recommended to ensure consistent execution and to satisfy Shellcheck.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test040.sh (1)

1-1: Add Shebang Directive
This script currently starts with a comment and lacks a shebang. Adding a shebang (e.g. “#!/bin/bash”) at the very top ensures that the proper shell is used during execution.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test051.sh (1)

1-1: Add Shebang Directive
The file does not start with a shebang line. Adding one (e.g. “#!/bin/bash”) can help avoid ambiguity regarding the shell under which the script runs.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test049.sh (1)

1-1: Add Shebang Directive
Consider adding a shebang (e.g. “#!/bin/bash”) at the top of this script to clearly indicate which shell should execute it.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test041.sh (1)

1-1: Add Shebang Directive
This test script would benefit from an explicit shebang (e.g. “#!/bin/bash”) at its beginning to ensure consistent execution across environments.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test042.sh (1)

1-1: Add Shebang Directive
It is recommended to add a shebang line (e.g. “#!/bin/bash”) at the top of this script to avoid potential execution issues related to an unspecified shell environment.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test043.sh (1)

1-1: Consider Adding a Shebang Directive.
For consistency and to satisfy shellcheck (SC2148), please add a shebang (for example, "#!/bin/bash") at the very top of the file.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test044.sh (1)

1-1: Consider Adding a Shebang Directive.
Adding a shebang (e.g., "#!/bin/bash") at the top would improve clarity and help static analyzers determine the intended shell environment.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test045.sh (1)

1-1: Consider Adding a Shebang Directive.
Including a shebang (for example, "#!/bin/bash") at the very start of the script is recommended for clarity and to satisfy shellcheck requirements.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test052.sh (1)

1-1: Consider Adding a Shebang Directive.
For improved portability and to meet shellcheck suggestions, consider adding a shebang (e.g., "#!/bin/bash") at the top of this file.

🧰 Tools
🪛 Shellcheck (0.10.0)

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b9a7bb0 and 68b26f9.

📒 Files selected for processing (20)
  • tests/copytests/cases/test031.sh (0 hunks)
  • tests/copytests/cases/test032.sh (1 hunks)
  • tests/copytests/cases/test033.sh (0 hunks)
  • tests/copytests/cases/test034.sh (1 hunks)
  • tests/copytests/cases/test035.sh (0 hunks)
  • tests/copytests/cases/test036.sh (1 hunks)
  • tests/copytests/cases/test037.sh (1 hunks)
  • tests/copytests/cases/test038.sh (1 hunks)
  • tests/copytests/cases/test039.sh (0 hunks)
  • tests/copytests/cases/test040.sh (1 hunks)
  • tests/copytests/cases/test041.sh (2 hunks)
  • tests/copytests/cases/test042.sh (2 hunks)
  • tests/copytests/cases/test043.sh (2 hunks)
  • tests/copytests/cases/test044.sh (2 hunks)
  • tests/copytests/cases/test045.sh (2 hunks)
  • tests/copytests/cases/test048.sh (0 hunks)
  • tests/copytests/cases/test049.sh (2 hunks)
  • tests/copytests/cases/test050.sh (0 hunks)
  • tests/copytests/cases/test051.sh (2 hunks)
  • tests/copytests/cases/test052.sh (1 hunks)
💤 Files with no reviewable changes (6)
  • tests/copytests/cases/test031.sh
  • tests/copytests/cases/test039.sh
  • tests/copytests/cases/test050.sh
  • tests/copytests/cases/test035.sh
  • tests/copytests/cases/test033.sh
  • tests/copytests/cases/test048.sh
🧰 Additional context used
🪛 Shellcheck (0.10.0)
tests/copytests/cases/test042.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test041.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test051.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test034.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test036.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test049.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test037.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test032.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test044.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test043.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test040.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test045.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

tests/copytests/cases/test038.sh

[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.

(SC2148)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Build for TestDriver.ai
  • GitHub Check: Analyze (go)
🔇 Additional comments (14)
tests/copytests/cases/test032.sh (1)

8-8: Update Copy Command

The copy command has been updated from using a recursive flag (‑r) to a simple non‑recursive form (“wsh file copy foo bar”). This change is consistent with the overall refactoring of copy behavior. Please ensure that this new behavior is as intended for copying an empty directory.

tests/copytests/cases/test034.sh (1)

8-8: Remove Recursive Flag

The command change from “wsh file copy -r bar/ baz” to “wsh file copy bar/ baz” aligns with the new testing approach of non-recursive copy. Verify that the test’s expectations (i.e. the creation of the “baz” directory) remain valid with this updated behavior.

tests/copytests/cases/test036.sh (1)

8-8: Confirm Non‑Recursive Copy Behavior

The removal of the “-r” flag in the command (now “wsh file copy bar baz/”) is in line with the updated behavior. Please double-check that non‑recursive copying is indeed the intended functionality for this test case.

tests/copytests/cases/test037.sh (1)

8-8: Verify Path Notation

While removing the recursive flag (‑r) is appropriate, the updated command now reads “wsh file copy bar// baz”. Please verify that using a double slash (“bar//”) in the source path is intentional and that the underlying copy functionality handles this path format correctly.

tests/copytests/cases/test038.sh (1)

8-8: Confirm Target Directory Format

The command change from “wsh file copy -r bar baz//” to “wsh file copy bar baz//” removes the recursive option. However, please confirm whether the target directory’s trailing double slashes (“baz//”) are intentional and that they do not inadvertently affect directory creation or subsequent tests.

tests/copytests/cases/test040.sh (1)

9-9: Update Copy Command Syntax
The command on line 9 now omits the “-r” flag (changed from “wsh file copy -r bar baz” to “wsh file copy bar baz”). Please confirm that the non‑recursive copy behavior is intended and that the test’s verification (checking for “baz/foo.txt”) correctly reflects the desired outcome.

tests/copytests/cases/test051.sh (1)

10-10: Update Copy Command Syntax
On line 10, the copy command has been updated from using the recursive flag (“-r”) to “wsh file copy . ../baz”. Verify that this change is intentional and that the test still properly validates the copy operation—especially given that the working directory changes (from “foo” back to the parent) and the expected file “baz/bar.txt” is checked.

tests/copytests/cases/test049.sh (1)

11-11: Update Copy Command Syntax
Line 11 now uses “wsh file copy . ../baz” without the “-r” flag. Please ensure that this reflects the intended non-recursive behavior and that the subsequent verification (checking for the file’s existence in “baz/bar.txt”) is still valid.

tests/copytests/cases/test041.sh (1)

10-10: Update Copy Command Syntax
The command on line 10 has been modified from “wsh file -r bar baz” to “wsh file copy bar baz”. This update implies a shift to non‑recursive copying. Please double-check that the new behavior (and the subsequent file check for “baz/bar/foo.txt”) matches the intended test conditions.

tests/copytests/cases/test042.sh (1)

10-10: Update Copy Command Syntax with Trailing Slash
The copy command on line 10 now reads “wsh file copy bar baz/”. The trailing slash on the destination directory suggests that the content of “bar” should be placed inside “baz”. Verify that the expected behavior (as checked by the test for “baz/bar/foo.txt”) is correct under the new, non‑recursive copy operation.

tests/copytests/cases/test043.sh (1)

10-10: Removal of the -r Flag in the Copy Command.
The command "wsh file copy bar baz/." no longer includes the "-r" flag. Please verify that the underlying copy functionality now handles directory copying as expected without recursion and that the test’s intended outcome (creation of "baz/bar/foo.txt") is still met.

tests/copytests/cases/test044.sh (1)

10-10: Updated Copy Command Without the -r Flag.
The removal of the "-r" flag from "wsh file copy foo qux" is consistent with the overall project changes. Please ensure that this adjustment still results in the expected output (i.e. the file "qux/bar/baz.txt" being present) and that the non-recursive behavior is deliberate.

tests/copytests/cases/test045.sh (1)

11-11: Removal of the -r Flag in the Copy Command.
The copy command "wsh file copy foo qux" (without the -r flag) reflects the intended change. Please double-check that the nested file structure (resulting in "qux/foo/bar/baz.txt") is correctly produced by this command.

tests/copytests/cases/test052.sh (1)

17-17: Updated Directory Copy Command Without the -r Flag.
The change from "wsh file copy -r foo corge/foo" to "wsh file copy foo corge/foo" is consistent with the other test changes. Confirm that this modification correctly preserves the entire directory structure so that later MD5 comparisons accurately reflect equivalent contents.

@oneirocosm oneirocosm merged commit 8b26244 into main Feb 7, 2025
7 of 8 checks passed
@oneirocosm oneirocosm deleted the sylvie/test-printtest branch February 7, 2025 22:45
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