From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.4 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C5AFC47E49 for ; Wed, 30 Oct 2019 20:12:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5276F2083E for ; Wed, 30 Oct 2019 20:12:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="hs4u13vD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726677AbfJ3UMW (ORCPT ); Wed, 30 Oct 2019 16:12:22 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:42115 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726747AbfJ3UMV (ORCPT ); Wed, 30 Oct 2019 16:12:21 -0400 Received: by mail-qk1-f195.google.com with SMTP id m4so4176123qke.9 for ; Wed, 30 Oct 2019 13:12:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/GCjoby9r+s+PmV1FeOt/O5VIxJ79kYZdBdHtT5yosc=; b=hs4u13vDJKlNQDZKcbNVyPbIOUO4++rTthQnsQzTyBa9XWD0PqFcDlID67q4NaHOBr IHr6T6nX966JNzI2EeAQe8lLYg4I7H/NQsjt21lvxwCAt877j6p8citQow+UzZ2zrgyq oAyDlNvuSdlMkxFLCJTc07wUsNKAFK1j52tckNVnHzCvkhlpasTLzWVn++Srb25T1rcv w862U9tnBYoWP+h71e1Pj7OqujSeAW4Viig8S+wYMQUlS6wkq8M+fN9V4LmNvUXdq54P o+arqYUKSHdF3PCMnfWptbn2gLDX1+yJ/5QCCvsNT520P7REY8HVYZ8Wn6QqMtsqQtWH Ap2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/GCjoby9r+s+PmV1FeOt/O5VIxJ79kYZdBdHtT5yosc=; b=hUKjJRTk0bTfgiR5paOu8AJoZcnEdwFeKgmOQSvKNbIymi6g5T85/+7Vko6exoUkJh kNx4rOgTuWRWs8+kON0Whm1BRvcOjw3QQgOd96KuGPTN1TSbOQLlqJnCcVQYL7zRUWwx sRrbYVA4gscj6UxCKbtYft/cVKkn8NBzkhAC6kG8U1TjhCCFHNi1mFwwr7e5t4mW2dQp ZhDxV27lzxD8yC0d7oxKFhab2myFzCqr69XzehQQilzkjrK+/abFK9aGjWrhrNyLNZfN y6T7RZq64xcmD0izXPAMVNDwJzF+xDgBTQKar6sQ512sKsrN4Lq7/vEHbdQNPGXCV0n+ cMHw== X-Gm-Message-State: APjAAAX5mo4CPHVappOLPAS7BQbW98DByYfpAXfRrw5ovAokjkyfM8Dw RwP288Vv4A8TfOa5I2L332gEdTfCqNHHljLcNQZ7 X-Google-Smtp-Source: APXvYqx7bti37f9+2uWLgnwmX5xe5F/Bf0v/KqsYC9Kv/tvuxGMoYEb+NTCbuNpu7R2tix93zwP51PF2WTt7jtDuQnY= X-Received: by 2002:a37:bb06:: with SMTP id l6mr1807038qkf.289.1572466340480; Wed, 30 Oct 2019 13:12:20 -0700 (PDT) MIME-Version: 1.0 References: <20191018001816.94460-1-brendanhiggins@google.com> <20191018122949.GD11244@42.do-not-panic.com> <20191024101529.GK11244@42.do-not-panic.com> <201910301205.74EC2A226D@keescook> In-Reply-To: <201910301205.74EC2A226D@keescook> From: Iurii Zaikin Date: Wed, 30 Oct 2019 13:11:44 -0700 Message-ID: Subject: Re: [PATCH linux-kselftest/test v1] apparmor: add AppArmor KUnit tests for policy unpack To: Kees Cook Cc: Luis Chamberlain , Brendan Higgins , Alan Maguire , Matthias Maennich , shuah , John Johansen , jmorris@namei.org, serge@hallyn.com, David Gow , "Theodore Ts'o" , Linux Kernel Mailing List , linux-security-module@vger.kernel.org, KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Mike Salvatore Content-Type: text/plain; charset="UTF-8" Sender: linux-kselftest-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org > Why can't unit tests live with the code they're testing? They're already > logically tied together; what's the harm there? This needn't be the case > for ALL tests, etc. The test driver could still live externally. The > test in the other .c would just have exported functions... ? > Curiously enough, this approach has been adopted by D 2.0 where unittests are members of the class under test: https://digitalmars.com/d/2.0/unittest.html but such approach is not mainstream. I personally like the idea of testing the lowest level bits in isolation even if they are not a part of any interface. I think that specifying the interface using unit tests and ensuring implementation correctness are complementary but I haven't had much luck arguing this with our esteemed colleagues.