sometimes CTS cannot detect the device connection after reboot

2,495 views
Skip to first unread message

waterblood

unread,
Jun 29, 2011, 10:44:27 PM6/29/11
to android-platform
CTS will try to reboot device every 200 case. And sometimes, CTS
cannot detect the device connection after reboot.
it should be a common issue. The CTS reboot the device as below:
1. CTS issue a command “adb shell reboot” to reboot device.
2. CTS will wait for around 5 seconds, then disconnect the
AndroidDebugBridge and exec the command “adb kill-server”.
3. CTS start the adb server, and keep query whether the device’s adb
usb device present in host Linux pc directory “/dev/bus/usb”.
4. Once the adb server in host side detect the device’s adb, it will
create a usb transport for this device and update CTS with transport.
At this time the usb transport’s connection_state is “CS_OFFLINE”
5. Adb server will issue the command “SYNC” and “CNXN” to device
through adb usb connection. After adb server receive the reponse
“CNXN” from device’s adb usb connection, it will set the usb
transport’s connection_state to “CS_DEVICE” state.
6. CTS will send a msg “host:transport:serialnumber” to adb server.
And adb server will reponse this msg with “OK” if the usb transport’s
connection_state in “CS_DEVICE” state, or with “FAIL” if the usb
transport’s connection_state in “CS_OFFLINE” state.
7. If the adb server return “OK” in step 6, the CTS can go forward the
test case.
8. If the adb server return “FAIL” in step 6, It will cause a
AdbCommandRejectedException exception in DeviceServiceMonitor::run().
This will block the CTS to connect with device adb.

The root cause is once the step 4 has been finished, the step 6(msg
“host:transport:serialnumber”) may be occurred before the step
5(command&reponse “SYNC”&”CNXN”) finished. So adb server will return
“FAIL” msg to the command “host:transport:serialnumber”, which will
make CTS failed to finish the reboot function.

The fix should be in host side adb or CTS code to make sure the
command “host:transport:serialnumber” only issue when “SYNC” and
“CNXN” response has been proceed. I guess this should be in all
android device.

i dont know does anyone notice this, or maybe my analyse is not right.
I wonder

Sam Chiu

unread,
Jun 30, 2011, 6:06:58 AM6/30/11
to android-...@googlegroups.com
Hi waterblood,

I also meet this problem sometimes, especially in window.
Could you advice me how to modify CTS code to fix this problem?
Thanks!

BR,
Sam

2011/6/30 waterblood <guoyi...@gmail.com>

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To post to this group, send email to android-...@googlegroups.com.
To unsubscribe from this group, send email to android-platfo...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-platform?hl=en.


waterblood

unread,
Jul 1, 2011, 12:53:57 AM7/1/11
to android-platform
you can simply add a sleep in DeviceManager.java which is under cts
director as below

/** {@inheritDoc} */
public void deviceConnected(IDevice device) {
try{
Thread.sleep(2000);
}
catch(InterruptedException e){
Log.i("deviceConnected delay 2sec failed");
}
new DeviceServiceMonitor(device).start();
}


On Jun 30, 6:06 pm, Sam Chiu <iamsamc...@gmail.com> wrote:
> Hi waterblood,
>
> I also meet this problem sometimes, especially in window.
> Could you advice me how to modify CTS code to fix this problem?
> Thanks!
>
> BR,
> Sam
>
> 2011/6/30 waterblood <guoyin.c...@gmail.com>

Atul Raut

unread,
Jul 25, 2011, 2:17:28 AM7/25/11
to android-...@googlegroups.com, iamsa...@gmail.com
Hi Sam,

Try below steps :
$cd  cts
$ vim repository/host_config.xm
In this file you find below line
    <!-- Number of tests executed between reboots. A value <= 0 disables reboots. -->
    <IntValue name="maxTestCount" value="200" />
Change maxTestCount to -1 your device will never boot.
 
Thanks,
----------------------------------------------------------------------------------------------------------------------------------
Atul Raut

