From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 22CBBA0032;
	Sat,  2 Oct 2021 18:25:02 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 147B9411F9;
	Sat,  2 Oct 2021 18:25:02 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.129.124])
 by mails.dpdk.org (Postfix) with ESMTP id AEBE1411F0
 for <dev@dpdk.org>; Sat,  2 Oct 2021 18:25:00 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1633191900;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=N93q44dDRnENYlp8e+XcI0WH5QfYtx/JQCMtlbTNuZ4=;
 b=bIuh0dGzHy8h7b0SLoku4nG3Lr1Nn/+KKkTlTSrovwCQaep5I9r08FTDooUsi1Q6og3+tw
 1tYp6junGCzaJBp6E0q0wTlm16NCLc0lhDSQ0ILn7T1SgGOdScbGs8j2MSo/coPQdtLnu3
 lELcwoFSS3HiWdgMfsIFGK34cfm7TMI=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-51-gLqaZHNtMlai-WPofP6PSw-1; Sat, 02 Oct 2021 12:24:57 -0400
X-MC-Unique: gLqaZHNtMlai-WPofP6PSw-1
Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com
 [10.5.11.16])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 4858D8145FB;
 Sat,  2 Oct 2021 16:24:56 +0000 (UTC)
Received: from dmarchan.remote.csb (unknown [10.40.194.246])
 by smtp.corp.redhat.com (Postfix) with ESMTP id 39C9F5C3DF;
 Sat,  2 Oct 2021 16:24:53 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: aconole@redhat.com, zhihongx.peng@intel.com,
 Michael Santana <maicolgabriel@hotmail.com>
Date: Sat,  2 Oct 2021 18:24:32 +0200
Message-Id: <20211002162432.4348-4-david.marchand@redhat.com>
In-Reply-To: <20211002162432.4348-1-david.marchand@redhat.com>
References: <20210917082313.21934-1-david.marchand@redhat.com>
 <20211002162432.4348-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"
Subject: [dpdk-dev] [PATCH v2 3/3] ci: run unit tests with ASAN
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Enable ASAN for clang jobs.
This can greatly help identify leaks and buffer overflows.
This patch is more a fyi, as some unit tests stil have issues.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 .ci/linux-build.sh | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/.ci/linux-build.sh b/.ci/linux-build.sh
index 91e43a975b..a961d9b92d 100755
--- a/.ci/linux-build.sh
+++ b/.ci/linux-build.sh
@@ -79,7 +79,14 @@ fi
 
 OPTS="$OPTS -Dmachine=default"
 OPTS="$OPTS --default-library=$DEF_LIB"
-OPTS="$OPTS --buildtype=debugoptimized"
+
+if [ "$CC" != "${CC%%clang}" ] && [ "$RUN_TESTS" = 'true' ]; then
+    # Let's run tests with ASAN
+    OPTS="$OPTS -Db_sanitize=address -Db_lundef=false --buildtype=debug"
+else
+    OPTS="$OPTS --buildtype=debugoptimized"
+fi
+
 OPTS="$OPTS -Dcheck_includes=true"
 meson build --werror $OPTS
 ninja -C build
-- 
2.23.0