[PATCH] osmo-trx[master]: contrib/jenkins.sh: Use qemu+proot+debootstrap to run tests ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jan 11 18:17:57 UTC 2018


Review at  https://gerrit.osmocom.org/5763

contrib/jenkins.sh: Use qemu+proot+debootstrap to run tests with ARM instruction set

The following logic doesn't require root access to run the tests, which
means we can easily run it inside jenkins.

Change-Id: Iba3f4de008662805d8ffc46e1f473e407b088fb8
---
M contrib/jenkins.sh
M tests/testsuite.at
2 files changed, 53 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/63/5763/1

diff --git a/contrib/jenkins.sh b/contrib/jenkins.sh
index f31579e..82e73af 100755
--- a/contrib/jenkins.sh
+++ b/contrib/jenkins.sh
@@ -1,12 +1,58 @@
 #!/bin/sh
 set -ex
 
-osmo-clean-workspace.sh
+if [ -z "${INSIDE_CHROOT}" ]; then
+
+        osmo-clean-workspace.sh
+
+        if [ "x${INSTR}" = "x--with-neon" ] || [ "x${INSTR}" = "x--with-neon-vfpv4" ]; then
+                #apt-get install qemu qemu-user-static qemu-system-arm debootstrap fakeroot proot
+                mychroot_nocwd() {
+                        # LC_ALL + LANGUAGE set to avoid lots of print errors due to locale not being set inside container
+                        # PATH is needed to be able to reach binaries like ldconfig without logging in to root, which adds the paths to PATH.
+                        # PROOT_NO_SECCOMP is requried due to proot bug #106
+                        LC_ALL=C LANGUAGE=C PATH="$PATH:/usr/sbin:/sbin" PROOT_NO_SECCOMP=1 proot -r "$ROOTFS" -w / -b /proc --root-id -q qemu-arm-static "$@"
+                }
+
+                mychroot() {
+                        mychroot_nocwd -w / "$@"
+                }
+
+                CONTRIB_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+                OSMOTRX_DIR="${CONTRIB_DIR}/.."
+                PREFIX="${WORKSPACE:-/home/pespin/tmp/vm}"
+                ROOTFS="${PREFIX}/qemu-img"
+                mkdir -p $PREFIX
+
+                # This is not needed after switching to proot:
+                #if [ ! -f /proc/sys/fs/binfmt_misc/arm ]; then
+                # echo ':arm:M::\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x28\x00:\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\xff:/usr/bin/qemu-arm-static:' | tee /proc/sys/fs/binfmt_misc/register
+                #fi
+
+                # Prepare chroot:
+                if [ ! -d "$ROOTFS" ]; then
+                        mkdir -p "$ROOTFS"
+                        fakeroot qemu-debootstrap --foreign --include="linux-image-armmp-lpae" --arch=armhf stretch "$ROOTFS" http://ftp.de.debian.org/debian/
+                        # Hack to avoid debootstrap trying to mount /proc, as it will fail with "no permissions" and anyway proot takes care of it:
+                        sed -i "s/setup_proc//g" "$ROOTFS/debootstrap/suite-script"
+                        mychroot /debootstrap/debootstrap --second-stage --verbose http://ftp.de.debian.org/debian/
+                        mychroot -b /dev apt-get update
+                        mychroot apt-get -y install build-essential dh-autoreconf pkg-config libuhd-dev libusb-1.0-0-dev libusb-dev
+                fi
+                # Run jenkins.sh inside the chroot:
+                INSIDE_CHROOT=1 mychroot_nocwd -w /osmo-trx -b "$OSMOTRX_DIR:/osmo-trx" ./contrib/jenkins.sh
+                exit 0
+        fi
+fi
+
+### BUILD osmo-trx
 
 autoreconf --install --force
-./configure
+./configure $INSTR
 $MAKE $PARALLEL_MAKE
 $MAKE check \
   || cat-testlogs.sh
 
-osmo-clean-workspace.sh
+if [ -z "x${INSIDE_CHROOT}" ]; then
+        osmo-clean-workspace.sh
+fi
diff --git a/tests/testsuite.at b/tests/testsuite.at
index c6ca848..b457c96 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -28,6 +28,8 @@
 
 AT_SETUP([SocketsTest])
 AT_KEYWORDS([SocketsTest])
+# Disabled for ARM builds as we use proot+qemu and fails due to https://github.com/proot-me/PRoot/issues/8
+AT_SKIP_IF(test "uname -m | grep x86")
 cat $abs_srcdir/CommonLibs/SocketsTest.ok > expout
 AT_CHECK([$abs_top_builddir/tests/CommonLibs/SocketsTest], [], [expout], [ignore])
 AT_CLEANUP
@@ -46,6 +48,8 @@
 
 AT_SETUP([convolve_test])
 AT_KEYWORDS([convolve_test])
+# Disabled for ARM builds as it gives different output than x86, see  OS#2826
+AT_SKIP_IF(test "uname -m | grep x86")
 cat $abs_srcdir/Transceiver52M/convolve_test.ok > expout
 AT_CHECK([$abs_top_builddir/tests/Transceiver52M/convolve_test], [], [expout], [])
 AT_CLEANUP

-- 
To view, visit https://gerrit.osmocom.org/5763
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba3f4de008662805d8ffc46e1f473e407b088fb8
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list