Skip to content

lldb: android: fix missing Python import of urlparse in lldb test utilities #99934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 23, 2024

Conversation

andrurogerz
Copy link
Contributor

@andrurogerz andrurogerz commented Jul 22, 2024

Issue

Attempting to run the lldb API tests against a remote-android target fails with the error NameError: name 'urlparse' is not defined.

Root Cause

It looks the Python import of urlparse was removed by mistake in 22ea97d. This import is only used when running the lldb API tests against a remote-android target so it went unnoticed.

Fix

This change simply puts back the missing import. It is a one line change.

fixes #99931

Validation

Tested on Fedora 39 with an attached Android device:

cd llvm-project
cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;lldb' -DCMAKE_BUILD_TYPE=Release -DLLDB_ENABLE_PYTHON=On
ninja -C build
./build/bin/lldb-dotest --arch aarch64 --out-of-tree-debugserver --platform-name=remote-android --platform-working-dir=/data/local/tmp/ds2 --platform-url=connect://localhost:5432 --compiler ~/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang

This import is only used on the Android path. It looks like it was
removed by mistake in 22ea97d.
Copy link

Thank you for submitting a Pull Request (PR) to the LLVM Project!

This PR will be automatically labeled and the relevant teams will be
notified.

If you wish to, you can add reviewers by using the "Reviewers" section on this page.

If this is not working for you, it is probably because you do not have write
permissions for the repository. In which case you can instead tag reviewers by
name in a comment by using @ followed by their GitHub username.

If you have received no comments on your PR for a week, you can request a review
by "ping"ing the PR by adding a comment “Ping”. The common courtesy "ping" rate
is once a week. Please remember that you are asking for valuable time from other developers.

If you have further questions, they may be answered by the LLVM GitHub User Guide.

You can also ask questions in a comment on this PR, on the LLVM Discord or on the forums.

@llvmbot llvmbot added the lldb label Jul 22, 2024
@andrurogerz
Copy link
Contributor Author

cc @compnerd

@llvmbot
Copy link
Member

llvmbot commented Jul 22, 2024

@llvm/pr-subscribers-lldb

Author: Andrew Rogers (andrurogerz)

Changes

Issue

Attempting to run the lldb API tests against a remote-android target fails with the error NameError: name 'urlparse' is not defined.

Root Cause

It looks the Python import of urlparse was removed by mistake in 22ea97d. This import is only used when running the lldb API tests against a remote-android target so it went unnoticed.

Fix

This change simply puts back the missing import. It is a one line change.

fixes 99931

Validation

Tested on Fedora 39 with an attached Android device:

cd llvm-project
cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;lldb' -DCMAKE_BUILD_TYPE=Release -DLLDB_ENABLE_PYTHON=On
ninja -C build
./build/bin/lldb-dotest --arch aarch64 --out-of-tree-debugserver --platform-name=remote-android --platform-working-dir=/data/local/tmp/ds2 --platform-url=connect://localhost:5432 --compiler ~/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang


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

1 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/lldbplatformutil.py (+1)
diff --git a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
index b7e6f240f59f6..e3c6fd1a99568 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbplatformutil.py
@@ -9,6 +9,7 @@
 import sys
 import os
 from packaging import version
+from urllib.parse import urlparse
 
 # LLDB modules
 import lldb

@andrurogerz andrurogerz changed the title lldb: android: fix missing Python import of urlparse from lldb test utilities lldb: android: fix missing Python import of urlparse in lldb test utilities Jul 22, 2024
@compnerd compnerd merged commit ca102b2 into llvm:main Jul 23, 2024
8 checks passed
Copy link

@andrurogerz Congratulations on having your first Pull Request (PR) merged into the LLVM Project!

Your changes will be combined with recent changes from other authors, then tested
by our build bots. If there is a problem with a build, you may receive a report in an email or a comment on this PR.

Please check whether problems have been caused by your change specifically, as
the builds can include changes from many authors. It is not uncommon for your
change to be included in a build that fails due to someone else's changes, or
infrastructure issues.

How to do this, and the rest of the post-merge process, is covered in detail here.

If your change does cause a problem, it may be reverted, or you can revert it yourself.
This is a normal part of LLVM development. You can fix your changes and open a new PR to merge them again.

If you don't get any reports, no action is required from you. Your changes are working as expected, well done!

@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 23, 2024

LLVM Buildbot has detected a new failure on builder lldb-aarch64-ubuntu running on linaro-lldb-aarch64-ubuntu while building lldb at step 6 "test".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/2088

