[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] automation: add x86_64 xilinx smoke test



commit 6979e17b3f8a18d2ba5dbd4f0623c4061dae0dfc
Author:     Victor Lira <victorm.lira@xxxxxxx>
AuthorDate: Fri Jul 26 18:56:39 2024 -0700
Commit:     Stefano Stabellini <stefano.stabellini@xxxxxxx>
CommitDate: Tue Jul 30 15:14:31 2024 -0700

    automation: add x86_64 xilinx smoke test
    
    Add a test script and related job for running x86_64 dom0 tests.
    
    Signed-off-by: Victor Lira <victorm.lira@xxxxxxx>
    Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>
---
 automation/gitlab-ci/test.yaml                 |  24 +++++
 automation/scripts/xilinx-smoke-dom0-x86_64.sh | 144 +++++++++++++++++++++++++
 2 files changed, 168 insertions(+)

diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml
index d89e41f244..4e74946419 100644
--- a/automation/gitlab-ci/test.yaml
+++ b/automation/gitlab-ci/test.yaml
@@ -96,6 +96,22 @@
   tags:
     - xilinx
 
+.xilinx-x86_64:
+  extends: .test-jobs-common
+  variables:
+    CONTAINER: ubuntu:xenial-xilinx
+    LOGFILE: xilinx-smoke-x86_64.log
+  artifacts:
+    paths:
+      - smoke.serial
+      - '*.log'
+    when: always
+  only:
+    variables:
+      - $XILINX_JOBS == "true" && $CI_COMMIT_REF_PROTECTED == "true"
+  tags:
+    - xilinx
+
 .adl-x86-64:
   extends: .test-jobs-common
   variables:
@@ -159,6 +175,14 @@ xilinx-smoke-dom0less-arm64-gcc-debug-gem-passthrough:
     - *arm64-test-needs
     - alpine-3.18-gcc-debug-arm64
 
+xilinx-smoke-dom0-x86_64-gcc-debug:
+  extends: .xilinx-x86_64
+  script:
+    - ./automation/scripts/xilinx-smoke-dom0-x86_64.sh ping 2>&1 | tee 
${LOGFILE}
+  needs:
+    - *x86-64-test-needs
+    - alpine-3.18-gcc-debug
+
 adl-smoke-x86-64-gcc-debug:
   extends: .adl-x86-64
   script:
