[Lldb-commits] [lldb] [lldb][test] Fix beginning/end of file test failed on Windows (PR #139278)
via lldb-commits
lldb-commits at lists.llvm.org
Fri May 9 08:09:58 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Zax (hapeeeeee)
<details>
<summary>Changes</summary>
As @<!-- -->DavidSpickett mentioned, this change fixed the test failure introduced in [#<!-- -->137515](https://github.com/llvm/llvm-project/pull/137515#issuecomment-2866632780), which was caused by the use of platform-specific headers not available on Windows.
This PR does not modify any functional code; it only updates the test cases.
---
Full diff: https://github.com/llvm/llvm-project/pull/139278.diff
3 Files Affected:
- (added) lldb/test/Shell/Commands/Inputs/cross_platform.c (+31)
- (modified) lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test (+5-7)
- (modified) lldb/test/Shell/Commands/command-list-reach-end-of-file.test (+2-7)
``````````diff
diff --git a/lldb/test/Shell/Commands/Inputs/cross_platform.c b/lldb/test/Shell/Commands/Inputs/cross_platform.c
new file mode 100644
index 0000000000000..bcc484eb36ac5
--- /dev/null
+++ b/lldb/test/Shell/Commands/Inputs/cross_platform.c
@@ -0,0 +1,31 @@
+#include <stdio.h>
+void bubbleSort(int arr[], int n) {
+ for (int i = 0; i < n - 1; i++) {
+ int swapped = 0;
+ for (int j = 0; j < n - i - 1; j++) {
+ if (arr[j] > arr[j + 1]) {
+ int temp = arr[j];
+ arr[j] = arr[j + 1];
+ arr[j + 1] = temp;
+ swapped = 1;
+ }
+ }
+ if (!swapped)
+ break;
+ }
+}
+
+int main() {
+ int arr[] = {64, 34, 25, 12, 22, 11, 90};
+ int n = sizeof(arr) / sizeof(arr[0]);
+
+ for (int i = 0; i < n; i++)
+ printf("%d ", arr[i]);
+ printf("\n");
+
+ bubbleSort(arr, n);
+ for (int i = 0; i < n; i++)
+ printf("%d ", arr[i]);
+ printf("\n");
+ return 0;
+}
diff --git a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
index fa4a93e5904aa..29c33f6fe105e 100644
--- a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
+++ b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test
@@ -1,6 +1,4 @@
-# Source uses unistd.h.
-# UNSUPPORTED: system-windows
-# RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out
+# RUN: %clang_host -g -O0 %S/Inputs/cross_platform.c -o %t.out
# RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s
list
@@ -13,13 +11,13 @@ r
# CHECK: int main()
list
-# CHECK: if (child_pid == 0)
+# CHECK: bubbleSort(arr, n);
list -
# CHECK: int main()
-list -10
-# CHECK: #include <assert.h>
+list -20
+# CHECK: #include <stdio.h>
list -
# CHECK: note: Reached beginning of the file, no more to page
@@ -28,4 +26,4 @@ list -
# CHECK: note: Reached beginning of the file, no more to page
list
-# CHECK: int main()
+# CHECK: bubbleSort(arr, n);
diff --git a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test
index edf4c521a9e76..d6909b85a390b 100644
--- a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test
+++ b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test
@@ -1,6 +1,4 @@
-# Source uses unistd.h.
-# UNSUPPORTED: system-windows
-# RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out
+# RUN: %clang_host -g -O0 %S/Inputs/cross_platform.c -o %t.out
# RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s
list
@@ -13,10 +11,7 @@ r
# CHECK: int main()
list
-# CHECK: if (child_pid == 0)
-
-list
-# CHECK: printf("signo = %d\n", SIGCHLD);
+# CHECK: bubbleSort(arr, n);
list
# CHECK: return 0;
``````````
</details>
https://github.com/llvm/llvm-project/pull/139278
More information about the lldb-commits
mailing list