http://rautatul.weebly.com/

roynick

unread,
Aug 3, 2011, 7:47:00 PM8/3/11
to android-...@googlegroups.com
Hello Sam,Did any of the 2 solutions fix your issue?

Atul Raut

unread,
Aug 5, 2011, 2:16:22 AM8/5/11
to android-...@googlegroups.com, rari...@gmail.com
Hi Roynic,

Do below things it will work.

adb kill-server
adb start-server
adb root
adb remount


Thanks,
----------------------------------------------------------------------------------------------------------------------------------
Atul Raut

http://rautatul.weebly.com/



On Thu, Aug 4, 2011 at 5:17 AM, roynick <rari...@gmail.com> wrote:
Hello Sam,Did any of the 2 solutions fix your issue?

--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To view this discussion on the web visit https://groups.google.com/d/msg/android-platform/-/2bLuffsunQIJ.

Sam Chiu

unread,
Aug 7, 2011, 8:16:00 AM8/7/11
to android-...@googlegroups.com, rari...@gmail.com
Thanks guys,

For disables reboots, it may cause some false alarm issue on low-performance device.
So I prefer to remain reboot.

For "adb kill-server/adb start-server", I've add an extra "adb kill-server/adb start-server" mechanism in CTS reboot process if meet waiting for long time.It will work,but it is a workaround, not a total solution for automation testing.

Thanks a lot.

Regards,
Sam

2011/8/5 Atul Raut <atul....@gmail.com>

Dianne Hackborn

unread,
Aug 7, 2011, 11:59:18 AM8/7/11
to android-...@googlegroups.com, rari...@gmail.com
Why are you doing adb root and adb remount?  That is putting the device is a very low security state, and in fact should cause some CTS tests to fail.
--
Dianne Hackborn
Android framework engineer
hac...@android.com

Note: please don't send private questions to me, as I don't have time to provide private support, and so won't reply to such e-mails.  All such questions should be posted on public forums, where I and others can see and answer them.

Atul Raut

unread,
Aug 8, 2011, 5:27:53 AM8/8/11
to android-...@googlegroups.com, Dianne Hackborn
Thanks for Info Dianne. 

 
Thanks,
----------------------------------------------------------------------------------------------------------------------------------
Atul Raut

http://rautatul.weebly.com/



waterblood

unread,
Aug 10, 2011, 2:08:38 AM8/10/11
to android-platform
From my point, it should be a issue in our adb binary in host side.
adb host server should only notify the adb client after the adb
connection between host and target has been setup. I dont know
whether it is valid if we pass the CTS after we change the adb code.

BRs
Guoyin Chen

On Aug 7, 11:59 pm, Dianne Hackborn <hack...@android.com> wrote:
> Why are you doing adb root and adb remount?  That is putting the device is a
> very low security state, and in fact should cause some CTS tests to fail.
>
>
>
>
>
>
>
>
>
> On Thu, Aug 4, 2011 at 11:16 PM, Atul Raut <atul.dr...@gmail.com> wrote:
> > Hi Roynic,
>
> > Do below things it will work.
>
> > adb kill-server
> > adb start-server
> > adb root
> > adb remount
>
> > Thanks,
>
> > --------------------------------------------------------------------------- -------------------------------------------------------
> > Atul Raut
> >  http://rautatul.weebly.com/
> >http://atulraut.wordpress.com/<http://rautatul.wordpress.com/>
> > atulrau...@gmail.com <hack...@android.com>
>
> > <hack...@android.com>
>
> > On Thu, Aug 4, 2011 at 5:17 AM, roynick <rarin...@gmail.com> wrote:
>
> >> Hello Sam,Did any of the 2 solutions fix your issue?
>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "android-platform" group.
> >> To view this discussion on the web visit
> >>https://groups.google.com/d/msg/android-platform/-/2bLuffsunQIJ.
> >> To post to this group, send email to android-...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> android-platfo...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/android-platform?hl=en.
>
> >  --
> > You received this message because you are subscribed to the Google Groups
> > "android-platform" group.
> > To post to this group, send email to android-...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > android-platfo...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/android-platform?hl=en.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com