Here is the relevant piece of the build log for the reference:

Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: commands/platform/basic/TestPlatformCommand.py (180 of 1994)
PASS: lldb-api :: commands/memory/write/TestMemoryWrite.py (181 of 1994)
PASS: lldb-api :: commands/platform/file/read/TestPlatformFileRead.py (182 of 1994)
PASS: lldb-api :: commands/platform/file/close/TestPlatformFileClose.py (183 of 1994)
PASS: lldb-api :: commands/memory/read/TestMemoryRead.py (184 of 1994)
PASS: lldb-api :: commands/platform/connect/TestPlatformConnect.py (185 of 1994)
UNSUPPORTED: lldb-api :: commands/platform/sdk/TestPlatformSDK.py (186 of 1994)
PASS: lldb-api :: commands/platform/process/list/TestProcessList.py (187 of 1994)
PASS: lldb-api :: commands/platform/process/launch/TestPlatformProcessLaunch.py (188 of 1994)
UNRESOLVED: lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py (189 of 1994)
******************** TEST 'lldb-api :: commands/gui/spawn-threads/TestGuiSpawnThreads.py' FAILED ********************
Script:
--
/usr/bin/python3.8 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env ARCHIVER=/usr/local/bin/llvm-ar --env OBJCOPY=/usr/bin/llvm-objcopy --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads -p TestGuiSpawnThreads.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 20.0.0git (https://github.com/llvm/llvm-project.git revision ca102b2114fa8a00096d71ff9fc3b1b218f0f01a)
  clang revision ca102b2114fa8a00096d71ff9fc3b1b218f0f01a
  llvm revision ca102b2114fa8a00096d71ff9fc3b1b218f0f01a
Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc']

--
Command Output (stderr):
--
FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
======================================================================
ERROR: test_gui (TestGuiSpawnThreads.TestGuiSpawnThreadsTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 148, in wrapper
    return func(*args, **kwargs)
  File "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/commands/gui/spawn-threads/TestGuiSpawnThreads.py", line 44, in test_gui
    self.child.expect_exact(f"thread #{i + 2}: tid =")
  File "/usr/local/lib/python3.8/dist-packages/pexpect/spawnbase.py", line 432, in expect_exact
    return exp.expect_loop(timeout)
  File "/usr/local/lib/python3.8/dist-packages/pexpect/expect.py", line 179, in expect_loop
    return self.eof(e)
  File "/usr/local/lib/python3.8/dist-packages/pexpect/expect.py", line 122, in eof
    raise exc
pexpect.exceptions.EOF: End Of File (EOF). Exception style platform.
<pexpect.pty_spawn.spawn object at 0xffff8b5ae310>
command: /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb
args: ['/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb', '--no-lldbinit', '--no-use-colors', '-O', 'settings clear -all', '-O', 'settings set symbols.enable-external-lookup false', '-O', 'settings set target.inherit-tcc true', '-O', 'settings set target.disable-aslr false', '-O', 'settings set target.detach-on-error false', '-O', 'settings set target.auto-apply-fixits false', '-O', 'settings set plugin.process.gdb-remote.packet-timeout 60', '-O', 'settings set symbols.clang-modules-cache-path "/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api"', '-O', 'settings set use-color false', '--file', '/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/commands/gui/spawn-threads/TestGuiSpawnThreads.test_gui/a.out']
buffer (last 100 chars): b''
before (last 100 chars): b'0 0x0000aaaacb671c54 _start (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/lldb+0x31c54)\n'
after: <class 'pexpect.exceptions.EOF'>

yuxuanchen1997 pushed a commit that referenced this pull request Jul 25, 2024
…lities (#99934)

Summary:
## Issue
Attempting to run the lldb API tests against a remote-android target
fails with the error `NameError: name 'urlparse' is not defined`.

## Root Cause
It looks the Python import of `urlparse` was removed by mistake in
22ea97d. This import is only used when
running the lldb API tests against a remote-android target so it went
unnoticed.

## Fix
This change simply puts back the missing import. It is a one line
change.

fixes #99931

## Validation
Tested on Fedora 39 with an attached Android device:

`cd llvm-project`
`cmake -S llvm -B build -G Ninja -DLLVM_ENABLE_PROJECTS='clang;lldb'
-DCMAKE_BUILD_TYPE=Release -DLLDB_ENABLE_PYTHON=On`
`ninja -C build`
`./build/bin/lldb-dotest --arch aarch64 --out-of-tree-debugserver
--platform-name=remote-android
--platform-working-dir=/data/local/tmp/ds2
--platform-url=connect://localhost:5432 --compiler
~/Android/Sdk/ndk/21.4.7075529/toolchains/llvm/prebuilt/linux-x86_64/bin/clang`

Test Plan: 

Reviewers: 

Subscribers: 

Tasks: 

Tags: 


Differential Revision: https://phabricator.intern.facebook.com/D60251272
@andrurogerz andrurogerz deleted the lldb-tests-android-ndk branch February 5, 2025 19:43
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.

lldb API tests fails with "NameError: name 'urlparse' is not defined" when run against an Android device
4 participants