Kể từ ngày 27 tháng 3 năm 2025, bạn nên sử dụng android-latest-release
thay vì aosp-main
để xây dựng và đóng góp cho AOSP. Để biết thêm thông tin, hãy xem phần Thay đổi đối với AOSP.
Sử dụng bộ sưu tập để sắp xếp ngăn nắp các trang
Lưu và phân loại nội dung dựa trên lựa chọn ưu tiên của bạn.
SemaphoreTokenTargetPreparer
public
class
SemaphoreTokenTargetPreparer
extends BaseTargetPreparer
Đây là trình chuẩn bị dùng để sử dụng mã thông báo nhằm chuyển đổi tuần tự quá trình thực thi kiểm thử trong máy chủ tradefed. Chỉ mã thông báo thu nạp thiết bị mới được phép bắt đầu kiểm thử. Các phần khác sẽ chờ cho đến khi bản phát hành được phát hành. Bạn không thể chỉ sử dụng tính năng này khi có một kiểm thử trong tradefed và sử dụng tài nguyên dùng chung. Vui lòng đảm bảo rằng chỉ có một quy trình kiểm thử chạy trên máy chủ lưu trữ với nhiều DUT. Người dùng cần thêm --semaphore-token:no-disable vào tệp lệnh.
Tóm tắt
Hàm khởi tạo công khai
SemaphoreTokenTargetPreparer
public SemaphoreTokenTargetPreparer ()
Phương thức công khai
public void setUp (TestInformation testInfo)
Tham số |
testInfo |
TestInformation |
public void tearDown (TestInformation testInfo,
Throwable e)
Tham số |
testInfo |
TestInformation |
e |
Throwable |
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],null,["# SemaphoreTokenTargetPreparer\n============================\n\n\n`\npublic\n\n\nclass\nSemaphoreTokenTargetPreparer\n`\n\n\n`\n\n\n`\n\n`\n\nextends `[BaseTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BaseTargetPreparer.html)`\n\n\n`\n\n`\n\n\n`\n\n|---|---|--------------------------------------------------------------|\n| java.lang.Object |||\n| ↳ | [com.android.tradefed.targetprep.BaseTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BaseTargetPreparer.html) ||\n| | ↳ | com.android.tradefed.targetprep.SemaphoreTokenTargetPreparer |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nThis is a preparer used to use token to serialize test excution in tradefed host. only the device\nacquire token will be allow to start the test. Others will wait until it released This can't be\nonly used when you have one test in tradefed and use shared resources. Please make sure only a\nsingle test running on the host with different DUTs User need to add --semaphore-token:no-disable\nin the command file.\n\nSummary\n-------\n\n| ### Public constructors ||\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|\n| ` `[SemaphoreTokenTargetPreparer](../../../../../../reference/tradefed/com/android/tradefed/targetprep/SemaphoreTokenTargetPreparer.html#SemaphoreTokenTargetPreparer())`() ` |\n\n| ### Public methods ||\n|---------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` void` | ` `[setUp](../../../../../../reference/tradefed/com/android/tradefed/targetprep/SemaphoreTokenTargetPreparer.html#setUp(com.android.tradefed.invoker.TestInformation))`(`[TestInformation](../../../../../../reference/tradefed/com/android/tradefed/invoker/TestInformation.html)` testInfo) ` |\n| ` void` | ` `[tearDown](../../../../../../reference/tradefed/com/android/tradefed/targetprep/SemaphoreTokenTargetPreparer.html#tearDown(com.android.tradefed.invoker.TestInformation,%20java.lang.Throwable))`(`[TestInformation](../../../../../../reference/tradefed/com/android/tradefed/invoker/TestInformation.html)` testInfo, Throwable e) ` |\n\nPublic constructors\n-------------------\n\n### SemaphoreTokenTargetPreparer\n\n```\npublic SemaphoreTokenTargetPreparer ()\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nPublic methods\n--------------\n\n### setUp\n\n```\npublic void setUp (TestInformation testInfo)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------|\n| `testInfo` | `TestInformation` \u003cbr /\u003e |\n\n| Throws ||\n|----------------------------------------------------------------------------------------------------------------------------------|---|\n| [BuildError](../../../../../../reference/tradefed/com/android/tradefed/targetprep/BuildError.html) | |\n| [DeviceNotAvailableException](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |\n| [TargetSetupError](../../../../../../reference/tradefed/com/android/tradefed/targetprep/TargetSetupError.html) | |\n\n### tearDown\n\n```\npublic void tearDown (TestInformation testInfo, \n Throwable e)\n```\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|--------------------------|\n| `testInfo` | `TestInformation` \u003cbr /\u003e |\n| `e` | `Throwable` \u003cbr /\u003e |\n\n| Throws ||\n|----------------------------------------------------------------------------------------------------------------------------------|---|\n| [DeviceNotAvailableException](../../../../../../reference/tradefed/com/android/tradefed/device/DeviceNotAvailableException.html) | |"]]