From patchwork Fri Apr 21 00:49:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Matlack X-Patchwork-Id: 9691523 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3364E6038D for ; Fri, 21 Apr 2017 00:50:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25D2F2847B for ; Fri, 21 Apr 2017 00:50:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1A9B128480; Fri, 21 Apr 2017 00:50:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D4A6A2847B for ; Fri, 21 Apr 2017 00:50:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1034161AbdDUAug (ORCPT ); Thu, 20 Apr 2017 20:50:36 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:35012 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1033953AbdDUAu2 (ORCPT ); Thu, 20 Apr 2017 20:50:28 -0400 Received: by mail-oi0-f53.google.com with SMTP id j201so73636910oih.2 for ; Thu, 20 Apr 2017 17:50:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=0gVGrAnYlGjiQpdfsXAFzNI7hxV4YL/fn2ADwVdIHJc=; b=OtIhZ1IoLWpHW3qM3Ges1TZW3uL51vIQcHtf82b4M1aPHyFS1y1mCnF1P8F4RFT10A dWCE/Tt+7k+duWfcYE/GzgwZ1WdfI7tMVaseWWVHULEvnqMunwcdgensZ4kmKepPuK1m yr9EDo29YJSgB1DiRqxHUFyTqcCEMwe0J+22LHY4+rB7a/PGJTuuuY7T8Cp4J6fx90rR 5D6MHd20Z071tmWNouquPczAY7YS0oAQhUnuhOsJJyadd6JVkb1VdAIepXqhbztOrJq6 pQh3VUMjZcBec+IT+jtlolxVaB8rn0XOz29+acmw7YbUlUxa+KXt/kZm27HLe9MVOMx1 rwBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=0gVGrAnYlGjiQpdfsXAFzNI7hxV4YL/fn2ADwVdIHJc=; b=dO2XPLTFOGRBQHmU8tReWXbFG+bDkfW9S80Mry3Eo1es9MMvlvaEUpzi9qMIpT4h+5 pgzfPAGDjMp8fapTaGxNtrAm8/X0suyejJ/U8GAvVAOt1xygu16gqbzAakHF7onCGyX9 W2nFkCek7YVo3ngRUhIPAguKOw2BTR6b76Lvu9RuoUdFBdFuZ+14yu978j5ck3XX8+4s /FajP0d+Mdn0zcilUnPlJCdScPLqT/BDQlzNF5LemHKerGPOF+kqtZ6Jqmhs/+gFHf73 n4eVF0pe1NQL/FI3Tesawhsn+KBnaRolf3HecKefeS6vZYSNktqO/CfJere/jId6P0WX jZWg== X-Gm-Message-State: AN3rC/5mCat7k9fWNc3v4fur0+vd2dvg+GJ4Nf5U9abz1jcRaWnmPmiu 0YKgh26/W7YQITCz X-Received: by 10.84.209.167 with SMTP id y36mr12878150plh.78.1492735826448; Thu, 20 Apr 2017 17:50:26 -0700 (PDT) Received: from dmatlack.sea.corp.google.com ([100.100.206.82]) by smtp.gmail.com with ESMTPSA id e13sm12466486pfb.30.2017.04.20.17.50.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 20 Apr 2017 17:50:25 -0700 (PDT) From: David Matlack To: kvm@vger.kernel.org Cc: Peter Feiner , David Matlack Subject: [kvm-unit-tests PATCH 19/32] lib: added assert_msg macro Date: Thu, 20 Apr 2017 17:49:51 -0700 Message-Id: <20170421005004.137260-20-dmatlack@google.com> X-Mailer: git-send-email 2.12.2.816.g2cccc81164-goog In-Reply-To: <20170421005004.137260-1-dmatlack@google.com> References: <20170421005004.137260-1-dmatlack@google.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Peter Feiner Signed-off-by: Peter Feiner Signed-off-by: David Matlack Reviewed-by: Andrew Jones --- lib/libcflat.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/libcflat.h b/lib/libcflat.h index 1d2eba980e1a..5d356df75f1f 100644 --- a/lib/libcflat.h +++ b/lib/libcflat.h @@ -126,6 +126,16 @@ do { \ } \ } while (0) +#define assert_msg(cond, fmt, args...) \ +do { \ + if (!(cond)) { \ + printf("%s:%d: assert failed: %s: " fmt, \ + __FILE__, __LINE__, #cond, ## args); \ + dump_stack(); \ + abort(); \ + } \ +} while (0) + static inline bool is_power_of_2(unsigned long n) { return n && !(n & (n - 1));