Skip to content

[android] Fix some tests and a doc flag #40977

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
Feb 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Android.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,5 @@ $ utils/build-script \
--android \ # Build for Android.
--android-ndk ~/android-ndk-r23b \ # Path to an Android NDK.
--android-arch armv7 \ # Optionally specify Android architecture, alternately aarch64
--android-ndk-version 21
Copy link
Member Author

Choose a reason for hiding this comment

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

--android-api-level 21
```
3 changes: 0 additions & 3 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,6 @@ elif (run_os in ['linux-gnu', 'linux-gnueabihf', 'freebsd', 'openbsd', 'windows-
config.target_shared_library_prefix = 'lib'
config.target_shared_library_suffix = ".so"
config.target_sdk_name = "android"
# Needed by several ParseableInterface/swift_build_sdk_interfaces tests on
# Android
config.environment['ANDROID_DATA'] = os.environ['ANDROID_DATA']
config.target_cc_options = "-fPIE"
else:
lit_config.note("Testing Linux " + config.variant_triple)
Expand Down
6 changes: 0 additions & 6 deletions test/stdlib/POSIX.swift
Original file line number Diff line number Diff line change
Expand Up @@ -246,13 +246,7 @@ POSIXTests.test("fcntl(CInt, CInt, UnsafeMutableRawPointer): locking and unlocki
// Lock for reading...
var flck = flock()
flck.l_type = Int16(F_RDLCK)
#if os(Android)
// In Android l_len is __kernel_off_t which is not the same size as off_t in
// 64 bits.
flck.l_len = __kernel_off_t(data.utf8.count)
#else
flck.l_len = off_t(data.utf8.count)
Copy link
Member Author

Choose a reason for hiding this comment

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

I think the above comment was written before AArch64 support was added, off_t actually works fine. This recently broke on Android AArch64 after an import was added to this file, with the compiler now complaining that __kernel_off_t is an Int and the count is an Int64, but this change fixes it.

#endif
rc = fcntl(fd, F_SETLK, &flck)
expectEqual(0, rc)

Expand Down
15 changes: 3 additions & 12 deletions utils/swift_build_sdk_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,18 +410,9 @@ def main():
# Copy a file containing SDK build version into the prebuilt module dir,
# so we can keep track of the SDK version we built from.
copySystemVersionFile(args.sdk, args.output_dir)
if 'ANDROID_DATA' not in os.environ:
shared_output_lock = multiprocessing.Lock()
pool = multiprocessing.Pool(args.jobs, set_up_child,
(args, shared_output_lock))
else:
# Android doesn't support Python's multiprocessing as it doesn't have
# sem_open, so switch to a ThreadPool instead.
import threading
shared_output_lock = threading.Lock()
from multiprocessing.pool import ThreadPool
pool = ThreadPool(args.jobs, set_up_child,
(args, shared_output_lock))
shared_output_lock = multiprocessing.Lock()
pool = multiprocessing.Pool(args.jobs, set_up_child,
(args, shared_output_lock))
Copy link
Member Author

Choose a reason for hiding this comment

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

Someone recently ported sem_open to Termux, termux/termux-packages#8993, so go the other way and remove the Android-specific code instead, now that this works.


interface_framework_dirs = (args.interface_framework_dirs or
DEFAULT_FRAMEWORK_INTERFACE_SEARCH_PATHS)
Expand Down