Skip to contentSkip to conversation

automation: add clang and lld 8 tests to gitlab

PATCH Superseded Roger Pau Monne 2 participants 2 messages Jun 10, 2019

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 automation: add clang and lld 8 tests to gitlab

Using clang and lld 8 requires installing the packages from the official llvm apt repositories, so modify the Debian Docker files for stretch and unstable to add the llvm repo and install clang and lld from it.

Also add some jobs to test building Xen with clang 8 and lld.

---
I've tested this manually by doing:

# make -C automation/build debian/stretch
# CONTAINER_NO_PULL=1 ./automation/scripts/containerize << END
./configure --with-system-seabios=/usr/share/seabios/bios.bin \
            --with-system-ipxe=/usr/lib/ipxe/ipxe.pxe --disable-stubdom
make -j8 dist CC=clang-8 CXX=clang-8 LD=ld.lld-8 clang=y
END
---
Cc: Doug Goldstein <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
 - Change the order of actions in the dockerfile
 - Cleanup after installing llvm tools.

Changes since v1:
- Use ld.lld-8 instead of lld-8, as that's the recommended way reported by lld-8.

---
 automation/build/debian/stretch-llvm.list   |  3 ++
 automation/build/debian/stretch.dockerfile  | 13 ++++++++
 automation/build/debian/unstable-llvm.list  |  3 ++
 automation/build/debian/unstable.dockerfile | 13 ++++++++
 automation/gitlab-ci/build.yaml             | 37 +++++++++++++++++++++
 automation/scripts/build                    |  2 +-
 6 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 automation/build/debian/stretch-llvm.list
 create mode 100644 automation/build/debian/unstable-llvm.list
automation/build/debian/stretch-llvm.list new file +3 -0
new file mode 100644
index 0000000000..09fe843fb2
@@ -0,0 +1,3 @@
+# Strech LLVM 8 repos
+deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
+deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
automation/build/debian/stretch.dockerfile +13 -0
index daf8c9d384..55c6f065ad 100644
@@ -42,6 +42,19 @@ RUN apt-get update && \
         wget \
         git \
         nasm \
+        gnupg \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
+COPY stretch-llvm.list /etc/apt/sources.list.d/
+
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        clang-8 \
+        lld-8 \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
automation/build/debian/unstable-llvm.list new file +3 -0
new file mode 100644
index 0000000000..dc119fa0b4
@@ -0,0 +1,3 @@
+# Unstable LLVM 8 repos
+deb http://apt.llvm.org/unstable/ llvm-toolchain-8 main
+deb-src http://apt.llvm.org/unstable/ llvm-toolchain-8 main
automation/build/debian/unstable.dockerfile +13 -0
index 7762cf97ab..f9ab9e8200 100644
@@ -42,6 +42,19 @@ RUN apt-get update && \
         wget \
         git \
         nasm \
+        gnupg \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -
+COPY unstable-llvm.list /etc/apt/sources.list.d/
+
+RUN apt-get update && \
+    apt-get --quiet --yes install \
+        clang-8 \
+        lld-8 \
         && \
         apt-get autoremove -y && \
         apt-get clean && \
automation/gitlab-ci/build.yaml +37 -0
index dd5722a5bb..17de3b1848 100644
@@ -26,6 +26,13 @@
     CXX: clang++
     clang: y
 
+.clang-8-tmpl:
+  variables: &clang-8
+    CC: clang-8
+    CXX: clang++-8
+    LD: ld.lld-8
+    clang: y
+
 .x86-64-build-tmpl:
   <<: *build
   variables:
@@ -90,6 +97,16 @@
   variables:
     <<: *clang
 
+.clang-8-x86-64-build:
+  extends: .x86-64-build
+  variables:
+    <<: *clang-8
+
+.clang-8-x86-64-build-debug:
+  extends: .x86-64-build-debug
+  variables:
+    <<: *clang-8
+
 .clang-x86-32-build:
   extends: .x86-32-build
   variables:
@@ -219,6 +236,16 @@ debian-stretch-clang-debug:
   variables:
     CONTAINER: debian:stretch
 
