Skip to contentSkip to conversation

automation: QEMU-based smoke test

PATCH In review Wei Liu 3 participants 13 messages Nov 19, 2018 – Nov 20, 2018

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

cover automation: QEMU-based smoke test

See https://gitlab.com/xen-project/people/liuw/xen/pipelines/37173009

A pipeline while I was developing this series.

Wei Liu (4):
automation: introduce CONTAINER_NO_PULL for containerize
automation: stash default config file for artifact extraction
automation: also specify xen binary as artifact on x86_64
automation: add qemu smoke test

 .gitlab-ci.yml                          | 22 +++++++++++++++++++++-
 automation/build/README.md              |  3 +++
 automation/scripts/build                |  7 +++++++
 automation/scripts/containerize         |  8 +++++---
 automation/scripts/qemu-smoke-x86-64.sh | 23 +++++++++++++++++++++++
 5 files changed, 59 insertions(+), 4 deletions(-)
 create mode 100755 automation/scripts/qemu-smoke-x86-64.sh
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#1 lore raw

PATCH 1/4 automation: introduce CONTAINER_NO_PULL for containerize

---
 automation/build/README.md      | 3 +++
 automation/scripts/containerize | 8 +++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
automation/build/README.md +3 -0
index f6cfd46f1e..d8c8a18e33 100644
@@ -52,6 +52,9 @@ understands.
 
 - CONTAINER_UID0: This specifies whether root is used inside the container.
 
+- CONTAINER_NO_PULL: If set to 1, the script will not pull from docker hub.
+  This is useful when testing container locally.
+
 - XEN_CONFIG_EXPERT: If this is defined in your shell it will be
   automatically passed through to the container.
 
automation/scripts/containerize +5 -3
index aa08274eba..a3e5d79c70 100755
@@ -42,9 +42,11 @@ tty -s && termint=t
 # Fetch the latest version of the container in hub.docker.com,
 # unless it's a newly created local copy.
 #
-einfo "*** Ensuring ${CONTAINER} is up to date"
-docker pull ${CONTAINER} > /dev/null ||     \
-    die "Failed to update docker container"
+if [[ "_${CONTAINER_NO_PULL}" != "_1" ]]; then
+    einfo "*** Ensuring ${CONTAINER} is up to date"
+    docker pull ${CONTAINER} > /dev/null ||     \
+        die "Failed to update docker container"
+fi
 
 if hash greadlink > /dev/null 2>&1; then
     READLINK=greadlink
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] automation: introduce CONTAINER_NO_PULL for containerize

Quoted 11 lines · Wei Liu
---
 automation/build/README.md      | 3 +++
 automation/scripts/containerize | 8 +++++---
 2 files changed, 8 insertions(+), 3 deletions(-)
automation/build/README.md +0 -0
index f6cfd46f1e..d8c8a18e33 100644

automation/build/README.md understands. · line 57

Quoted 6 lines
automation/build/README.md +3 -0
@@ -52,6 +52,9 @@ understands.
 
 - CONTAINER_UID0: This specifies whether root is used inside the container.
 
+- CONTAINER_NO_PULL: If set to 1, the script will not pull from docker hub.
+  This is useful when testing container locally.
+

Good addition.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#3 lore raw

PATCH 2/4 automation: stash default config file for artifact extraction

In reply to Wei Liu
---
 .gitlab-ci.yml           | 2 +-
 automation/scripts/build | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
.gitlab-ci.yml +1 -1
index 5678b552c4..28152e906d 100644
@@ -8,7 +8,7 @@ stages:
     - ./automation/scripts/build 2>&1 | tee build.log
   artifacts:
     paths:
-      - xen/.config
+      - xen-config
       - '*.log'
     when: always
   except:
automation/scripts/build +3 -0
index 48e398ea20..a1f9a5da56 100755
@@ -26,6 +26,9 @@ fi
 
 make -j$(nproc) dist
 
+# Extract artifacts to avoid getting rewritten by customised builds
+cp xen/.config xen-config
+
 # Build all the configs we care about
 case ${XEN_TARGET_ARCH} in
     x86_64) arch=x86 ;;
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 2/4
#4 lore raw

Re: [PATCH 2/4] automation: stash default config file for artifact extraction

Quoted 11 lines · Wei Liu
---
 .gitlab-ci.yml           | 2 +-
 automation/scripts/build | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
.gitlab-ci.yml +0 -0
index 5678b552c4..28152e906d 100644

.gitlab-ci.yml stages: · line 11

Quoted 5 lines
.gitlab-ci.yml +1 -1
@@ -8,7 +8,7 @@ stages:
     - ./automation/scripts/build 2>&1 | tee build.log
   artifacts:
     paths:
