From patchwork Fri Jun 23 14:41:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42286 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp3666308pzb; Fri, 23 Jun 2023 07:42:09 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7mmYSMxv+fkUiSJ5FT8JsR9jbiwTRD5FUTWVBJGica2swOf07cYTOey+ix+DROa+cPrbKz X-Received: by 2002:a2e:a0d7:0:b0:2b5:91fe:916 with SMTP id f23-20020a2ea0d7000000b002b591fe0916mr3606668ljm.1.1687531329494; Fri, 23 Jun 2023 07:42:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687531329; cv=none; d=google.com; s=arc-20160816; b=nOwlABg6wlTp0pbCBxO1vTbH3fn+oLXhCH6wBTC+WfQzkn11UAY8y1l/mjlve3+Y2e ROl+lPTOILDxDaunPsiD8sCu7QlP4U0tAmyoSQVhAMsdPRQR3H3+NvorTCYAojlQd3oE pw898kuansyGd1vvjBxxPPLFQ1fzIheFvxklPDLVoPh++jEbiADZY5F2nAh2C7iv9Tit 9uzN5As6kGmRXwSQRR7uJgJ2q/Zj2/mIit3no4BVF72918bcI/T41lzOt3Q2Z9m66Vm+ s1iH7Jv3+Oxtsk0eLKhrlqz5r1p9XYCCnTSMhivcUSdQ7PZy0K1NMZ96hDxdPHynkaE2 lsUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=yI/PF/KEFdvse/e7NYrvT+Es+mB7a24SAJwPoe46lW8=; b=g4FbmNJB9lz28ZX9QCR6cqFEb0pB40T3TLUKx/5GYyfsnSI6fyVHfo5XxQqI1XkRFL e1KuUJRg+v/J3JOqzHP8Qn8Likpgu8GEw8x+6xw06lh5788daeJWCGB8ByvEUoECkKDf G7NY4aGumFB5jRYUFNvmO4emkcA9PQXd4B2H/DjaGj2GsIwReTsXq5pkazZG/zktPCdP 8h2yAvpVQaB/xdRYR7RywZ0jAsfW6dV0YW4n72VqgYnGkoROVBQMo26TyKPnB2bFiweM STA6zRkh0S33unWIoHBzRAZt1YmMHcyAgPKvFxkPb5SPCYl1EWNWZ24IlDCbb3c321i+ apBg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id q18-20020aa7d452000000b0051a5fe585dbsi3752548edr.516.2023.06.23.07.42.08; Fri, 23 Jun 2023 07:42:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D49A6687FAE; Fri, 23 Jun 2023 17:42:04 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1A28D688158 for ; Fri, 23 Jun 2023 17:41:58 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 6F0B32404EE for ; Fri, 23 Jun 2023 16:41:57 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id 6C2vlX3yH5WS for ; Fri, 23 Jun 2023 16:41:56 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id A0D0E2404EA for ; Fri, 23 Jun 2023 16:41:56 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 4A5D13A0153 for ; Fri, 23 Jun 2023 16:41:50 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Jun 2023 16:41:46 +0200 Message-Id: <20230623144147.7940-1-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] lavu/tests/cpu: stop processing the thread count X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: zFar6eLm5iYL Just print it as it is. Needed by the following commit. --- libavutil/tests/cpu.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libavutil/tests/cpu.c b/libavutil/tests/cpu.c index a52637339d..200f20388a 100644 --- a/libavutil/tests/cpu.c +++ b/libavutil/tests/cpu.c @@ -106,7 +106,7 @@ int main(int argc, char **argv) int cpu_flags_raw = av_get_cpu_flags(); int cpu_flags_eff; int cpu_count = av_cpu_count(); - char threads[5] = "auto"; + const char *threads = "auto"; int i; for(i = 0; cpu_flag_tab[i].flag; i++) { @@ -136,11 +136,7 @@ int main(int argc, char **argv) } case 't': { - int len = av_strlcpy(threads, optarg, sizeof(threads)); - if (len >= sizeof(threads)) { - fprintf(stderr, "Invalid thread count '%s'\n", optarg); - return 2; - } + threads = optarg; } } } From patchwork Fri Jun 23 14:41:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Khirnov X-Patchwork-Id: 42287 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:be15:b0:121:b37c:e101 with SMTP id ge21csp3666442pzb; Fri, 23 Jun 2023 07:42:20 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6cPD/+yJtJwuAiA7hhyNCUnwzAPpXu17r40l09LWaJF1er2MCch9wG/A2x/k4yUcM7m0WV X-Received: by 2002:a17:907:7f9e:b0:987:605c:7c6a with SMTP id qk30-20020a1709077f9e00b00987605c7c6amr21306760ejc.36.1687531340469; Fri, 23 Jun 2023 07:42:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687531340; cv=none; d=google.com; s=arc-20160816; b=y0C5L0kmUArY1cBIY/2sBIWusxDikOAMwlrIgZZQqhDonRKZDBPKUEmN6UwZtEpkeH zMDuh75zFukM/YF0a6xzbqLtPhBR/4DumKJw16+kPxKFNs7OAEUzNz0+zCnI4JsxOTpJ yvKIkrU+fOYXaqubWc53uRT66kEIsV04dZSLwDJvqIm6Vx01p+LFKubfCzu8Pilw0Ui6 lUm6nCMGc7UwnUVWWhcAITvyHfEGJLvUDQ3l1XFfh1iHi09pspo7CBnSaVP/nkhHSF9t OHCXxNJIx8l5uvn6D/qMpUYc2xLAKu68RX5GAZA4iTrNVanUPRDP289zc3CFcViDKGRh 4n1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:references:in-reply-to:message-id :date:to:from:delivered-to; bh=sE/w67EzmZ0rcrIZXG0WVaVZV515ayxEe2hnzxLEqzQ=; b=1BfIH2wopvkIjXgeCbSe6WsTHB7Lg8WNOBk/ZWHlwyqUTUZv5p6xJnFPq6IFUEbuHk kEtaqjiC5U+Wlat8Ih+ltuDAIGLcUv/Eb0c9MWEo1/SRg1vidnUvTX1cJBbM4AG1RRM/ EjOnPPe9DdCOlTl0JyDx7x9oXNAbzhvpoRyv6pkhYPzkRXF2eWz4SZIz18o/1+uxAA20 OuqEM4NnBRZTzWxIyLFPz7pxPipepICmF2p4NBGrvyNwbvJZw92B8bdenEW5ly4cc4k3 AbJPseYePK6GoIizSSm61j0tENzf6WXX9OuiCHGavTaNVYT2NbjQcU1eEL8zjK6UAfIC eSNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id u12-20020a17090617cc00b00983ca19ba51si1118469eje.849.2023.06.23.07.42.20; Fri, 23 Jun 2023 07:42:20 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E2D9668C172; Fri, 23 Jun 2023 17:42:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1CEBA68C02E for ; Fri, 23 Jun 2023 17:41:58 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id B74CB2404EA for ; Fri, 23 Jun 2023 16:41:57 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id e2XsHNxmijM5 for ; Fri, 23 Jun 2023 16:41:56 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id A3DC72404EC for ; Fri, 23 Jun 2023 16:41:56 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id 5941C3A0616 for ; Fri, 23 Jun 2023 16:41:50 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Fri, 23 Jun 2023 16:41:47 +0200 Message-Id: <20230623144147.7940-2-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230623144147.7940-1-anton@khirnov.net> References: <20230623144147.7940-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] tests/fate-run: add testing with a random number of threads X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: ufKybGNHXWEU Useful for discovering bugs that depend on a specific thread count. Uses a simple PRNG copied from random() from libavutil/eval.c Use like THREADS=randomX for a random thread count from 1 to X, with X=16 when not specified. --- doc/fate.texi | 5 +++++ tests/fate-run.sh | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/doc/fate.texi b/doc/fate.texi index 8450856015..13aea7a21f 100644 --- a/doc/fate.texi +++ b/doc/fate.texi @@ -223,6 +223,11 @@ meaning only while running the regression tests. Specify how many threads to use while running regression tests, it is quite useful to detect thread-related regressions. +This variable may be set to the string "random", optionally followed by a +number, like "random99", This will cause each test to use a random number of +threads. If a number is specified, it is used as a maximum number of threads, +otherwise 16 is the maximum. + @item THREAD_TYPE Specify which threading strategy test, either @samp{slice} or @samp{frame}, by default @samp{slice+frame} diff --git a/tests/fate-run.sh b/tests/fate-run.sh index e12279e4cf..55c579f84e 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -33,6 +33,15 @@ errfile="${outdir}/${test}.err" cmpfile="${outdir}/${test}.diff" repfile="${outdir}/${test}.rep" +case $threads in + random*) + threads_max=${threads#random} + [ -z "$threads_max" ] && threads_max=16 + threads="mod(time(0)*1664525+1013904223,$threads_max)+1" + ;; +esac + + target_path(){ test ${1} = ${1#/} && p=${target_path}/ echo ${p}${1}