[llvm] Reapply "[llvm-lit] Add precommit test to verify current behavior of glob expansion in lit's internal shell" (#106763) (PR #107169)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 3 17:02:15 PDT 2024
https://github.com/Harini0924 created https://github.com/llvm/llvm-project/pull/107169
This reverts commit 5af4ba2684b9b59de3bf8135f62e05ab68cfc489.
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 ({{[^)]*}})`
>From da9f2c6ecdbb4d9db6c8db39071eaa284401426b Mon Sep 17 00:00:00 2001
From: Harini <harinidonthula at google.com>
Date: Tue, 3 Sep 2024 23:51:44 +0000
Subject: [PATCH] Reapply "[llvm-lit] Add precommit test to verify current
behavior of glob expansion in lit's internal shell" (#106763)
This reverts commit 5af4ba2684b9b59de3bf8135f62e05ab68cfc489.
---
.../lit/tests/Inputs/shtest-glob/example_file1.input | 2 ++
.../lit/tests/Inputs/shtest-glob/example_file2.input | 2 ++
.../utils/lit/tests/Inputs/shtest-glob/glob-echo.txt | 2 ++
.../lit/tests/Inputs/shtest-glob/glob-mkdir.txt | 2 ++
llvm/utils/lit/tests/Inputs/shtest-glob/lit.cfg | 8 ++++++++
llvm/utils/lit/tests/shtest-glob.py | 12 ++++++++++++
6 files changed, 28 insertions(+)
create mode 100644 llvm/utils/lit/tests/Inputs/shtest-glob/example_file1.input
create mode 100644 llvm/utils/lit/tests/Inputs/shtest-glob/example_file2.input
create mode 100644 llvm/utils/lit/tests/Inputs/shtest-glob/glob-echo.txt
create mode 100644 llvm/utils/lit/tests/Inputs/shtest-glob/glob-mkdir.txt
create mode 100644 llvm/utils/lit/tests/Inputs/shtest-glob/lit.cfg
create mode 100644 llvm/utils/lit/tests/shtest-glob.py
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
More information about the llvm-commits
mailing list