BTW, your workaround is good, but this depends on we know when to make the device node change, but sometime we won't, also sometimes the bus changes because of some thirdparty test cases which we don't know.
You know lava used to make it in the LXC days...
-----Original Message----- From: Larry Shen Sent: Friday, June 5, 2020 3:06 PM To: Milosz Wasilewski milosz.wasilewski@linaro.org Cc: lava-users@lists.lavasoftware.org Subject: RE: [EXT] Re: [Lava-users] docker shell cannot handle adbd.
Hi, Milosz,
Maybe I understand wrong, but I already see there is code like next to add dynamic device node to docker container.
I tried it in manual, adb find devices after a new device node added with next code. But I don't see the docker shell try to call it with some way. What's the aim of next code if you did not want to use it? Could you double confirm internal maybe some guys is handling it, but just in process? Could you do me a favor inform me your plan if my guess is true?
I don't think people could switch from lxc to docker on android if this not support, maybe my environment wrong or anything else?
def share_device_with_container_docker(container, node): container_id = subprocess.check_output( ["docker", "inspect", "--format={{.ID}}", container], text=True ).strip() nodeinfo = os.stat(node) major = os.major(nodeinfo.st_rdev) minor = os.minor(nodeinfo.st_rdev) with open( "/sys/fs/cgroup/devices/docker/%s/devices.allow" % container_id, "w" ) as allow: allow.write("a %d:%d rwm\n" % (major, minor)) subprocess.check_call( [ "docker", "exec", container, "sh", "-c", "mkdir -p %s && mknod %s c %d %d" % (os.path.dirname(node), node, major, minor), ] )
-----Original Message----- From: Milosz Wasilewski milosz.wasilewski@linaro.org Sent: Thursday, June 4, 2020 6:57 PM To: Larry Shen larry.shen@nxp.com Cc: lava-users@lists.lavasoftware.org Subject: [EXT] Re: [Lava-users] docker shell cannot handle adbd.
Caution: EXT Email
On Thu, 4 Jun 2020 at 11:05, Larry Shen larry.shen@nxp.com wrote:
Hi, guys,
I have a job like next:
test:
timeout:
minutes: 10
docker:
image: terceiro/android-platform-tools
definitions:
from: inline
name: smoke-case
path: inline/install-google-fastboot.yaml
repository:
metadata:
format: Lava-Test Test Definition 1.0 name: smoke-case-run description: Run smoke case
run:
steps: - env - sleep 10 - adb devices - adb root - sleep 10 - adb devices - lava-test-case get-release-version --shell adb shell
getprop ro.vendor.build.fingerprint
It output as next:
sleep 10
adb devices
daemon not running; starting now at tcp:5037
daemon started successfully
List of devices attached
040c41d4d72d7393 device
adb root
sleep 10
adb devices
List of devices attached
- lava-test-case get-release-version --shell adb shell getprop
- ro.vendor.build.fingerprint
<LAVA_SIGNAL_STARTTC get-release-version>
Received signal: <STARTTC> get-release-version
error: device '040c41d4d72d7393' not found
<LAVA_SIGNAL_ENDTC get-release-version>
Received signal: <ENDTC> get-release-version
<LAVA_SIGNAL_TESTCASE TEST_CASE_ID=get-release-version RESULT=fail>
Received signal: <TESTCASE> TEST_CASE_ID=get-release-version RESULT=fail
You know “adb root” will make usb bus change during run, so could docker shell handle this? How can I make above work? Thanks.
I don't think you can do that easily. Right now LAVA passes the device path to the container: Starting docker test shell container: docker run --rm --interactive --name=lava-docker-test-shell-2009060-3.4 --hostname=lava --device=/dev/bus/usb/001/086 --mount=type=bind,source=/var/lib/lava/dispatcher/tmp/2009060/lava-create-overlay-cjc83r5v/lava-2009060,destination=/lava-2009060 '--env=PS1=docker-test-shell:$ ' miloszwasilewski/adb-fastboot bash --norc -i So when enumeration changes the device is no longer available in the container.
You can try this: https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fvalidation... It sort of works. Not pretty but does the trick.
milosz
Lava-users mailing list Lava-users@lists.lavasoftware.org https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flist s.lavasoftware.org%2Fmailman%2Flistinfo%2Flava-users&data=02%7C01% 7Clarry.shen%40nxp.com%7C98d9934a63d645d9c73d08d80876127c%7C686ea1d3bc 2b4c6fa92cd99c5c301635%7C0%7C0%7C637268650490649805&sdata=AuwpnE%2 BY7acC5%2FlrjpAdGLGw%2FGENkbhXhX98tyrVbIE%3D&reserved=0