Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1183233iob; Thu, 12 May 2022 13:07:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOROMNVCxS3puUQcjDZ0SC2whnGglhi9YAbnH2efQ40xB4E+cbZCJiXeL0xUiS0Yxe3rlb X-Received: by 2002:a17:90a:ba15:b0:1c6:7873:b192 with SMTP id s21-20020a17090aba1500b001c67873b192mr1220457pjr.76.1652386061589; Thu, 12 May 2022 13:07:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652386061; cv=none; d=google.com; s=arc-20160816; b=petjHxXqz5TQRaEdA6GWLjjfl2mOLGnPP7W/gtjcEWI+dxRFWbk+rUMhaRdxy6rVhU +eevJ38tYKIv2wDZoH0c2XA/wnokl/sJyxaS2+sG0B9HlpPY18+hWcPS+VKO3Pu8qVB2 NBwzEYW0ZiimkiuWXrrDZCcqnkfvEgHr3CkNSE+yNXjYHpi3h13K74QJ3OeDKdTkjI4x 9x5B3dbfSBnh51r1wwRXdx9wvmaQCFOf6C8peaKh4LqifOCAo7nIQgHPrhVyl5lwGqy7 9uNZSjp/OeWV4CyaeFxdlVJX2mEQioO/tbQfJdS2ikR+/fhULIntDR1LZzP7RWpG7+dF AbZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Vedd45PRf2+Xo8c6OsqnUkpgGBMP9HrslXfPQTpksLM=; b=Hlghi4OJOqUTvRdChUmgQTc80vjF5jBM3q6ggE2a6TDPA+Kt8OpHyAthUAbTjNCprm kY+7m+64lAPbm7lBDv3CZyD2tG8DzsMXAguuVgTYUQFKd6ZkJR/goYAva1pA8bPIEtFD W9AUrKnmgQGLsAo+7XgAdxG24rfWO0nZ8vTST9O2rgZN/jSd6zVfdDx00ecVAfnC0LqF waWiwkAX55iLr702vpAIvy8yV2k+l2flycsXQecfmKJ0Djk48bkQrT7Z3oudyM3yVpai 5jRhoTzJ6drC6bv5hSalRBOWuI6STEQPQT3dgwHh+BeRWKHXftzldsti3acI3+yiaQBS u3cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="o4XgHW/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d26-20020aa797ba000000b004fa3a8dff9csi816422pfq.83.2022.05.12.13.07.25; Thu, 12 May 2022 13:07:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b="o4XgHW/e"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346127AbiEKVMX (ORCPT + 99 others); Wed, 11 May 2022 17:12:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240438AbiEKVMV (ORCPT ); Wed, 11 May 2022 17:12:21 -0400 Received: from mail-ed1-x533.google.com (mail-ed1-x533.google.com [IPv6:2a00:1450:4864:20::533]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6FF11F35F0 for ; Wed, 11 May 2022 14:12:19 -0700 (PDT) Received: by mail-ed1-x533.google.com with SMTP id z19so3993142edx.9 for ; Wed, 11 May 2022 14:12:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Vedd45PRf2+Xo8c6OsqnUkpgGBMP9HrslXfPQTpksLM=; b=o4XgHW/eQvyLkn0OiaY0jWQYNlV20EZ7Y5sYSUf0HYKMP+a10peDXlxnY84XxGWqh8 nNMp19DLTphTgs5xWbx1Qe9EBpqQSAydw1XEyLVzAHqLsfTIBRkRPnyGmUakAJZJg3hm hBzUTuSe/s3AspjpUNo+90cycKENP0RH+UdfFSn+LVlO4gyOrI1xXgPgAX+iqPX6XEAv Nsmkis7I2LgR+aNKg1w3OHZWAFSa7vGDCMOczVi3Qe/DUvJYk4Qip4VzJsUrBjx8qrpX tcT+4lSFjznjtGmN6mZegiMTBxD9Op1aG++N58DevJiv63Vu08qS6GtP/H75IPN+kJsr L8kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Vedd45PRf2+Xo8c6OsqnUkpgGBMP9HrslXfPQTpksLM=; b=PLBRrLTT0ckZREy/C4S6xhBpDMY81rmm/5HPh8ClXbMaryk1WZiFJp/rGnyoGZroP2 wGFYzx7SEFLC+wkBoRXfYDgBHVFpFO7HiOUE1M+eziqZp4X6iLrjzVUlK+bQ9uykLjoP sv2SAuLvjy3d7bPuKSWqWrBGBeg6tifRrGLkWXrbJowg/7ZZ15mlWtl0c76meyVxcGQ5 C1v01+b+dLtRgvgMmUsoD9llj9v70kkWA8a8ZiWIUFB7TD7bXsoTYloHFXN4+5yUZDg7 bo5VAEf7j5B0lW3DK0lzofysjjWwbyIoMLCMte6B4xNSmrvtG4Enfh7dh+2Iv/eQQKRU qwxw== X-Gm-Message-State: AOAM530bNJJL/MXpA7DOJ3R5pflIdwULrgU8jwddJnwiSI8EIV6GCxbE 3dt1HFLI4Ighb/ELrEyRPHdi7JPuN2ptxhFNGODxWQ== X-Received: by 2002:aa7:c54d:0:b0:425:d8c9:efc6 with SMTP id s13-20020aa7c54d000000b00425d8c9efc6mr31293437edr.48.1652303538019; Wed, 11 May 2022 14:12:18 -0700 (PDT) MIME-Version: 1.0 References: <20220406232240.1825048-1-dlatypov@google.com> In-Reply-To: <20220406232240.1825048-1-dlatypov@google.com> From: Brendan Higgins Date: Wed, 11 May 2022 17:12:05 -0400 Message-ID: Subject: Re: [PATCH] kunit: bail out of test filtering logic quicker if OOM To: Daniel Latypov Cc: davidgow@google.com, linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org, skhan@linuxfoundation.org, Zeal Robot , Lv Ruyi Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 6, 2022 at 7:22 PM Daniel Latypov wrote: > > When filtering what tests to run (suites and/or cases) via > kunit.filter_glob (e.g. kunit.py run ), we allocate copies of > suites. > > These allocations can fail, and we largely don't handle that. > Note: realistically, this probably doesn't matter much. > We're not allocating much memory and this happens early in boot, so if > we can't do that, then there's likely far bigger problems. > > This patch makes us immediately bail out from the top-level function > (kunit_filter_suites) with -ENOMEM if any of the underlying kmalloc() > calls return NULL. > > Implementation note: we used to return NULL pointers from some functions > to indicate either that all suites/tests were filtered out or there was > an error allocating the new array. > > We'll log a short error in this case and not run any tests or print a > TAP header. From a kunit.py user's perspective, they'll get a message > about missing/invalid TAP output and have to dig into the test.log to > see it. Since hitting this error seems so unlikely, it's probably fine > to not invent a way to plumb this error message more visibly. > > See also: https://lore.kernel.org/linux-kselftest/20220329103919.2376818-1-lv.ruyi@zte.com.cn/ > > Signed-off-by: Daniel Latypov > Reported-by: Zeal Robot > Signed-off-by: Lv Ruyi Reviewed-by: Brendan Higgins