]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
(no commit message)
authorRoger Pau Monne <roger.pau@citrix.com>
Wed, 5 Apr 2023 11:47:28 +0000 (13:47 +0200)
committerRoger Pau Monne <roger.pau@citrix.com>
Thu, 13 Apr 2023 10:16:24 +0000 (12:16 +0200)
automation/gitlab-ci/build.yaml
automation/gitlab-ci/test.yaml
automation/scripts/build
automation/scripts/qemu-alpine-x86_64-livepatch.sh [new file with mode: 0755]

index c26ae8c1acaff17676ca90cdad1b0932d483d282..02b804a623b41a400dfafa0e2cef604b74699d99 100644 (file)
@@ -469,6 +469,14 @@ alpine-3.12-gcc:
   variables:
     CONTAINER: alpine:3.12
 
+alpine-3.12-gcc-livepatch:
+  extends: .gcc-x86-64-build
+  variables:
+    CONTAINER: alpine:3.12
+    LIVEPATCH: y
+    EXTRA_XEN_CONFIG: |
+      CONFIG_LIVEPATCH=y
+
 alpine-3.12-gcc-debug:
   extends: .gcc-x86-64-build-debug
   variables:
index 08997d9d7718598f71384fc6ad9be0f0ebbd549e..57b091d1e7f4e2b9b023d3d29bf41af45aff2be4 100644 (file)
@@ -373,3 +373,11 @@ qemu-smoke-riscv64-gcc:
     - ./automation/scripts/qemu-smoke-riscv64.sh 2>&1 | tee ${LOGFILE}
   needs:
     - archlinux-current-gcc-riscv64-debug
+
+qemu-alpine-x86_64-gcc-livepatch:
+  extends: .qemu-x86-64
+  script:
+    - ./automation/scripts/qemu-alpine-x86_64-livepatch.sh 2>&1 | tee ${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.12-gcc-livepatch
index 7d1b19c4250d1ced2930f23bfaaa1531b109cc0e..2f9ef2d8ba4a212ab90e7a4fd21bcccdbcd28ce7 100755 (executable)
@@ -102,3 +102,16 @@ else
     cp -r dist binaries/
     if [[ -f xen/xen ]] ; then cp xen/xen binaries/xen; fi
 fi
+
+if [[ "$LIVEPATCH" == "y" ]]; then
+    # Build a test livepatch using livepatch-tools.
+
+    BUILDID=$(readelf -Wn xen/xen-syms | sed -n -e 's/^.*Build ID: //p')
+
+    git clone https://xenbits.xen.org/git-http/livepatch-build-tools.git
+    cd livepatch-build-tools
+    make
+    ./livepatch-build -s ../ -p ../xen/test/livepatch/test.patch -o out \
+        -c ../xen/.config --depends $BUILDID --xen-depends $BUILDID
+    cp out/test.livepatch ../binaries/test.livepatch
+fi
diff --git a/automation/scripts/qemu-alpine-x86_64-livepatch.sh b/automation/scripts/qemu-alpine-x86_64-livepatch.sh
new file mode 100755 (executable)
index 0000000..1c53cbe
--- /dev/null
@@ -0,0 +1,68 @@
+#!/bin/bash
+
+set -x
+
+cd binaries
+# initrd.tar.gz is Dom0 rootfs
+mkdir -p rootfs
+cd rootfs
+tar xvzf ../initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../dist/install/* .
+cp test.livepatch ./root
+echo '#!/bin/bash
+
+set -ex
+
+export LD_LIBRARY_PATH=/usr/local/lib
+
+result=`xen-livepatch test`
+if [ "$result" != "1" ]; then
+    echo "FAIL"
+    exit 1
+fi
+
+xen-livepatch load /root/test.livepatch
+
+result=`xen-livepatch test`
+if [ "$result" != "2" ]; then
+    echo "FAIL"
+    exit 1
+fi
+
+echo "SUCCESS"
+' > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+# rebuild Dom0 rootfs
+find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz
+cd ../..
+
+cat >> binaries/pxelinux.0 << EOF
+#!ipxe
+
+kernel xen console=com1
+module bzImage console=hvc0
+module xen-rootfs.cpio.gz
+boot
+EOF
+
+# Run the test
+rm -f smoke.serial
+set +e
+timeout -k 1 720 \
+qemu-system-x86_64 \
+    -cpu qemu64,+svm \
+    -m 2G -smp 2 \
+    -monitor none -serial stdio \
+    -nographic \
+    -device virtio-net-pci,netdev=n0 \
+    -netdev user,id=n0,tftp=binaries,bootfile=/pxelinux.0 |& tee smoke.serial
+
+set -e
+(grep -q "Domain-0" smoke.serial && grep -q "SUCCESS" smoke.serial) || exit 1
+exit 0