Skip to content

Port more test cases to the DSL with SORT, STAT and $CORES - #815

Merged
jviotti merged 2 commits into
mainfrom
more-dsl-tests
Aug 12, 2026
Merged

Port more test cases to the DSL with SORT, STAT and $CORES#815
jviotti merged 2 commits into
mainfrom
more-dsl-tests

Conversation

@jviotti

@jviotti jviotti commented Aug 12, 2026

Copy link
Copy Markdown
Member

Signed-off-by: Juan Cruz Viotti jv@jviotti.com

Review in cubic

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@augmentcode

augmentcode Bot commented Aug 12, 2026

Copy link
Copy Markdown
🤖 Augment PR Summary

Summary: This PR ports additional shell-based CLI tests to the Python clitest DSL.

Changes:

  • Adds DSL primitives for sorting file contents and recording nanosecond modification times.
  • Introduces a reserved $CORES variable for asserting default parallelism output.
  • Migrates formatter mtime, cURL-loading, and multi-job test scenarios from shell scripts.
  • Registers the migrated tests through the platform-neutral CMake test helper.
  • Updates the missing-cURL CI test to use the DSL under its existing Linux gate.

Technical Notes:

  • Parallel-output tests normalize paths and sort output where ordering is intentionally nondeterministic.
  • Error-output assertions retain the DSL's stdout/stderr prefixes for exact comparison.

🤖 Was this summary useful? React with 👍 or 👎

@augmentcode augmentcode Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Review completed. 2 suggestions posted.

Fix All in Augment

Comment augment review to trigger a new review at any time.

@@ -0,0 +1,30 @@
// The shell original slept for a second so that a rewrite would show up even
// at one second timestamp granularity. Modern filesystems record nanoseconds,
// so an immediate rewrite is detectable without the delay

@augmentcode augmentcode Bot Aug 12, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

test/format/pass_single_intact_mtime.clitest:3: This assumes nanosecond mtime resolution, but this test now runs on every platform and temporary directories can be backed by filesystems with coarser resolution. A formatter that rewrites the identical file within the same timestamp tick would still pass, so the migrated test no longer reliably enforces the no-rewrite guarantee.

Severity: low

Fix This in Augment

🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.

Comment thread test/test/fail_multi_jobs.clitest

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

1 issue found across 18 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="test/format/pass_single_intact_mtime.clitest">

<violation number="1" location="test/format/pass_single_intact_mtime.clitest:16">
P3: This test now runs on every platform (previously UNIX-only), but it relies on nanosecond mtime resolution via STAT MTIME without any delay between writes. On filesystems or platforms with coarser mtime granularity, a formatter that rewrites the identical file within the same timestamp tick would still pass this check, so the migrated test may no longer reliably enforce the no-rewrite guarantee that the original shell test (with its 1-second sleep) guaranteed.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread scripts/clitest.py

COPY schema.json TO original.json

STAT MTIME schema.json INTO mtime_before.txt

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P3: This test now runs on every platform (previously UNIX-only), but it relies on nanosecond mtime resolution via STAT MTIME without any delay between writes. On filesystems or platforms with coarser mtime granularity, a formatter that rewrites the identical file within the same timestamp tick would still pass this check, so the migrated test may no longer reliably enforce the no-rewrite guarantee that the original shell test (with its 1-second sleep) guaranteed.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At test/format/pass_single_intact_mtime.clitest, line 16:

<comment>This test now runs on every platform (previously UNIX-only), but it relies on nanosecond mtime resolution via STAT MTIME without any delay between writes. On filesystems or platforms with coarser mtime granularity, a formatter that rewrites the identical file within the same timestamp tick would still pass this check, so the migrated test may no longer reliably enforce the no-rewrite guarantee that the original shell test (with its 1-second sleep) guaranteed.</comment>

<file context>
@@ -0,0 +1,30 @@
+
+COPY schema.json TO original.json
+
+STAT MTIME schema.json INTO mtime_before.txt
+
+RUN fmt schema.json STDIN /dev/null IN . INTO result_0.txt EXPECTING 0
</file context>

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
@jviotti
jviotti merged commit 944ef47 into main Aug 12, 2026
16 checks passed
@jviotti
jviotti deleted the more-dsl-tests branch August 12, 2026 14:18
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