-      - xen/.config
+      - xen-config

I assume the goal here is to aid in troubleshooting when we notice a failure which makes sense. You could toss that into the commit message while committing it.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#5 lore raw

PATCH 3/4 automation: also specify xen binary as artifact on x86_64

In reply to Wei Liu

... so that it can be passed on to test stage.

Note that xen is only extracted for x86_64 build since others may not have that. Use a directory to account for possibly different file names on Arm.

---
 .gitlab-ci.yml           | 1 +
 automation/scripts/build | 4 ++++
 2 files changed, 5 insertions(+)
.gitlab-ci.yml +1 -0
index 28152e906d..d11459b117 100644
@@ -8,6 +8,7 @@ stages:
     - ./automation/scripts/build 2>&1 | tee build.log
   artifacts:
     paths:
+      - binaries/
       - xen-config
       - '*.log'
     when: always
automation/scripts/build +4 -0
index a1f9a5da56..d4aceb745f 100755
@@ -28,6 +28,10 @@ make -j$(nproc) dist
 
 # Extract artifacts to avoid getting rewritten by customised builds
 cp xen/.config xen-config
+mkdir binaries
+if [[ "x${XEN_TARGET_ARCH}" == "xx86_64" ]]; then
+    cp xen/xen binaries/xen
+fi
 
 # Build all the configs we care about
 case ${XEN_TARGET_ARCH} in
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 3/4
#6 lore raw

Re: [PATCH 3/4] automation: also specify xen binary as artifact on x86_64

Quoted 7 lines · Wei Liu

... so that it can be passed on to test stage.

Note that xen is only extracted for x86_64 build since others may not have that. Use a directory to account for possibly different file names on Arm.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#7 lore raw

Re: [PATCH 3/4] automation: also specify xen binary as artifact on x86_64

In reply to Wei Liu

automation/scripts/build make -j$(nproc) dist · line 32

Quoted 10 lines · Wei Liu
automation/scripts/build +2 -0
index a1f9a5da56..d4aceb745f 100755
@@ -28,6 +28,10 @@ make -j$(nproc) dist
 
 # Extract artifacts to avoid getting rewritten by customised builds
 cp xen/.config xen-config
+mkdir binaries
+if [[ "x${XEN_TARGET_ARCH}" == "xx86_64" ]]; then

Either quote the strings, or use the pre-x trick, but you don't need to do both together.

~Andrew

automation/scripts/build make -j$(nproc) dist · line 37

Quoted 5 lines
automation/scripts/build +2 -0
+    cp xen/xen binaries/xen
+fi
 
 # Build all the configs we care about
 case ${XEN_TARGET_ARCH} in

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#8 lore raw

Re: [PATCH 3/4] automation: also specify xen binary as artifact on x86_64

Quoted 7 lines · Andrew Cooper
Quoted 6 lines · Wei Liu
automation/scripts/build +0 -0
index a1f9a5da56..d4aceb745f 100755
@@ -28,6 +28,10 @@ make -j$(nproc) dist
 
Quoted 7 lines

automation/scripts/build make -j$(nproc) dist · line 32

Quoted 4 lines
automation/scripts/build +2 -0
 # Extract artifacts to avoid getting rewritten by customised builds
 cp xen/.config xen-config
+mkdir binaries
+if [[ "x${XEN_TARGET_ARCH}" == "xx86_64" ]]; then

Either quote the strings, or use the pre-x trick, but you don't need to do both together.

Fixed, thanks.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#9 lore raw

PATCH 4/4 automation: add qemu smoke test

In reply to Wei Liu

This patch introduces a new test stage into the pipeline and provides a simple QEMU based smoke test.

---
 .gitlab-ci.yml                          | 19 +++++++++++++++++++
 automation/scripts/qemu-smoke-x86-64.sh | 23 +++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64.sh
.gitlab-ci.yml +19 -0
index d11459b117..b9ccba6ab2 100644
@@ -1,5 +1,6 @@
 stages:
   - build
+  - test
 
 .build-tmpl: &build
   stage: build
@@ -379,3 +380,21 @@ debian-unstable-gcc-debug-arm64-randconfig:
   variables:
     CONTAINER: debian:unstable-arm64v8
     RANDCONFIG: y
