[OpenWrt-Devel] OpenWrt GitLab CI details [Was: Re: [PATCH] use strncpy instead of strcpy]

Petr Štetiar ynezz at true.cz
Thu Dec 26 08:59:46 EST 2019

Hauke Mehrtens <hauke at hauke-m.de> [2019-12-26 13:49:46]:


I really needed to use latest GCC 10 in order to see that warning/error, I was
unable to get those warnings locally with glibc and clang-9/clang-10 and

> Please also use a toolchian with glibc when compiling in CI.

I'm not sure if I understand this properly, but I'll try to shed some light
into the CI stuff.

Default CI pipeline[1] has currently following 5 jobs:

 1. build with Atheros ATH79 SDK (out of tree)
 2. build with Freescale i.MX 6 SDK (out of tree)
 3. build with MIPS Malta CoreLV BE SDK (out of tree)
 4. build with Marvell Armada Cortex A-53 SDK (out of tree)
 5. various native checks

where the first 4 jobs are using target SDK, so musl libc.

The 5th job is "various native checks" which is using Docker image[2] based on
Debian testing which comes with gcc-9 by default, then adds gcc-7 and gcc-8
and clang-9 from apt.llvm.org (clang-10 is currently unusable as it's still
missing libFuzzer dependencies[3]) to the compiler mix.

So the CI in this native checks[4] job runs `make ci-native-checks` which
translates into following[5]:

 * make ci-native-scan-build   (build with clang's static analyzer)
 * make ci-native-cppcheck     (build with cppcheck static analyzer)
 * make ci-native-build        (build with gcc 7 8 9 and clang 9)

So this should be using the standard and possibly some decent glibc. The last
`ci-native-build` make target also runs unit tests (under Valgrind and various
sanitizers) and libFuzzer based fuzzing where available (under Clang only).

I know, that it makes no sense to have CI if it's not available directly on
the developer's machine as well, so I've tried hard to make it as easy as
possible[6], so for example following steps allows running of the above
mentioned "native" CI checks in libubox locally inside Docker container:

 git clone git://git.openwrt.org/project/libubox.git && cd libubox
 wget -q https://gitlab.com/ynezz/openwrt-ci/raw/master/Makefile -O Makefile.ci
 make ci-prepare -f Makefile.ci
 docker run --rm --tty --interactive --volume $(pwd):/home/build/openwrt \
 	registry.gitlab.com/ynezz/openwrt-ci/native-testing:latest \
 	make ci-native-checks -f Makefile.ci

 (BTW this Docker container is not necessary, just convenient, otherwise one
  would need to provide all the build and compiler dependencies manually)

FYI I've also added short how-to "Example of adding CI support to fstools
project"[7] which should help anyone interested in adding CI support to the
remaining OpenWrt C projects.

As always, any questions/suggestions more then welcome.

1. https://gitlab.com/ynezz/openwrt-ci/blob/master/openwrt-ci/gitlab/pipeline.yml
2. https://gitlab.com/ynezz/openwrt-ci/blob/master/docker/Dockerfile
3. https://bugs.llvm.org/show_bug.cgi?id=44196
4. https://gitlab.com/ynezz/openwrt-ci/blob/master/openwrt-ci/gitlab/main.yml#L35
5. https://gitlab.com/ynezz/openwrt-ci/blob/master/openwrt-ci/native-build.mk#L26
6. https://gitlab.com/ynezz/openwrt-ci#usage-example
7. https://gitlab.com/ynezz/openwrt-ci/-/wikis/Example-of-adding-CI-support-to-fstools-project

-- ynezz

openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list