diff --git a/automation/scripts/xilinx-smoke-dom0-x86_64.sh 
b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
new file mode 100755
index 0000000000..e6e6fac6a5
--- /dev/null
+++ b/automation/scripts/xilinx-smoke-dom0-x86_64.sh
@@ -0,0 +1,144 @@
+#!/bin/sh
+
+# Run x86_64 dom0 tests on hardware.
+
+set -ex
+
+fatal() {
+    echo "$(basename "$0") $*" >&2
+    exit 1
+}
+
+# Test parameter defaults.
+TEST="$1"
+PASS_MSG="Test passed: ${TEST}"
+XEN_CMD_CONSOLE="console=com1 com1=115200,8n1,0x3F8,4"
+XEN_CMD_DOM0="dom0=pvh dom0_max_vcpus=4 dom0_mem=4G"
+XEN_CMD_XEN="sched=null loglvl=all guest_loglvl=all console_timestamps=boot"
+XEN_CMD_EXTRA=""
+DOM0_CMD=""
+DOMU_CMD=""
+DOMU_CFG='
+type = "pvh"
+name = "domU"
+kernel = "/boot/vmlinuz"
+ramdisk = "/boot/initrd-domU"
+extra = "root=/dev/ram0 console=hvc0"
+memory = 512
+vif = [ "bridge=xenbr0", ]
+disk = [ ]
+'
+TIMEOUT_SECONDS=120
+
+# Select test variant.
+if [ "${TEST}" = "ping" ]; then
+    DOMU_MSG="domU online"
+    DOMU_CMD="
+ifconfig eth0 192.168.0.2
+until ping -c 10 192.168.0.1; do
+    sleep 1
+done
+echo \"${DOMU_MSG}\"
+"
+    DOM0_CMD="
+set +x
+until grep -q \"${DOMU_MSG}\" /var/log/xen/console/guest-domU.log; do
+    sleep 1
+done
+set -x
+echo \"${PASS_MSG}\"
+"
+else
+    fatal "Unknown test: ${TEST}"
+fi
+
+# Set up domU rootfs.
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+echo "#!/bin/sh
+
+${DOMU_CMD}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "rc_verbose=yes" >> etc/rc.conf
+sed -i -e 's/^Welcome/domU \0/' etc/issue
+find . | cpio -H newc -o | gzip > ../binaries/domU-rootfs.cpio.gz
+cd ..
+rm -rf rootfs
+
+# Set up dom0 rootfs.
+mkdir -p rootfs
+cd rootfs
+tar xzf ../binaries/initrd.tar.gz
+mkdir boot
+mkdir proc
+mkdir run
+mkdir srv
+mkdir sys
+rm var/run
+cp -ar ../binaries/dist/install/* .
+echo "#!/bin/bash
+
+export LD_LIBRARY_PATH=/usr/local/lib
+bash /etc/init.d/xencommons start
+
+brctl addbr xenbr0
+brctl addif xenbr0 eth0
+ifconfig eth0 up
+ifconfig xenbr0 up
+ifconfig xenbr0 192.168.0.1
+
+# get domU console content into test log
+tail -F /var/log/xen/console/guest-domU.log 2>/dev/null | sed -e \"s/^/(domU) 
/\" &
+xl create /etc/xen/domU.cfg
+${DOM0_CMD}
+" > etc/local.d/xen.start
+chmod +x etc/local.d/xen.start
+echo "${DOMU_CFG}" > etc/xen/domU.cfg
+echo "rc_verbose=yes" >> etc/rc.conf
+echo "XENCONSOLED_TRACE=all" >> etc/default/xencommons
+echo "QEMU_XEN=/bin/false" >> etc/default/xencommons
+mkdir -p var/log/xen/console
+cp ../binaries/bzImage boot/vmlinuz
+cp ../binaries/domU-rootfs.cpio.gz boot/initrd-domU
+find . | cpio -H newc -o | gzip > ../binaries/dom0-rootfs.cpio.gz
+cd ..
+
+# Load software into TFTP server directory.
+TFTP="/scratch/gitlab-runner/tftp"
+XEN_CMDLINE="${XEN_CMD_CONSOLE} ${XEN_CMD_XEN} ${XEN_CMD_DOM0} 
${XEN_CMD_EXTRA}"
+cp -f binaries/xen ${TFTP}/pxelinux.cfg/xen
+cp -f binaries/bzImage ${TFTP}/pxelinux.cfg/vmlinuz
+cp -f binaries/dom0-rootfs.cpio.gz ${TFTP}/pxelinux.cfg/initrd-dom0
+echo "
+net_default_server=10.0.6.1
+multiboot2 (tftp)/pxelinux.cfg/xen ${XEN_CMDLINE}
+module2 (tftp)/pxelinux.cfg/vmlinuz console=hvc0 root=/dev/ram0 earlyprintk=xen
+module2 (tftp)/pxelinux.cfg/initrd-dom0
+boot
+" > ${TFTP}/pxelinux.cfg/grub.cfg
+
+# Power cycle board and collect serial port output.
+SERIAL_CMD="cat /dev/ttyUSB9 | tee smoke.serial | sed 's/\r//'"
+sh /scratch/gitlab-runner/v2000a.sh 2
+sleep 5
+sh /scratch/gitlab-runner/v2000a.sh 1
+sleep 5
+set +e
+stty -F /dev/ttyUSB9 115200
+timeout -k 1 ${TIMEOUT_SECONDS} nohup sh -c "${SERIAL_CMD}"
+sh /scratch/gitlab-runner/v2000a.sh 2
+
+set -e
+
+if grep -q "${PASS_MSG}" smoke.serial; then
+    exit 0
+fi
+
+fatal "Test failed"
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.