Skip to content
This repository was archived by the owner on Jun 22, 2024. It is now read-only.

Attempting to automate testing of armv7 (armhf) images using a Debian 11.3 armhf VM and QEMU #9

Draft
wants to merge 44 commits into
base: trunk
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
ca59eed
Added PLATFORM environment variable for starting up containers using …
jamesmortensen Mar 28, 2022
d8601f6
Merge from trunk
jamesmortensen May 20, 2022
06bf70b
Added a third job for building and running tests for armv7 variant us…
jamesmortensen May 20, 2022
44167d9
Run start-vm in background so it won't terminate when moving onto the…
jamesmortensen May 20, 2022
8a2a4a7
Updated config.yml
jamesmortensen May 20, 2022
99e9600
Fixed some config issues and installing qemu before attempting to sta…
jamesmortensen May 20, 2022
2fbff77
Merge branch 'armv7-tests' of https://github.com/seleniumhq-community…
jamesmortensen May 20, 2022
0757be5
Updated config.yml
jamesmortensen May 20, 2022
dd5e754
Updated config.yml
jamesmortensen May 20, 2022
82c3b4a
Putting DOCKER_HOST in with the other environment variables
jamesmortensen May 21, 2022
a2bdffd
Ordering of setup
jamesmortensen May 21, 2022
cfd4264
fixes
jamesmortensen May 21, 2022
a27e6ef
fixes
jamesmortensen May 21, 2022
e322355
Env variables are still not propogating to other run blocks, so we'll…
jamesmortensen May 21, 2022
6d6dc0c
More stuff to help in debugging the docker socket
jamesmortensen May 21, 2022
1ece3ae
trying other qemu settings to speed up the VM
jamesmortensen May 21, 2022
4e74769
trying other qemu settings to speed up the VM
jamesmortensen May 21, 2022
630c2a8
trying other qemu settings to speed up the VM
jamesmortensen May 21, 2022
f03f8aa
trying other qemu settings to speed up the VM
jamesmortensen May 21, 2022
dbc1468
Show CPU features as well as try out some different qemu args
jamesmortensen May 21, 2022
90b0177
try building without the VM, just use it for testing
jamesmortensen May 21, 2022
c392708
Run the tests again with the cached built images.
jamesmortensen May 21, 2022
bb201a1
Checking architecture of cached built images to confirm it's armv7l n…
jamesmortensen May 21, 2022
9087a35
Checking arch of cached armv7 container build and the armv7 latest re…
jamesmortensen May 21, 2022
b2a3bbc
removed VM setup code
jamesmortensen May 21, 2022
9e33b3d
Registering other platforms in Makefile for tests
jamesmortensen May 21, 2022
ba1f808
Running tests with the armv7 VM. They don't pass with qemu-user-stati…
jamesmortensen May 21, 2022
3677ae6
Opening ports for running the tests against Docker engine in the virt…
jamesmortensen May 21, 2022
82c6df4
Now that CircleCI released arm-large on the free plan, we'll try test…
jamesmortensen Jun 25, 2022
d747600
fix typo
jamesmortensen Jun 25, 2022
1171b72
Fixed qemu version
jamesmortensen Jun 25, 2022
f076833
Removing highmem=off since we're using QEMU 7.0.0
jamesmortensen Jun 25, 2022
1b8b415
debug view of start-vm.sh
jamesmortensen Jun 25, 2022
9da0a9a
reduce number of cores
jamesmortensen Jun 25, 2022
0917c9a
Change cpu cortex-a15 to cpu host
jamesmortensen Jun 25, 2022
11c68b8
Change to qemu-system-aarch64
jamesmortensen Jun 25, 2022
42473e6
typo
jamesmortensen Jun 25, 2022
f8f054c
Try 4gb of memory
jamesmortensen Jun 25, 2022
e3989b3
Try 3gb of memory
jamesmortensen Jun 25, 2022
85ca350
Go back to cortex-a15
jamesmortensen Jun 25, 2022
70cf534
Need a version and build date, latest won't work. Also, increased tcg…
jamesmortensen Jun 25, 2022
12b03ba
merging from update-firefox_104.0-1
jamesmortensen Sep 3, 2022
7b813f9
Pulling latest published images and attempt to test armv7l on them
jamesmortensen Sep 3, 2022
880bc73
Merging from trunk to armv7-tests
jamesmortensen Oct 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 109 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ executors:
machine:
image: ubuntu-2004:current
resource_class: medium
ubuntu2004arm64-large:
machine:
image: ubuntu-2004:current
resource_class: arm-large

