• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

system/core


Commit MetaInfo

Révisionc18cccc227d7fdccfa5a60e4e8d20951d1f6ed89 (tree)
l'heure2019-04-13 02:13:24
AuteurHridya Valsaraju <hridya@goog...>
CommiterHridya Valsaraju

Message de Log

Allow fuzzy_fastboot number to run for a specific device serial number

Test: ./fuzzy_fastboot --serial=826X003L --gtest_filter=*Logical*
Bug: 117181762
Change-Id: I9dec510aa604b7994f25ce26edb87d7f6ec3e875
Merged-In: I9dec510aa604b7994f25ce26edb87d7f6ec3e875
(cherry picked from commit b9051a3e6559b14759015d679c97d0e9e5fad9a4)

Change Summary

Modification

--- a/fastboot/fuzzy_fastboot/fixtures.cpp
+++ b/fastboot/fuzzy_fastboot/fixtures.cpp
@@ -59,7 +59,7 @@ using namespace std::literals::chrono_literals;
5959
6060 namespace fastboot {
6161
62-int FastBootTest::MatchFastboot(usb_ifc_info* info, const char* local_serial) {
62+int FastBootTest::MatchFastboot(usb_ifc_info* info, const std::string& local_serial) {
6363 if (info->ifc_class != 0xff || info->ifc_subclass != 0x42 || info->ifc_protocol != 0x03) {
6464 return -1;
6565 }
@@ -68,8 +68,8 @@ int FastBootTest::MatchFastboot(usb_ifc_info* info, const char* local_serial) {
6868
6969 // require matching serial number or device path if requested
7070 // at the command line with the -s option.
71- if (local_serial && (strcmp(local_serial, info->serial_number) != 0 &&
72- strcmp(local_serial, info->device_path) != 0))
71+ if (!local_serial.empty() && local_serial != info->serial_number &&
72+ local_serial != info->device_path)
7373 return -1;
7474 return 0;
7575 }
@@ -113,7 +113,9 @@ void FastBootTest::SetUp() {
113113 ASSERT_TRUE(UsbStillAvailible()); // The device disconnected
114114 }
115115
116- const auto matcher = [](usb_ifc_info* info) -> int { return MatchFastboot(info, nullptr); };
116+ const auto matcher = [](usb_ifc_info* info) -> int {
117+ return MatchFastboot(info, device_serial);
118+ };
117119 for (int i = 0; i < MAX_USB_TRIES && !transport; i++) {
118120 std::unique_ptr<UsbTransport> usb(usb_open(matcher, USB_TIMEOUT));
119121 if (usb)
@@ -172,7 +174,9 @@ void FastBootTest::ReconnectFastbootDevice() {
172174 ;
173175 printf("WAITING FOR DEVICE\n");
174176 // Need to wait for device
175- const auto matcher = [](usb_ifc_info* info) -> int { return MatchFastboot(info, nullptr); };
177+ const auto matcher = [](usb_ifc_info* info) -> int {
178+ return MatchFastboot(info, device_serial);
179+ };
176180 while (!transport) {
177181 std::unique_ptr<UsbTransport> usb(usb_open(matcher, USB_TIMEOUT));
178182 if (usb) {
@@ -238,6 +242,7 @@ std::string FastBootTest::device_path = "";
238242 std::string FastBootTest::cb_scratch = "";
239243 std::string FastBootTest::initial_slot = "";
240244 int FastBootTest::serial_port = 0;
245+std::string FastBootTest::device_serial = "";
241246
242247 template <bool UNLOCKED>
243248 void ModeTest<UNLOCKED>::SetUp() {
--- a/fastboot/fuzzy_fastboot/fixtures.h
+++ b/fastboot/fuzzy_fastboot/fixtures.h
@@ -43,9 +43,10 @@ constexpr char USB_PORT_GONE[] =
4343 class FastBootTest : public testing::Test {
4444 public:
4545 static int serial_port;
46+ static std::string device_serial;
4647 static constexpr int MAX_USB_TRIES = 10;
4748
48- static int MatchFastboot(usb_ifc_info* info, const char* local_serial = nullptr);
49+ static int MatchFastboot(usb_ifc_info* info, const std::string& local_serial = "");
4950 bool UsbStillAvailible();
5051 bool UserSpaceFastboot();
5152 void ReconnectFastbootDevice();
--- a/fastboot/fuzzy_fastboot/main.cpp
+++ b/fastboot/fuzzy_fastboot/main.cpp
@@ -162,7 +162,7 @@ const auto not_allowed = [](char c) -> int {
162162 // Test that USB even works
163163 TEST(USBFunctionality, USBConnect) {
164164 const auto matcher = [](usb_ifc_info* info) -> int {
165- return FastBootTest::MatchFastboot(info, nullptr);
165+ return FastBootTest::MatchFastboot(info, fastboot::FastBootTest::device_serial);
166166 };
167167 Transport* transport = nullptr;
168168 for (int i = 0; i < FastBootTest::MAX_USB_TRIES && !transport; i++) {
@@ -1738,10 +1738,14 @@ int main(int argc, char** argv) {
17381738 fastboot::GenerateXmlTests(fastboot::config);
17391739 }
17401740
1741+ if (args.find("serial") != args.end()) {
1742+ fastboot::FastBootTest::device_serial = args.at("serial");
1743+ }
1744+
17411745 setbuf(stdout, NULL); // no buffering
17421746 printf("<Waiting for Device>\n");
17431747 const auto matcher = [](usb_ifc_info* info) -> int {
1744- return fastboot::FastBootTest::MatchFastboot(info, nullptr);
1748+ return fastboot::FastBootTest::MatchFastboot(info, fastboot::FastBootTest::device_serial);
17451749 };
17461750 Transport* transport = nullptr;
17471751 while (!transport) {