Linux: automated testing

Created on 19 Mar 2018  路  9Comments  路  Source: ClangBuiltLinux/linux

While we're working on getting 0day support, I think we can wire up travis-ci.org to build some configs with Clang.

infrastructure

Most helpful comment

I publish my toolchain here: https://golovin.in/x86_64-pc-linux-musl.tar.gz
Currently, only for x86_64, now trying to build 32bit x86, ARM (hard-float) and AArch64.
Supposed to be used with Alpine Linux (easy to get running with Docker or LXC) and provides clang, lld and replacements for most binutils. To build the kernel: make CC=clang LD=ld.lld HOSTCC=clang HOSTLD=ld.lld.

All 9 comments

The kernelci.org project does quite some kernel builds already, maybe we can ask them to add Clang to their build configuration: https://kernelci.org/build/

That would also allow to get those builds even boot tested...

Yep, I've been in contact with Linaro, and am in fact getting bisection email reports for an early version of a clang builder for kernelci. I've also been in contact with Intel's 0-day bot team, though that's blocked on #6. I think https://ci.linaro.org/job/tcwg-llvm-kernel-bisect-aarch64/ is the public link.

I've met with Guenter Roeck to discuss how he's automating testing kernels in qemu. I also have a note to self to spend more time with: https://www.collabora.com/news-and-blog/blog/2018/09/18/virtme-the-kernel-developers-best-friend/. Also, Greg Hackmann reports successfully booting Pixel kernels in QEMU with: https://github.com/ARM-software/arm-trusted-firmware/blob/master/docs/plat/qemu.rst

I've met the Linaro Toolchain Group last week and had some interesting chats.
The overview URL is https://ci.linaro.org/view/tcwg-llvm-kernel/

They do test also ARM32 with multi_v7_defconfig. Although it shows green, it currently broken as can be seen when looking at linux.build in this build: https://ci.linaro.org/view/tcwg-llvm-kernel/job/tcwg-llvm-kernel-build-armv8l/152/
But this is the known issue #175 which should be resolved soon.

I can boot Clang built ARM32 kernels with Qemu successfully:

qemu-system-arm -M virt -kernel arch/arm/boot/zImage -append "root=/dev/vda1" \
    -nographic -serial stdio -monitor none \
    -drive if=none,file=/path/to/archlinux.qcow2,id=rfs -device virtio-blk-device,drive=rfs

This is the main thing I'm focusing on at work, as Android recently shipped a Clang prebuilt that was DOA for kernel use.

I wrote up a little bit of info in a blog post here.

Testing actual device kernels in qemu is a little bit more complicated, but we have something working. Should be able to publish some code soon, but plan to use it internally within Android, and here, too. It's derived from the work @groeck does here.

Some information that other contributors might find helpful over time:

All of my testing functions (building and booting in QEMU): https://github.com/nathanchance/scripts/blob/master/snippets/cbl

My patch queue and hax (focused on linux-next): https://github.com/nathanchance/patches/tree/master/linux

x86 QEMU quick setup guide (if you run a server setup like I do, chroot into the image and change the root password before trying to boot it): https://www.collabora.com/news-and-blog/blog/2017/01/16/setting-up-qemu-kvm-for-kernel-development/

arm64 QEMU quick setup guide: https://www.bennee.com/~alex/blog/2014/05/09/running-linux-in-qemus-aarch64-system-emulation-mode/

My arm64 buildroot config: https://gist.github.com/nathanchance/e331a237f855cf1db632466ba6967a19

My arm buildroot config: https://gist.github.com/nathanchance/22f72f61a2ff017aa1ff7b34579f1db0

I publish my toolchain here: https://golovin.in/x86_64-pc-linux-musl.tar.gz
Currently, only for x86_64, now trying to build 32bit x86, ARM (hard-float) and AArch64.
Supposed to be used with Alpine Linux (easy to get running with Docker or LXC) and provides clang, lld and replacements for most binutils. To build the kernel: make CC=clang LD=ld.lld HOSTCC=clang HOSTLD=ld.lld.

Having some success with buildroot: https://gist.github.com/nathanchance/e331a237f855cf1db632466ba6967a19 (reposting here since github gist comments don't send emails :man_shrugging: :bomb: )

Closing this out for now, we now have CI set up on travis-ci in a separate repo: https://github.com/ClangBuiltLinux/continuous-integration

Feel free to open bugs there (or new bugs in this repo) for additional thoughts on automated testing.

I should link to Linaro's kernel-ci clang targets, and contact Intel's 0day folks again.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tpgxyz picture tpgxyz  路  4Comments

nickdesaulniers picture nickdesaulniers  路  4Comments

nathanchance picture nathanchance  路  3Comments

tpimh picture tpimh  路  4Comments

nickdesaulniers picture nickdesaulniers  路  4Comments