+debian-stretch-clang-8:
+  extends: .clang-8-x86-64-build
+  variables:
+    CONTAINER: debian:stretch
+
+debian-stretch-clang-8-debug:
+  extends: .clang-8-x86-64-build-debug
+  variables:
+    CONTAINER: debian:stretch
+
 debian-stretch-gcc:
   extends: .gcc-x86-64-build
   variables:
@@ -259,6 +286,16 @@ debian-unstable-clang-debug:
   variables:
     CONTAINER: debian:unstable
 
+debian-unstable-clang-8:
+  extends: .clang-8-x86-64-build
+  variables:
+    CONTAINER: debian:unstable
+
+debian-unstable-clang-8-debug:
+  extends: .clang-8-x86-64-build-debug
+  variables:
+    CONTAINER: debian:unstable
+
 debian-unstable-gcc:
   extends: .gcc-x86-64-build
   variables:
automation/scripts/build +1 -1
index 8a57e097a9..83c44e6ce7 100755
@@ -19,7 +19,7 @@ fi
 cfgargs=()
 cfgargs+=("--enable-docs")
 
-if [[ "${CC}" == "clang" ]]; then
+if [[ "${CC}" == "clang"* ]]; then
     # SeaBIOS cannot be built with clang
     cfgargs+=("--with-system-seabios=/usr/share/seabios/bios.bin")
     # iPXE cannot be built with clang
Signature · 7 lines
2.20.1 (Apple Git-117)


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 8 lines · Roger Pau Monne

Using clang and lld 8 requires installing the packages from the official llvm apt repositories, so modify the Debian Docker files for stretch and unstable to add the llvm repo and install clang and lld from it.

Also add some jobs to test building Xen with clang 8 and lld.

Quoted 8 lines

---
I've tested this manually by doing:

# make -C automation/build debian/stretch
# CONTAINER_NO_PULL=1 ./automation/scripts/containerize << END
./configure --with-system-seabios=/usr/share/seabios/bios.bin \
            --with-system-ipxe=/usr/lib/ipxe/ipxe.pxe --disable-stubdom
make -j8 dist CC=clang-8 CXX=clang-8 LD=ld.lld-8 clang=y

DYM CXX=clang++-8 ?

automation/build/debian/stretch-llvm.list

Quoted 28 lines

END
---
Cc: Doug Goldstein <[email protected]>
Cc: Wei Liu <[email protected]>
---
Changes since v2:
- Change the order of actions in the dockerfile
- Cleanup after installing llvm tools.

Changes since v1:
- Use ld.lld-8 instead of lld-8, as that's the recommended way reported by lld-8.

---
 automation/build/debian/stretch-llvm.list   |  3 ++
 automation/build/debian/stretch.dockerfile  | 13 ++++++++
 automation/build/debian/unstable-llvm.list  |  3 ++
 automation/build/debian/unstable.dockerfile | 13 ++++++++
 automation/gitlab-ci/build.yaml             | 37 +++++++++++++++++++++9
 automation/scripts/build                    |  2 +-
 6 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100644 automation/build/debian/stretch-llvm.list
 create mode 100644 automation/build/debian/unstable-llvm.list
automation/build/debian/stretch-llvm.list new file +0 -0
new file mode 100644
index 0000000000..09fe843fb2

Thinking forwards to when we want LLVM 9, these two files should have a -8 suffix for now.  Can be fixed on commit.

Quoted 9 lines
automation/build/debian/stretch-llvm.list new file +3 -0
@@ -0,0 +1,3 @@
+# Strech LLVM 8 repos
+deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
+deb-src http://apt.llvm.org/stretch/ llvm-toolchain-stretch-8 main
automation/build/debian/stretch.dockerfile +0 -0
index daf8c9d384..55c6f065ad 100644

automation/build/debian/stretch.dockerfile RUN apt-get update && \ · line 51

Quoted 10 lines
automation/build/debian/stretch.dockerfile +7 -0
@@ -42,6 +42,19 @@ RUN apt-get update && \
         wget \
         git \
         nasm \
+        gnupg \
+        && \
+        apt-get autoremove -y && \
+        apt-get clean && \
+        rm -rf /var/lib/apt/lists* /tmp/* /var/tmp/*
+
+RUN wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -

This would be slightly easer to read with spaces around the pipe. Again, can be fixed on commit.

~Andrew

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