metadata: name: tiny-container-system-device-sharing format: "Apertis Test Definition 1.0" image-types: tiny-lxc: [ armhf-internal, arm64, amd64 ] image-deployment: - APT type: functional exec-type: automated priority: medium maintainer: "Apertis Project" description: "Test of device sharing between host and Tiny system-wide privileged container" expected: - "Test command should report \"pass\"." install: git-repos: - url: https://gitlab.apertis.org/infrastructure/tiny-image-recipes.git branch: 'apertis/v2019dev0' run: steps: - "# Enter test directory:" - cd tiny-image-recipes - "# Setup the AppArmor profile for container:" - sed s/__NAMESPACE_PLACEHOLDER__/lxc-apertis-tiny-system/g lxc/lxc-tiny-connectivity-profile-template | apparmor_parser -qr - "# Ensure we have loop device:" - modprobe loop - "# Create the random file and map it to loop0 device on host:" - dd if=/dev/urandom of=/var/test.img bs=1M count=1 - losetup /dev/loop0 /var/test.img - "# Check that a simple loop device created on the host can be shared with the container and accessed from inside it:" - lavatests/test-device-sharing -a "$ARCH" -r "$RELEASE" -d "$IMAGE_DATE" -t lxc/lxc-tiny-connectivity --aa-namespace "lxc-apertis-tiny-system" - "# Release the loop0 device on host after the test:" - losetup -d /dev/loop0 parse: pattern: "(?P<test_case_id>.*-*):\\s+(?P<result>(pass|fail))"