[clang] 4caf019 - [clang][test] Rewrote test using command substitution to work with lit internal shell syntax (#105902)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 29 14:54:43 PDT 2024
Author: Connie Zhu
Date: 2024-08-29T14:54:40-07:00
New Revision: 4caf0196c042601b1c442a5726a157fead00ecc7
URL: https://github.com/llvm/llvm-project/commit/4caf0196c042601b1c442a5726a157fead00ecc7
DIFF: https://github.com/llvm/llvm-project/commit/4caf0196c042601b1c442a5726a157fead00ecc7.diff
LOG: [clang][test] Rewrote test using command substitution to work with lit internal shell syntax (#105902)
This patch rewrites a test that uses command substitution `$()` and the
`stat` command, which are not supported by lit's internal shell. Instead
of using this syntax to perform the file size comparison done in this
test, a Python script is used instead to perform the same operation.
Fixes https://github.com/llvm/llvm-project/issues/102384.
Added:
clang/test/Modules/compare-file-size.py
Modified:
clang/test/Modules/reduced-bmi-size.cppm
Removed:
################################################################################
diff --git a/clang/test/Modules/compare-file-size.py b/clang/test/Modules/compare-file-size.py
new file mode 100644
index 00000000000000..8988d91cbcc2c3
--- /dev/null
+++ b/clang/test/Modules/compare-file-size.py
@@ -0,0 +1,20 @@
+# This program takes in two file path arguments in the form 'compare-file-size.py file1 file2'
+# Returns true if the file size of the file1 is smaller than the file size of file2
+
+import argparse
+import os
+
+
+def main():
+ parser = argparse.ArgumentParser()
+
+ parser.add_argument("file1", type=str)
+ parser.add_argument("file2", type=str)
+
+ args = parser.parse_args()
+
+ return os.path.getsize(args.file1) < os.path.getsize(args.file2)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/clang/test/Modules/reduced-bmi-size.cppm b/clang/test/Modules/reduced-bmi-size.cppm
index 664f45f5c6a5a7..6e3323266561e8 100644
--- a/clang/test/Modules/reduced-bmi-size.cppm
+++ b/clang/test/Modules/reduced-bmi-size.cppm
@@ -10,7 +10,6 @@
// RUN: %clang_cc1 -std=c++20 -emit-module-interface %s -o %t/a.pcm
// RUN: %clang_cc1 -std=c++20 -emit-reduced-module-interface %s -o %t/a.reduced.pcm
//
-// %s implies the current source file. So we can't use it directly.
-// RUN: [ $(stat -c%\s "%t/a.pcm") -le $(stat -c%\s "%t/a.reduced.pcm") ]
+// RUN: %python %S/compare-file-size.py %t/a.pcm %t/a.reduced.pcm
export module a;
More information about the cfe-commits
mailing list