Skip to content

Conversation

cmtice
Copy link
Contributor

@cmtice cmtice commented Sep 4, 2025

These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem.

These tests were failing on darwin, because the internal shell
needs environment var definitions to start with 'env'.  This PR
(hopefully) fixes that problem.
@cmtice cmtice requested a review from JDevlieghere as a code owner September 4, 2025 17:15
@llvmbot llvmbot added the lldb label Sep 4, 2025
@llvmbot
Copy link
Member

llvmbot commented Sep 4, 2025

@llvm/pr-subscribers-lldb

Author: None (cmtice)

Changes

These tests were failing on darwin, because the internal shell needs environment var definitions to start with 'env'. This PR (hopefully) fixes that problem.


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

3 Files Affected:

  • (modified) lldb/test/Shell/Host/TestCustomShell.test (+1-1)
  • (modified) lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp (+1-1)
  • (modified) lldb/test/Shell/SymbolFile/add-dsym.test (+1-1)
diff --git a/lldb/test/Shell/Host/TestCustomShell.test b/lldb/test/Shell/Host/TestCustomShell.test
index 0e948a1b1f7f3..5d3e90162fb28 100644
--- a/lldb/test/Shell/Host/TestCustomShell.test
+++ b/lldb/test/Shell/Host/TestCustomShell.test
@@ -6,7 +6,7 @@
 # XFAIL: system-openbsd
 
 # RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
-# RUN: SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR
+# RUN: env SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR
 # RUN: env -i ASAN_OPTIONS='detect_container_overflow=0' %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s
 
 # ERROR: error: shell expansion failed
diff --git a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
index 9e79f23db2b74..a45f794c73a43 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
+++ b/lldb/test/Shell/SymbolFile/DWARF/deterministic-build.cpp
@@ -3,7 +3,7 @@
 // requires the ld64 linker, which clang invokes by default.
 // REQUIRES: system-darwin
 // RUN: %clang_host %s -g -c -o %t.o
-// RUN: ZERO_AR_DATE=1 %clang_host %t.o -g -o %t
+// RUN: env ZERO_AR_DATE=1 %clang_host %t.o -g -o %t
 // RUN: %lldb %t -o "breakpoint set -f %s -l 11" -o run -o exit | FileCheck %s
 // CHECK: stop reason = breakpoint
 
diff --git a/lldb/test/Shell/SymbolFile/add-dsym.test b/lldb/test/Shell/SymbolFile/add-dsym.test
index 52d1a1363feef..9695ddc297aa9 100644
--- a/lldb/test/Shell/SymbolFile/add-dsym.test
+++ b/lldb/test/Shell/SymbolFile/add-dsym.test
@@ -4,5 +4,5 @@
 # HELP: Syntax: add-dsym <cmd-options> <filename>
 
 # RUN: yaml2obj %S/Inputs/a.yaml -o %t.out
-# RUN: LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s
+# RUN: env LLDB_APPLE_DSYMFORUUID_EXECUTABLE=%S/Inputs/dsymforuuid.sh %lldb %t.out -o 'add-dsym -u 41945CA4-5D9D-3CDE-82B4-37E4C09750B5' 2>&1 | FileCheck %s
 # CHECK: UUID information was not found

@cmtice
Copy link
Contributor Author

cmtice commented Sep 4, 2025

I need someone with a darwin system to verify that this actually fixes the breakages from here:
https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/14836/

Copy link

github-actions bot commented Sep 4, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Contributor

@boomanaiden154 boomanaiden154 left a comment

Choose a reason for hiding this comment

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

lldb/test/Shell/Host/TestCustomShell.test will still fail after this, but this change is still necessary either way. It does fix the other two tests and enables implementing env -i within lit's internal shell to fix lldb/test/Shell/Host/TestCustomShell.test.

I'm hoping to get to implementing env -i within the next hour or two.

# RUN: %clang_host %S/Inputs/simple.c -g -o %t.out
# RUN: SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR
# RUN: env SHELL=bogus not %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s --check-prefix ERROR
# RUN: env -i ASAN_OPTIONS='detect_container_overflow=0' %lldb %t.out -b -o 'process launch -X 1 --' 2>&1 | FileCheck %s
Copy link
Contributor

Choose a reason for hiding this comment

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

This will still fail because lit's internal shell doesn't support env -i yet (and I confirmed that it still fails locally).

@boomanaiden154
Copy link
Contributor

I've tested this locally on Darwin. I can confirm it fixes part of TestCustomShell.test and completely fixes the other two tests.

@cmtice
Copy link
Contributor Author

cmtice commented Sep 4, 2025

lldb/test/Shell/Host/TestCustomShell.test will still fail after this, but this change is still necessary either way. It does fix the other two tests and enables implementing env -i within lit's internal shell to fix lldb/test/Shell/Host/TestCustomShell.test.

I'm hoping to get to implementing env -i within the next hour or two.

So even if I commit the PR, the GreenDragon builder will continue to fail until you get 'env -i' implemented. Is that acceptable? Or do I need to actually revert the change that makes internal shell the default until the 'env -i' fix is committed. @JDevlieghere , @adrian-prantl what do you think?

@boomanaiden154
Copy link
Contributor

Whether or not to revert the internal shell PR is a separate question from whether or not to land this patch.

This patch needs to go in either way for us to be able to enable the internal shell.

@cmtice cmtice merged commit e6aefbe into llvm:main Sep 4, 2025
9 checks passed
@adrian-prantl
Copy link
Collaborator

@cmtice
Copy link
Contributor Author

cmtice commented Sep 4, 2025

@cmtice @boomanaiden154 1/3 are still failing:

https://green.lab.llvm.org/job/llvm.org/view/LLDB/job/lldb-cmake/14864/testReport/lldb-shell/SymbolFile_DWARF/deterministic_build_cpp/

Ok, looking into it. If we can't get it fixed soon, we'll go ahead and revert.

boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Sep 4, 2025
This test was brokem by migrating to the lit internal shell due to a
lack of env prefix for setting environment variables. This was fixed in
prevented the breakpoint in the test from mapping to anything, causing
the test to file. This patch restores the original line numbering.
boomanaiden154 added a commit that referenced this pull request Sep 4, 2025
This test was brokem by migrating to the lit internal shell due to a
lack of env prefix for setting environment variables. This was fixed in
prevented the breakpoint in the test from mapping to anything, causing
the test to file. This patch restores the original line numbering.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants