Skip to content

Reapply "[llvm-lit] Add precommit test to verify current behavior of glob expansion in lit's internal shell" (#106763) #107169

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
Sep 5, 2024

Conversation

Harini0924
Copy link
Contributor

This reverts commit 5af4ba2.

The previous patch was missing the closing parenthesis ) in the CHECK statement in the llvm/utils/lit/tests/shtest-glob.py file:

# CHECK: FAIL: shtest-glob :: glob-mkdir.txt ({{[^)]*}}

This issue broke some build bots. This patch corrects the CHECK statement by adding the closing parenthesis:

# CHECK: FAIL: shtest-glob :: glob-mkdir.txt ({{[^)]*}})

…glob expansion in lit's internal shell" (llvm#106763)

This reverts commit 5af4ba2.
@llvmbot
Copy link
Member

llvmbot commented Sep 4, 2024

@llvm/pr-subscribers-testing-tools

Author: None (Harini0924)

Changes

This reverts commit 5af4ba2.

The previous patch was missing the closing parenthesis ) in the CHECK statement in the llvm/utils/lit/tests/shtest-glob.py file:

# CHECK: FAIL: shtest-glob :: glob-mkdir.txt ({{[^)]*}}

This issue broke some build bots. This patch corrects the CHECK statement by adding the closing parenthesis:

# CHECK: FAIL: shtest-glob :: glob-mkdir.txt ({{[^)]*}})


Full diff: https://github.com/llvm/llvm-project/pull/107169.diff

6 Files Affected:

  • (added) llvm/utils/lit/tests/Inputs/shtest-glob/example_file1.input (+2)
  • (added) llvm/utils/lit/tests/Inputs/shtest-glob/example_file2.input (+2)
  • (added) llvm/utils/lit/tests/Inputs/shtest-glob/glob-echo.txt (+2)
  • (added) llvm/utils/lit/tests/Inputs/shtest-glob/glob-mkdir.txt (+2)
  • (added) llvm/utils/lit/tests/Inputs/shtest-glob/lit.cfg (+8)
  • (added) llvm/utils/lit/tests/shtest-glob.py (+12)
diff --git a/llvm/utils/lit/tests/Inputs/shtest-glob/example_file1.input b/llvm/utils/lit/tests/Inputs/shtest-glob/example_file1.input
new file mode 100644
index 00000000000000..0987c9081ca1f3
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-glob/example_file1.input
@@ -0,0 +1,2 @@
+## This is the first example file used for testing glob pattern matching.
+This is the first example file.
diff --git a/llvm/utils/lit/tests/Inputs/shtest-glob/example_file2.input b/llvm/utils/lit/tests/Inputs/shtest-glob/example_file2.input
new file mode 100644
index 00000000000000..f1a843f308262e
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-glob/example_file2.input
@@ -0,0 +1,2 @@
+## This is the second example file used for testing glob pattern matching.
+This is the second example file.
diff --git a/llvm/utils/lit/tests/Inputs/shtest-glob/glob-echo.txt b/llvm/utils/lit/tests/Inputs/shtest-glob/glob-echo.txt
new file mode 100644
index 00000000000000..b69f5e74fd7281
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-glob/glob-echo.txt
@@ -0,0 +1,2 @@
+## Tests glob pattern expansion by listing matching files.
+# RUN: echo %S/example_file*.input
diff --git a/llvm/utils/lit/tests/Inputs/shtest-glob/glob-mkdir.txt b/llvm/utils/lit/tests/Inputs/shtest-glob/glob-mkdir.txt
new file mode 100644
index 00000000000000..d1329f5dbfaaed
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-glob/glob-mkdir.txt
@@ -0,0 +1,2 @@
+## Tests glob pattern handling in the mkdir command.
+# RUN: not mkdir %S/example_file*.input
diff --git a/llvm/utils/lit/tests/Inputs/shtest-glob/lit.cfg b/llvm/utils/lit/tests/Inputs/shtest-glob/lit.cfg
new file mode 100644
index 00000000000000..4e5f4cac4c4653
--- /dev/null
+++ b/llvm/utils/lit/tests/Inputs/shtest-glob/lit.cfg
@@ -0,0 +1,8 @@
+import lit.formats
+
+config.name = "shtest-glob"
+config.suffixes = [".txt"]
+config.test_format = lit.formats.ShTest()
+config.test_source_root = None
+config.test_exec_root = None
+config.substitutions.append(("%{python}", '"%s"' % (sys.executable)))
diff --git a/llvm/utils/lit/tests/shtest-glob.py b/llvm/utils/lit/tests/shtest-glob.py
new file mode 100644
index 00000000000000..ae90f31907d492
--- /dev/null
+++ b/llvm/utils/lit/tests/shtest-glob.py
@@ -0,0 +1,12 @@
+## Tests glob pattern handling in echo command.
+
+# RUN: not %{lit} -a -v %{inputs}/shtest-glob \
+# RUN: | FileCheck -dump-input=fail -match-full-lines %s
+#
+# END.
+
+# CHECK: UNRESOLVED: shtest-glob :: glob-echo.txt ({{[^)]*}})
+# CHECK: TypeError: string argument expected, got 'GlobItem'
+
+# CHECK: FAIL: shtest-glob :: glob-mkdir.txt ({{[^)]*}})
+# CHECK: # error: command failed with exit status: 1

Copy link
Contributor

@fmayer fmayer left a comment

Choose a reason for hiding this comment

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

LGTM

kicked off a build of this CL on one of the bots that were failing on the original CL: https://lab.llvm.org/buildbot/#/buildrequests/1080411?redirect_to_build=true

@fmayer
Copy link
Contributor

fmayer commented Sep 4, 2024

LGTM

kicked off a build of this CL on one of the bots that were failing on the original CL: https://lab.llvm.org/buildbot/#/buildrequests/1080411?redirect_to_build=true

Actually that bot looks stuck. Started another one: https://lab.llvm.org/buildbot/#/buildrequests/1080412?redirect_to_build=true

Ah, this patch is not using spr but from your fork, so that won't work :)

Copy link
Member

@arichardson arichardson left a comment

Choose a reason for hiding this comment

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

I ran git fetch origin pull/107169/head && git merge FETCH_HEAD and confirmed that check-lit passes. LGTM

@Harini0924 Harini0924 merged commit d18ca27 into llvm:main Sep 5, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants