llvm-project/lldb/test/Shell/Platform/AutoLoad/Darwin/dsym-python-script-name-warnings.test
Michael Buch 740f1b56c9
[lldb][PlatformDarwin] Reword warning when locating scripting resources from dSYM (#185666)
This patch makes the warning message more concise (in my opinion). We
would duplicate the file path multiple times in the message. I'm
planning on factoring this logic into a standalone function, and having
it rely on fewer parameters helps with that.

Before:
```
warning: the symbol file '/path/to/.dSYM/Contents/Resources/DWARF/import' contains a debug script.
However, its name '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py' conflicts with a keyword
and as such cannot be loaded. LLDB will load '/path/to/.dSYM/Contents/Resources/DWARF/../Python/_import.py' instead.
Consider removing the file with the malformed name to eliminate this warning.
```

After:
```
warning: debug script '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py' cannot be loaded
because 'import.py' conflicts with the keyword 'import'. Ignoring 'import.py' and loading '_import.py' instead.
```

Before:
```
warning: the symbol file '/path/to/.dSYM/Contents/Resources/DWARF/import' contains a debug script.
However, its name conflicts with a keyword and as such cannot be loaded.
If you intend to have this script loaded, please rename '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py'
to '/path/to/.dSYM/Contents/Resources/DWARF/../Python/_import.py' and retry.
```

After:
```
warning: debug script '/path/to/.dSYM/Contents/Resources/DWARF/../Python/import.py' cannot be loaded
because 'import.py' conflicts with the keyword 'import'. If you intend to have this script loaded, please rename
it to '_import.py' and retry.
```
2026-03-17 10:09:58 +00:00

40 lines
1.6 KiB
Plaintext

# REQUIRES: python, system-darwin
# Tests that LLDB prints warning messages that occur while locating scripts in dSYMs.
# RUN: split-file %s %t
## Module name contains reserved characters but no script with a corrected
## name exists.
# RUN: %clang_host -g %t/main.c -o "%t/Test-Module.out"
# RUN: mkdir -p "%t/Test-Module.out.dSYM/Contents/Resources/Python"
# RUN: touch "%t/Test-Module.out.dSYM/Contents/Resources/Python/Test-Module.py"
# RUN: %lldb -b \
# RUN: -o 'target create "%t/Test-Module.out"' 2>&1 \
# RUN: | FileCheck %s --check-prefix=CHECK-RENAME
# CHECK-RENAME: warning: {{.*}} 'Test-Module.py' contains reserved characters
# CHECK-RENAME-SAME: If you intend to have this script loaded, please rename
## Module name contains reserved characters but a script with a corrected
## name does exists.
# RUN: %clang_host -g %t/main.c -o "%t/Test-Module2.out"
# RUN: mkdir -p "%t/Test-Module2.out.dSYM/Contents/Resources/Python"
# RUN: touch "%t/Test-Module2.out.dSYM/Contents/Resources/Python/Test_Module2.py"
# RUN: touch "%t/Test-Module2.out.dSYM/Contents/Resources/Python/Test-Module2.py"
# RUN: %lldb -b \
# RUN: -o 'target create "%t/Test-Module2.out"' 2>&1 \
# RUN: | FileCheck %s --check-prefix=CHECK-REMOVE
# CHECK-REMOVE: warning: {{.*}} 'Test-Module2.py' contains reserved characters
# CHECK-REMOVE-SAME: Ignoring 'Test-Module2.py' and loading 'Test_Module2.py' instead.
## Also confirm that the warning message about auto-loading scripts is printed afterwards.
# CHECK-REMOVE: warning: 'Test-Module2' contains a debug script. To run this script in this
#--- main.c
int main() { return 0; }