+
+
+# Test jobs
+qemu-smoke-x86-64:
+  stage: test
+  image: registry.gitlab.com/xen-project/xen/${CONTAINER}
+  variables:
+    CONTAINER: debian:stretch
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64.sh 2>&1 | tee qemu-smoke-x86-64.log
+  artifacts:
+    paths:
+      - smoke.serial
+    when: always
+  dependencies:
+    - debian-stretch-gcc-debug
+  tags:
+    - x86_64
automation/scripts/qemu-smoke-x86-64.sh new file +23 -0
new file mode 100755
index 0000000000..7dc2c8542b
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+set -ex
+
+# Install QEMU
+export DEBIAN_FRONTENT=noninteractive
+apt-get -qy update
+apt-get -qy install qemu-system-x86
+
+# Clone and build XTF
+git clone https://xenbits.xen.org/git-http/xtf.git
+cd xtf && make -j$(nproc) && cd -
+
+rm -f smoke.serial
+set +e
+timeout -k 1 10 \
+qemu-system-x86_64 -nographic -kernel binaries/xen \
+        -initrd xtf/tests/example/test-pv32pae-example \
+        -append 'loglvl=all com1=115200,,8n1 console=com1 noreboot' \
+        -m 512 -monitor none -serial file:smoke.serial
+set -e
+grep -q 'Test result: SUCCESS' smoke.serial || exit 1
+exit 0
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 4/4
#10 lore raw

Re: [PATCH 4/4] automation: add qemu smoke test

Quoted 25 lines · Wei Liu

This patch introduces a new test stage into the pipeline and provides a simple QEMU based smoke test.

---
 .gitlab-ci.yml                          | 19 +++++++++++++++++++
 automation/scripts/qemu-smoke-x86-64.sh | 23 +++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64.sh
.gitlab-ci.yml +1 -0
index d11459b117..b9ccba6ab2 100644
@@ -1,5 +1,6 @@
 stages:
   - build
+  - test
 
 .build-tmpl: &build
   stage: build
@@ -379,3 +380,21 @@ debian-unstable-gcc-debug-arm64-randconfig:
   variables:
     CONTAINER: debian:unstable-arm64v8
     RANDCONFIG: y

.gitlab-ci.yml debian-unstable-gcc-debug-arm64-randconfig: · line 392

Quoted 10 lines
.gitlab-ci.yml +10 -0
+
+
+# Test jobs
+qemu-smoke-x86-64:
+  stage: test
+  image: registry.gitlab.com/xen-project/xen/${CONTAINER}
+  variables:
+    CONTAINER: debian:stretch
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64.sh 2>&1 | tee qemu-smoke-x86-64.log

Do you want to capture this log in the artifacts below too?

.gitlab-ci.yml debian-unstable-gcc-debug-arm64-randconfig: · line 400

Quoted 8 lines
.gitlab-ci.yml +8 -0
+  artifacts:
+    paths:
+      - smoke.serial
+    when: always
+  dependencies:
+    - debian-stretch-gcc-debug
+  tags:
+    - x86_64

Just one quick question. If you do that can be fixed up at commit time as well so I have no problem saying:

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

author
#11 lore raw

Re: [PATCH 4/4] automation: add qemu smoke test

Quoted 30 lines · Doug Goldstein
Quoted 29 lines · Wei Liu

This patch introduces a new test stage into the pipeline and provides a simple QEMU based smoke test.

---
 .gitlab-ci.yml                          | 19 +++++++++++++++++++
 automation/scripts/qemu-smoke-x86-64.sh | 23 +++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100755 automation/scripts/qemu-smoke-x86-64.sh
.gitlab-ci.yml +5 -0
index d11459b117..b9ccba6ab2 100644
@@ -1,5 +1,6 @@
 stages:
   - build
+  - test
 
 .build-tmpl: &build
   stage: build
@@ -379,3 +380,21 @@ debian-unstable-gcc-debug-arm64-randconfig:
   variables:
     CONTAINER: debian:unstable-arm64v8
     RANDCONFIG: y
+
+
+# Test jobs
+qemu-smoke-x86-64:
Quoted 8 lines

.gitlab-ci.yml debian-unstable-gcc-debug-arm64-randconfig: · line 392

Quoted 6 lines
.gitlab-ci.yml +6 -0
+  stage: test
+  image: registry.gitlab.com/xen-project/xen/${CONTAINER}
+  variables:
+    CONTAINER: debian:stretch
+  script:
+    - ./automation/scripts/qemu-smoke-x86-64.sh 2>&1 | tee qemu-smoke-x86-64.log

Do you want to capture this log in the artifacts below too?

Good catch. I will add it to the list.

Quoted 10 lines

.gitlab-ci.yml debian-unstable-gcc-debug-arm64-randconfig: · line 400

Quoted 9 lines
.gitlab-ci.yml +8 -0
+  artifacts:
+    paths:
+      - smoke.serial
+    when: always
+  dependencies:
+    - debian-stretch-gcc-debug
+  tags:
+    - x86_64
Quoted 4 lines

Just one quick question. If you do that can be fixed up at commit time as well so I have no problem saying:

Thank you.

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel