Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp121862ybx; Wed, 30 Oct 2019 12:17:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4qGqNMJN5pFfYYz4k2qxqpFOSUBsRoQtPMZK2zXNEeq1Jqf+zPh4JkMvPTdwLi37BkabJ X-Received: by 2002:a17:906:4d16:: with SMTP id r22mr1256288eju.244.1572463064028; Wed, 30 Oct 2019 12:17:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1572463064; cv=none; d=google.com; s=arc-20160816; b=Rbykrfvb+kx+EJ2Q4FjQWtm4NFqwszT12U3Zbdue24E1S7O6i1EsjfG6itVGbScBoY srVz0fd0oNkpjHoYzhKQ36sec2XwOHFarywUdRKmw+yZiwgMI3jPVr/qnk5LsHUnwr4P 5fgjA8grky3W9IWFv6LdMrfPq4RGF5R56Eh5Saqjeqsjf3Vs2NRYrc8Hzw6qMMc41neU jlugmL7Mj+c5h+XxZPohq3DyfSFfdrZ6Gg+Fwmj3VtXuRneLBNlHAgtQCcrnu4LUkKuf Co4Ph2rrCT1n2cjRK1hi2sj9/0gM3c0AYw2TwYmf9q8aOrq/2xcfFQtgjC2MFYtOq6+I S09w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=SkNeb7N/RtOHBRU9IGeZjCb9lUHhzMvIRm1lPkdmY94=; b=A30MYL/SEmazjoXBWXOdH3t86Ceh0JKcau7SNW9di4C7bLHeJ8qUsr+dxkCzih9D5N Rk9hZoWf7+sFOBgaDH5TKsSNO9F28wq4PIU6RuFPcLsXZ/ngVjeoilwBXAGimOvRNnsv ndOjRMs+XIHbz+A0SM/eQZrbyGjZK8KVi3LDud4mUrPDy5WLbMMHxzzVudkgLOHPeRA6 +Ql7Fodc+1P1Q+LyJ9oYE+Omg1gopO1BhT7kX2iNKi5EJv6uq8WKjOE797j9B7oOOPbd V7IHPJvuTJYbwLMKT4W0WbhcEBctaHPLinYQWE0qmfqG6+Dx/TQl8yo3yIB4QG9G86hb 14GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Wmz4BN9I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f19si2080473eda.435.2019.10.30.12.17.20; Wed, 30 Oct 2019 12:17:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=Wmz4BN9I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726664AbfJ3TQn (ORCPT + 99 others); Wed, 30 Oct 2019 15:16:43 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:45803 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726259AbfJ3TQm (ORCPT ); Wed, 30 Oct 2019 15:16:42 -0400 Received: by mail-pf1-f194.google.com with SMTP id c7so2237574pfo.12 for ; Wed, 30 Oct 2019 12:16:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=SkNeb7N/RtOHBRU9IGeZjCb9lUHhzMvIRm1lPkdmY94=; b=Wmz4BN9I7WolTdUk59TZOxzjMRRja95bL9zO5kOJ57UJdIVxIrDaZMbHW4erd4Fros 2hPOZirzIw1BFU5a69eAT/lwCab1RZEA7hAgyA5U3O0Nm8S/HI/c6oEUtgJbTHYu6Fbg su7wV2pd4MglPXtDzkpNzhd21Spi3W0VbfdXI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=SkNeb7N/RtOHBRU9IGeZjCb9lUHhzMvIRm1lPkdmY94=; b=JkCWwWsiLs0kcRBASeYvn2jcGSbUbW2ooTs+xlaSGaZ6+eXW+7Gp/In6YnkWJWCKIs 7a4RnVqYEGBi3ATYAR78Q3RlGMqNmsaY1xy5Uf8WYviwAXDnfPU4pjsUYMIZWDkO9q9B EDEUDzRdunoceJbi00l2jhloGaOHPdEbTtq7TL7C/az6LIkjaUJhNCBDrZ5Htz3LsyVN MVf8FNqIlEkgVoR9jwOIxycYJdhoz4Uoq3ZVZQq/Duyus4KFB9zkHtynDF+s5fmjLR70 0pjlgICjqA2fwMynKRA7ZSOPZZyoNxW2vkTqN57f42sxFjBjrV0To/vLIS8Nwi36349W 8Mug== X-Gm-Message-State: APjAAAWytHAwP/XeDyvgRRzOb9QPA1WXH086wzCQOsAxOOAxR5hn0ZzE cicyBznP+QC4iwCl4NzmcuXrXw== X-Received: by 2002:aa7:9157:: with SMTP id 23mr982679pfi.73.1572463001813; Wed, 30 Oct 2019 12:16:41 -0700 (PDT) Received: from www.outflux.net (smtp.outflux.net. [198.145.64.163]) by smtp.gmail.com with ESMTPSA id e17sm719419pfh.121.2019.10.30.12.16.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2019 12:16:41 -0700 (PDT) Date: Wed, 30 Oct 2019 12:16:39 -0700 From: Kees Cook To: Naresh Kamboju Cc: "Tobin C. Harding" , Shuah Khan , Jann Horn , Andy Shevchenko , Randy Dunlap , Rasmus Villemoes , Stephen Rothwell , Andy Lutomirski , Daniel Micay , Arnd Bergmann , Miguel Ojeda , "Gustavo A. R. Silva" , Greg Kroah-Hartman , Alexander Shishkin , kernel-hardening@lists.openwall.com, "open list:KERNEL SELFTEST FRAMEWORK" , open list Subject: Re: [PATCH v4 2/6] kselftest: Add test runner creation script Message-ID: <201910301216.5C3F9BA010@keescook> References: <20190405015859.32755-1-tobin@kernel.org> <20190405015859.32755-3-tobin@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 30, 2019 at 06:15:22PM +0530, Naresh Kamboju wrote: > Hi Tobin, > > On Fri, 5 Apr 2019 at 07:30, Tobin C. Harding wrote: > > > > Currently if we wish to use kselftest to run tests within a kernel > > module we write a small script to load/unload and do error reporting. > > There are a bunch of these under tools/testing/selftests/lib/ that are > > all identical except for the test name. We can reduce code duplication > > and improve maintainability if we have one version of this. However > > kselftest requires an executable for each test. We can move all the > > script logic to a central script then have each individual test script > > call the main script. > > > > Oneliner to call kselftest_module.sh courtesy of Kees, thanks! > > > > Add test runner creation script. Convert > > tools/testing/selftests/lib/*.sh to use new test creation script. > > > > Testing > > ------- > > > > Configure kselftests for lib/ then build and boot kernel. Then run > > kselftests as follows: > > > > $ cd /path/to/kernel/tree > > $ sudo make O=$output_path -C tools/testing/selftests TARGETS="lib" run_tests > > We are missing "kselftest_module.sh" file when we do "make install" > and followed by generating a tar file "gen_kselftest_tar.sh" and > copying that on to target device and running tests by using > "run_kselftest.sh" script file on the target. Yikes -- there's a problem with gen_kselftest_tar.sh using the wrong directory. I'll send a patch... -Kees > > Could you install the supporting script file "kselftest_module.sh" ? > > Error log, > ------------- > # selftests lib printf.sh > lib: printf.sh_ # > # ./printf.sh line 4 ./../kselftest_module.sh No such file or directory > line: 4_./../kselftest_module.sh # > [FAIL] 1 selftests lib printf.sh # exit=127 > selftests: lib_printf.sh [FAIL] > # selftests lib bitmap.sh > lib: bitmap.sh_ # > # ./bitmap.sh line 3 ./../kselftest_module.sh No such file or directory > line: 3_./../kselftest_module.sh # > [FAIL] 2 selftests lib bitmap.sh # exit=127 > selftests: lib_bitmap.sh [FAIL] > # selftests lib prime_numbers.sh > lib: prime_numbers.sh_ # > # ./prime_numbers.sh line 4 ./../kselftest_module.sh No such file or directory > line: 4_./../kselftest_module.sh # > [FAIL] 3 selftests lib prime_numbers.sh # exit=127 > selftests: lib_prime_numbers.sh [FAIL] > # selftests lib strscpy.sh > lib: strscpy.sh_ # > # ./strscpy.sh line 3 ./../kselftest_module.sh No such file or directory > line: 3_./../kselftest_module.sh # > [FAIL] 4 selftests lib strscpy.sh # exit=127 > selftests: lib_strscpy.sh [FAIL] > > - Naresh -- Kees Cook