oe-linux-nfc.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
To: linux-nfc@lists.01.org
Subject: [neard][PATCH v2 08/11] ci: add build with sanitizers (asan, lsan and ubsan)
Date: Wed, 04 Aug 2021 10:42:15 +0200	[thread overview]
Message-ID: <20210804084218.14677-9-krzysztof.kozlowski@canonical.com> (raw)
In-Reply-To: <20210804084218.14677-1-krzysztof.kozlowski@canonical.com>

[-- Attachment #1: Type: text/plain, Size: 4199 bytes --]

Check the results if sanitizers were correctly linked.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
---
 .github/workflows/ci.yml | 44 ++++++++++++++++++++++++++++++++++++++--
 ci/debian.sanitizers.sh  | 18 ++++++++++++++++
 ci/ubuntu.sanitizers.sh  |  1 +
 3 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100755 ci/debian.sanitizers.sh
 create mode 120000 ci/ubuntu.sanitizers.sh

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e8f507a128e0..b6f29cf9ddfb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -70,6 +70,13 @@ jobs:
               CC: gcc
               MODE: maintainer
 
+          - container: "debian:stable"
+            env:
+              ARCH: x86-64
+              CC: gcc
+              VARIANT: sanitizers
+              MODE: maintainer
+
           - container: "debian:stable"
             env:
               ARCH: x86-64
@@ -82,6 +89,13 @@ jobs:
               CC: gcc
               MODE: maintainer
 
+          - container: "debian:testing"
+            env:
+              ARCH: x86-64
+              CC: gcc
+              VARIANT: sanitizers
+              MODE: maintainer
+
           - container: "debian:testing"
             env:
               ARCH: x86-64
@@ -157,6 +171,13 @@ jobs:
               CC: gcc
               MODE: maintainer
 
+          - container: "ubuntu:hirsute"
+            env:
+              ARCH: x86-64
+              CC: gcc
+              VARIANT: sanitizers
+              MODE: maintainer
+
           - container: "ubuntu:hirsute"
             env:
               ARCH: x86-64
@@ -169,6 +190,13 @@ jobs:
               CC: gcc
               MODE: maintainer
 
+          - container: "ubuntu:focal"
+            env:
+              ARCH: x86-64
+              CC: gcc
+              VARIANT: sanitizers
+              MODE: maintainer
+
           - container: "ubuntu:focal"
             env:
               ARCH: x86-64
@@ -239,9 +267,14 @@ jobs:
     - name: Configure
       run: |
         echo "Bootstraping in mode: $MODE"
+        CONFIGURE_ARGS=""
+        if [ "$VARIANT" = "sanitizers" ]; then
+          CONFIGURE_ARGS="--enable-asan --enable-lsan --enable-ubsan --enable-pie"
+        fi
         if [ "$MODE" = "maintainer" ]; then
           ./bootstrap-configure \
-            --disable-silent-rules
+            --disable-silent-rules \
+            $CONFIGURE_ARGS
         else
           ./bootstrap && \
             ./configure \
@@ -250,7 +283,8 @@ jobs:
             --prefix=/usr \
             --enable-ese \
             --sysconfdir=/etc \
-            --enable-tools
+            --enable-tools \
+            $CONFIGURE_ARGS
         fi
 
     - name: Compile
@@ -281,6 +315,12 @@ jobs:
         esac
         echo "Checking for built matching architecture: $ARCH_CHECK"
         file src/neard | grep "$ARCH_CHECK"
+        if [ "$VARIANT" = "sanitizers" ]; then
+          echo "Checking for linking against sanitizer libraries"
+          ldd src/neard | grep libasan.so
+          # liblsan won't appear if asan is used
+          ldd src/neard | grep libubsan.so
+        fi
 
     - name: Install
       run: make install
diff --git a/ci/debian.sanitizers.sh b/ci/debian.sanitizers.sh
new file mode 100755
index 000000000000..40dc1f44b55a
--- /dev/null
+++ b/ci/debian.sanitizers.sh
@@ -0,0 +1,18 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (c) 2021 Canonical Ltd.
+# Author: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
+#                             <krzk@kernel.org>
+#
+
+set -ex
+
+apt install -y --no-install-recommends \
+	liblsan0 \
+	libubsan1
+
+apt install -y --no-install-recommends libasan6 || \
+	apt install -y --no-install-recommends libasan5
+
+echo "Install finished: $0"
diff --git a/ci/ubuntu.sanitizers.sh b/ci/ubuntu.sanitizers.sh
new file mode 120000
index 000000000000..53cd9418ed35
--- /dev/null
+++ b/ci/ubuntu.sanitizers.sh
@@ -0,0 +1 @@
+debian.sanitizers.sh
\ No newline at end of file
-- 
2.30.2

  parent reply	other threads:[~2021-08-04  8:42 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  8:42 [neard][PATCH v2 00/11] CI under Github Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 01/11] ci: add GitHub actions for building Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 02/11] bootstrap: parse CROSS_COMPILE and set proper configure option Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 03/11] ci: add clang builds Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 04/11] ci: add building without maintainer options Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 05/11] ci: be verbose when building Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 06/11] ci: add more build configurations (Fedora, Alpine, Debian, cross-compile, i386) Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 07/11] ci: run unit tests Krzysztof Kozlowski
2021-08-04  8:42 ` Krzysztof Kozlowski [this message]
2021-08-04  8:42 ` [neard][PATCH v2 09/11] ci: add CodeQL static analysis Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 10/11] ci: print configure logs on failures Krzysztof Kozlowski
2021-08-04  8:42 ` [neard][PATCH v2 11/11] ci: use matrix instead of duplicating each build configuration Krzysztof Kozlowski
2021-08-07 20:08 ` [neard][PATCH v2 00/11] CI under Github Mark Greer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210804084218.14677-9-krzysztof.kozlowski@canonical.com \
    --to=krzysztof.kozlowski@canonical.com \
    --cc=linux-nfc@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).