roynick

unread,
Aug 10, 2011, 2:17:37 PM8/10/11
to android-platform
Thanks Atul for the workaround.
I wanted to know 3 things for a new android device to come out:
0. Is CTS for internal compatability testing only?
1. Does Google need the CTS results to be submitted? Or Google will do
a CTS test themselves?
2. Is it okay if I can rerun the failed test cases due to adb timeout,
on the same binary, and submit the result to google?

Thanks,
Arindam

roynick

unread,
Aug 10, 2011, 2:20:39 PM8/10/11
to android-platform
Hello Sam,
Where have you added the adb commands, in order to run them if CTS
waits for certain amount of time?
Can you share the script?
Thanks,
Arindam



On Aug 9, 11:08 pm, waterblood <guoyin.c...@gmail.com> wrote:

Atul Raut

unread,
Aug 11, 2011, 4:23:06 AM8/11/11
to android-...@googlegroups.com, rari...@gmail.com
Hi Arindam,

I wanted to know 3 things for a new android device to come out:
0. Is CTS for internal compatability testing only? : No, Its mandatory every device needs to match CTS culpability. 

1. Does Google need the CTS results to be submitted? Or Google will do
CTS test themselves? : Yes Google needs CTS, result, then only Google approve the device. Google wont do testing for us.

2. Is it okay if I can rerun the failed test cases due to adb timeout,
on the same binary, and submit the result to google? : Yes totally you can re-run the failed test cases.
 
Thanks,
----------------------------------------------------------------------------------------------------------------------------------
Atul Raut

http://rautatul.weebly.com/

roynick

unread,
Aug 12, 2011, 1:29:48 PM8/12/11
to android-platform
Thanks Atul for the reply.
I was wondering whether this CTS issue has anything to do with
the Linux USB driver, and whether it can run smooth on a Windows
machine.
Thanks,
Arindam

On Aug 11, 1:23 am, Atul Raut <atul.dr...@gmail.com> wrote:
> Hi Arindam,
>
>   I wanted to know 3 things for a new android device to come out:
> 0. Is CTS for internal compatability testing only? : No, Its mandatory every
> device needs to match CTS culpability.
> 1. Does Google need the CTS results to be submitted? Or Google will do
> a CTS test themselves? : Yes Google needs CTS, result, then only Google
> approve the device. Google wont do testing for us.
> 2. Is it okay if I can rerun the failed test cases due to adb timeout,
> on the same binary, and submit the result to google? : Yes totally you can
> re-run the failed test cases.
>
> Thanks,
> ----------------------------------------------------------------------------------------------------------------------------------
> Atul Rauthttp://rautatul.weebly.com/http://atulraut.wordpress.com/<http://rautatul.wordpress.com/>

Atul Raut

unread,
Aug 13, 2011, 10:06:58 AM8/13/11
to android-...@googlegroups.com, rari...@gmail.com
Nope, 

Windows machine CTS tool wont work.
 
Thanks,
----------------------------------------------------------------------------------------------------------------------------------
Atul Raut

http://rautatul.weebly.com/

roynick

unread,
Aug 27, 2011, 4:05:22 PM8/27/11
to android-platform
Hello Diane,
Do you agree with Waterblood?
Is it an issue on adb host side, or it might be an issue
with linux host side driver, which sometimes tends to lock up.
Though I am using Ubuntu 11.04, still I am seeing the issue.
Thanks,
Roy

On Aug 9, 11:08 pm, waterblood <guoyin.c...@gmail.com> wrote:

Balaji BABU T.R.

unread,
Sep 12, 2014, 7:23:34 AM9/12/14
to android-...@googlegroups.com

Hi, 

Try this command

run cts --plan CTS-TF --disable-reboot

Regards

Balaji
Reply all
Reply to author
Forward
0 new messages