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=-3.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS 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 A9992C43603 for ; Thu, 19 Dec 2019 22:46:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7703F24676 for ; Thu, 19 Dec 2019 22:46:17 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hiahCk2x" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726818AbfLSWqR (ORCPT ); Thu, 19 Dec 2019 17:46:17 -0500 Received: from mail-qk1-f196.google.com ([209.85.222.196]:33200 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726830AbfLSWqR (ORCPT ); Thu, 19 Dec 2019 17:46:17 -0500 Received: by mail-qk1-f196.google.com with SMTP id d71so6423994qkc.0 for ; Thu, 19 Dec 2019 14:46:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9Yv9v8BsNbfZxcMg2yrGtH7diMuTPxUeHHJ7rFKsMbY=; b=hiahCk2xag95zxNnvf4edRx0Srmpm2acc7+KVdKT7WCwVC65gHHEVEo2do6lMuWxge dZvAUp3Tbra3U4Kn9FT3/zp6/f5xc1mGYboGoZUjSdlQVYgaPKmDj2wMw7/77ufMQAio +MWW1N9PxyS08QHQ4WYwwXAeHy9TSP0SShrXg0a6KaQWirLo5V2/tgnp22viiRZIx++k Ood8t22uB1PBHBb8MUaPBSvdzsPWVFSHq6aCdFj6LHC9/I2yrWeRnpmc5M4C0q3sVp9K qc83mVjHqWsbGfqC3UhRSHLajutDJG6MVgoBlYb8upAvHkxLL2k1Bj+fRKm18LaL1cx/ +ktg== 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=9Yv9v8BsNbfZxcMg2yrGtH7diMuTPxUeHHJ7rFKsMbY=; b=O4eQ5JUBrwfsT8Z/P+TzFDGCEFLipWqHqmBLU0TjLLFngov1CC8pbDxUuDmCF9onBB yrsr5EFHJdKhjRQhGjVoS1mzu2uFVRXip8SKKyeYt7oWrdIiTd0miuLHL4lKmgFLXKfm tVAXElknOZsgo861xlrexYURUd0n9ZQo4Y8M6pTw3hveJ0yxzs8E8ENC2BXgImUGxFHy h5i+JrrFFdFlHVc10pd3bssDUEA6E2z8vCoUcdCBWXnAYBSQItyvphIB1HBTd2qyJRdz l1QjsKvu6/ubfgLy0obpGRStUOYtpuQX/YRpy2/OAwhjRP0VweS5cfBgGKXNf7e8f8it eQ5w== X-Gm-Message-State: APjAAAXmSKt7xfd0GYJ1ZuwwTtitB2RfY3EYbd9pfP7/PBHEkLkXf/0R fsomp8yV1WKQPK2d8TXxDA0jz1tmbJhXhHguIcE= X-Google-Smtp-Source: APXvYqy3rlrcvryF9hC6IJS6u3N5kpCz+oc/6XpdQQbJItk1oBX4nuqOMzOsNsPYmz2Hhy1hUMARF4+secAgDAly1uU= X-Received: by 2002:a37:a685:: with SMTP id p127mr10997595qke.449.1576795576033; Thu, 19 Dec 2019 14:46:16 -0800 (PST) MIME-Version: 1.0 References: <0ff19cc64d2dc5cf404349f07131119480e10e32.1576741281.git.rdna@fb.com> In-Reply-To: <0ff19cc64d2dc5cf404349f07131119480e10e32.1576741281.git.rdna@fb.com> From: Andrii Nakryiko Date: Thu, 19 Dec 2019 14:46:04 -0800 Message-ID: Subject: Re: [PATCH v4 bpf-next 5/6] selftests/bpf: Convert test_cgroup_attach to prog_tests To: Andrey Ignatov Cc: bpf , Alexei Starovoitov , Daniel Borkmann , Martin Lau , Andrii Nakryiko , Kernel Team Content-Type: text/plain; charset="UTF-8" Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Wed, Dec 18, 2019 at 11:45 PM Andrey Ignatov wrote: > > Convert test_cgroup_attach to prog_tests. > > This change does a lot of things but in many cases it's pretty expensive > to separate them, so they go in one commit. Nevertheless the logic is > ketp as is and changes made are just moving things around, simplifying > them (w/o changing the meaning of the tests) and making prog_tests > compatible: > > * split the 3 tests in the file into 3 separate files in prog_tests/; > > * rename the test functions to test_; > > * remove unused includes, constants, variables and functions from every > test; > > * replace `if`-s with or `if (CHECK())` where additional context should > be logged and with `if (CHECK_FAIL())` where line number is enough; > > * switch from `log_err()` to logging via `CHECK()`; > > * replace `assert`-s with `CHECK_FAIL()` to avoid crashing the whole > test_progs if one assertion fails; > > * replace cgroup_helpers with test__join_cgroup() in > cgroup_attach_override only, other tests need more fine-grained > control for cgroup creation/deletion so cgroup_helpers are still used > there; > > * simplify cgroup_attach_autodetach by switching to easiest possible > program since this test doesn't really need such a complicated program > as cgroup_attach_multi does; > > * remove test_cgroup_attach.c itself. > > Signed-off-by: Andrey Ignatov > --- Acked-by: Andrii Nakryiko > tools/testing/selftests/bpf/.gitignore | 1 - > tools/testing/selftests/bpf/Makefile | 3 +- > .../bpf/prog_tests/cgroup_attach_autodetach.c | 111 ++++ > .../bpf/prog_tests/cgroup_attach_multi.c | 238 ++++++++ > .../bpf/prog_tests/cgroup_attach_override.c | 148 +++++ > .../selftests/bpf/test_cgroup_attach.c | 571 ------------------ > 6 files changed, 498 insertions(+), 574 deletions(-) > create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_attach_autodetach.c > create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c > create mode 100644 tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c > delete mode 100644 tools/testing/selftests/bpf/test_cgroup_attach.c > [...]