jobs:
build-multi-arch:
Expand All @@ -31,13 +35,14 @@ jobs:
cat $BASH_ENV
source $BASH_ENV
echo "Workflow environment variables:"
echo $BRANCH
echo "BRANCH=$BRANCH"
- run: uname -a
- run: docker info
- checkout
- run:
name: "Build Docker images"
command: |
export BRANCH=$CIRCLE_BRANCH
echo "Branch is $BRANCH"
NAME=${NAMESPACE} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} PLATFORMS=${PLATFORMS} BUILD_ARGS=${BUILD_ARGS} make build_multi
- run:
Expand Down Expand Up @@ -76,16 +81,73 @@ jobs:
BUILD_DATE: today
steps:
- checkout
- restore_cache:
keys:
- multi-arch-images-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-<< parameters.platforms >>
#- restore_cache:
# keys:
# - multi-arch-images-{{ .Branch }}-{{ .Environment.CIRCLE_WORKFLOW_ID }}-<< parameters.platforms >>
# - multi-arch-images-{{ .Branch }}-d9897deb-4482-4d3a-b3cf-b9b36b69df31-<< parameters.platforms >>
- run:
name: Download VM and install qemu, if armv7l
command: |
if [ "$CIRCLE_JOB" = "test-multi-arch-armv7l" ]; then
echo "Download armv7l VM..."
cd ~
curl -L https://github.com/jamesmortensen/virtual-machine-releases/releases/download/debian-11.3-armhf-ci-v1.0/debian-11.3-armhf-ci-v1.0.tar.xz \
-o debian-11.3-armhf-ci-v1.0.tar.xz
echo "Extract VM..."
tar xvfJ debian-11.3-armhf-ci-v1.0.tar.xz
rm debian-11.3-armhf-ci-v1.0.tar.xz
echo "Install QEMU binaries"
curl -L https://github.com/xpack-dev-tools/qemu-arm-xpack/releases/download/v7.0.0-1/xpack-qemu-arm-7.0.0-1-linux-$(uname -m | sed 's/x86_64/x64/' | sed 's/aarch64/arm64/').tar.gz -o xpack-qemu-arm-7.0.0-1-linux-$(uname -m | sed 's/x86_64/x64/' | sed 's/aarch64/arm64/').tar.gz \
&& tar xvfz xpack-qemu-arm-7.0.0-1-linux-$(uname -m | sed 's/x86_64/x64/' | sed 's/aarch64/arm64/').tar.gz \
&& echo "export PATH=$PWD/xpack-qemu-arm-7.0.0-1/bin:$PATH" > ~/.bashrc \
&& source ~/.bashrc \
&& qemu-system-arm --version \
&& qemu-system-aarch64 --version
fi
- run:
name: Start VM if armv7l
command: |
if [ "$CIRCLE_JOB" = "test-multi-arch-armv7l" ]; then
cd ~/debian-11.3-armhf-ci
sed -i 's/&//g' start-vm.sh
sed -i 's/-m 1024/-m 3072/' start-vm.sh
sed -i 's/,highmem=off//' start-vm.sh
sed -i 's/tb-size=256/tb-size=1024/' start-vm.sh
#sed -i 's/cpu cortex-a15/cpu host/' start-vm.sh
sed -i 's/qemu-system-arm/qemu-system-aarch64/' start-vm.sh
sed -i 's/cpus=4,sockets=1,cores=4,threads=1/cpus=2,sockets=1,cores=2,threads=1/' start-vm.sh
cat start-vm.sh
sh start-vm.sh
fi
background: true
- run:
name: Wait for VM if armv7l
command: |
if [ "$CIRCLE_JOB" = "test-multi-arch-armv7l" ]; then
cd ~/debian-11.3-armhf-ci
sed -i 's/sh start-vm.sh//g' start-vm-and-tunnels.sh && mv start-vm-and-tunnels.sh wait-for-vm-boot.sh
bash wait-for-vm-boot.sh
cd ..
echo 'export DOCKER_HOST=unix:///tmp/docker-on-debianhf.sock' >> $BASH_ENV
source $BASH_ENV
ssh -p 8022 [email protected] -N -f -L4444:127.0.0.1:4444 -L5555:127.0.0.1:5555 -L7900:127.0.0.1:7900
fi
- run: uname -a
- run: docker info
- run:
name: "Load built images from cache into Docker"
name: "Load built images into Docker"
command: |
if [ "$CIRCLE_JOB" = "test-multi-arch-armv7l" ]; then
export DOCKER_HOST=unix:///tmp/docker-on-debianhf.sock
fi
echo "CIRCLE_WORKFLOW_ID = " $CIRCLE_WORKFLOW_ID
docker load -i multi-arch-images.tar
# docker load -i multi-arch-images.tar
docker pull seleniarm/hub:4.4.0-20220814
docker pull seleniarm/node-chromium:4.4.0-20220814
docker pull seleniarm/node-firefox:4.4.0-20220814
docker pull seleniarm/standalone-chromium:4.4.0-20220814
docker pull seleniarm/standalone-firefox:4.4.0-20220814
docker info
- run:
name: "Use Python3 and pip3 instead of Python2.7"
command: |
Expand All @@ -97,9 +159,23 @@ jobs:
name: "Test Docker images"
no_output_timeout: 2m
command: |
if [ "$CIRCLE_JOB" = "test-multi-arch-armv7l" ]; then
export DOCKER_HOST=unix:///tmp/docker-on-debianhf.sock
export GRID_STATUS_MAX_ATTEMPTS=15
export PLATFORM=linux/arm/v7
fi
export USE_RANDOM_USER=false
export BRANCH=${CIRCLE_BRANCH//\//-}
#export BRANCH=${CIRCLE_BRANCH//\//-}
export BRANCH=4.3.0
export BUILD_DATE=20220624
USE_RANDOM_USER_ID=${USE_RANDOM_USER} NAMESPACE=${NAMESPACE} VERSION=${BRANCH} BUILD_DATE=${BUILD_DATE} SKIP_BUILD=true make test_multi_arch
# docker run --rm --privileged aptman/qus -- -r
# docker run --rm --privileged aptman/qus -s -- -p
#docker run --platform linux/arm/v7 --rm seleniarm/standalone-firefox:armv7-tests-today arch
docker run --platform linux/arm/v7 --rm seleniarm/standalone-firefox:4.4.0-20220814 arch
if [ "$CIRCLE_JOB" = "test-multi-arch-armv7l" ]; then
sh stop-vm.sh
fi

deploy-multi-arch:
parameters:
Expand Down Expand Up @@ -184,24 +260,33 @@ jobs:
workflows:
build-and-test-multi-arch:
jobs:
- build-multi-arch:
name: build-multi-arch-arm64
platforms: linux/arm64
machine-type: ubuntu2004arm64
- build-multi-arch:
name: build-multi-arch-amd64
platforms: linux/amd64
machine-type: ubuntu2004amd64
- test-multi-arch:
name: test-multi-arch-arm64
requires: [build-multi-arch-arm64]
platforms: linux/arm64
machine-type: ubuntu2004arm64
# - build-multi-arch:
# name: build-multi-arch-arm64
# platforms: linux/arm64
# machine-type: ubuntu2004arm64
# - build-multi-arch:
# name: build-multi-arch-amd64
# platforms: linux/amd64
# machine-type: ubuntu2004amd64
# - build-multi-arch:
# name: build-multi-arch-armv7l
# platforms: linux/arm/v7
# machine-type: ubuntu2004arm64
# - test-multi-arch:
# name: test-multi-arch-arm64
# requires: [build-multi-arch-arm64]
# platforms: linux/arm64
# machine-type: ubuntu2004arm64
# - test-multi-arch:
# name: test-multi-arch-amd64
# requires: [build-multi-arch-amd64]
# platforms: linux/amd64
# machine-type: ubuntu2004amd64
- test-multi-arch:
name: test-multi-arch-amd64
requires: [build-multi-arch-amd64]
platforms: linux/amd64
machine-type: ubuntu2004amd64
name: test-multi-arch-armv7l
# requires: [build-multi-arch-armv7l]
platforms: linux/arm/v7
machine-type: ubuntu2004arm64-large

deploy-multi-arch:
jobs:
Expand All @@ -214,4 +299,3 @@ workflows:
branches:
only:
- trunk

3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,8 @@ test_firefox_standalone:


# Test multi-arch container images
test_multi_arch: test_chromium_multi \
test_multi_arch: qemu_user_static \
test_chromium_multi \
test_firefox_multi \
test_chromium_standalone_multi \
test_firefox_standalone_multi
Expand Down
22 changes: 18 additions & 4 deletions tests/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import random
import sys
import unittest
import time
import re

import docker
Expand All @@ -23,6 +24,7 @@
https_proxy = os.environ.get('https_proxy', '')
no_proxy = os.environ.get('no_proxy', '')
SKIP_BUILD = os.environ.get('SKIP_BUILD', False)
PLATFORM = os.environ.get('PLATFORM', '')

IMAGE_NAME_MAP = {
# Hub
Expand Down Expand Up @@ -111,6 +113,12 @@ def prune_networks():
client.networks.prune()


def wait_for_grid(platform):
if platform != '':
logger.info('Starting container on platform %s so we will wait 10 more seconds since emulation is slower...' % platform)
time.sleep(10)


def launch_container(container, **kwargs):
"""
Launch a specific container
Expand Down Expand Up @@ -176,6 +184,7 @@ def standalone_browser_container_matches(container):
use_random_user_id = USE_RANDOM_USER_ID == 'true'
run_in_docker_compose = RUN_IN_DOCKER_COMPOSE == 'true'
random_user_id = random.randint(100000, 2147483647)
platform = PLATFORM

if use_random_user_id:
logger.info("Running tests with a random user ID -> %s" % random_user_id)
Expand All @@ -197,9 +206,12 @@ def standalone_browser_container_matches(container):
"""
ports = {'4444': 4444}
if use_random_user_id:
test_container_id = launch_container(image, ports=ports, user=random_user_id)
test_container_id = launch_container(image, ports=ports, user=random_user_id, platform=platform)
else:
test_container_id = launch_container(image, ports=ports)
test_container_id = launch_container(image, ports=ports,platform=platform)

wait_for_grid(platform)

else:
"""
Hub / Node Configuration
Expand All @@ -209,11 +221,13 @@ def standalone_browser_container_matches(container):
hub_id = launch_hub("grid")
ports = {'5555': 5555, '7900': 7900}
if use_random_user_id:
test_container_id = launch_container(image, network='grid', ports=ports, user=random_user_id)
test_container_id = launch_container(image, network='grid', ports=ports, user=random_user_id, platform=platform)
else:
test_container_id = launch_container(image, network='grid', ports=ports)
test_container_id = launch_container(image, network='grid', ports=ports, platform=platform)
prune_networks()

wait_for_grid(platform)

logger.info('========== / Containers ready to go ==========')

try:
Expand Down