Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751742AbdFTNJS (ORCPT ); Tue, 20 Jun 2017 09:09:18 -0400 Received: from mail-wm0-f45.google.com ([74.125.82.45]:35353 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751056AbdFTNJQ (ORCPT ); Tue, 20 Jun 2017 09:09:16 -0400 MIME-Version: 1.0 In-Reply-To: <149795925290.25956.17215228674567137983@mail.alporthouse.com> References: <1497879872-11137-1-git-send-email-sumit.semwal@linaro.org> <149788031144.14237.2576196706318669393@mail.alporthouse.com> <149788426772.14237.4686476703933342760@mail.alporthouse.com> <149795925290.25956.17215228674567137983@mail.alporthouse.com> From: Sumit Semwal Date: Tue, 20 Jun 2017 18:38:54 +0530 Message-ID: Subject: Re: [PATCH 2/2] selftests: lib: prime_numbers: update presence check To: Chris Wilson Cc: Shuah Khan , linux-kselftest@vger.kernel.org, lukas@wunner.de, LKML , Daniel Vetter , Joonas Lahtinen Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2806 Lines: 63 Hi Chris, On 20 June 2017 at 17:17, Chris Wilson wrote: > Quoting Sumit Semwal (2017-06-19 16:11:33) >> On 19 June 2017 at 20:27, Chris Wilson wrote: >> > Quoting Sumit Semwal (2017-06-19 15:46:20) >> >> Hi Chris, >> >> >> >> On 19 June 2017 at 19:21, Chris Wilson wrote: >> >> > Quoting Sumit Semwal (2017-06-19 14:44:32) >> >> >> The test for prime numbers doesn't differentiate between missing >> >> >> prime_numbers.ko and failure in prime_numbers.ko. >> >> >> >> >> >> Update it to check for presence of the file itself to skip, therefore >> >> >> correctly exercising the test failure case. >> >> > >> >> > modprobe -r shouldn't be executing the module? But you still need to >> >> > unload the module before you can load it with the selftest module >> >> > parameters. If you can't unload the module due to an earlier failure, >> >> > you cannot discern whether or not the module itself is at fault, so >> >> > still want to SKIP. >> >> >> >> My bad here: I missed the '-r' in the first modprobe. >> >> >> >> I am wondering if 'modprobe -q -n' won't suffice, as it is a dry-run >> >> only, but will still search for the module? Unless of course, there's >> >> something specific about '-q -r' that seems better still? >> > >> > I think there are two things to be tested here, both causing a SKIP. >> > >> > - If the module doesn't exist at all; modprobe -q -n seems sensible for >> > querying its existence. >> > >> > - If the module cannot be [un]loaded; for which I was using the >> > modprobe -q -r. If we can't unload the module, then we can't test :) >> >> :) Right; then the question is, for prime_numbers.ko, do we need to >> differentiate between these 2 SKIPs? > > I don't see a downside to being verbose here. It both helps explain the > test and alert the user about the remedy if desired. > >> The unloading of the prime_numbers module before running the test is >> required since it isn't a standalone test module - unlike the >> test_bitmap and test_printf ones. >> >> So then, for prime_numbers: if distinguishing between the two cases >> you mentioned above isn't important, we can just keep your original >> code. If it is important to distinguish, I can add the -q -n test to >> query existence separately. >> >> For test_bitmap and test_printf tests, I think I will just go ahead >> with -q -n itself, since we can assume that the test modules will only >> be loaded/unloaded via these tests I guess? > > Yes. For that style of standalone test module, if the test module is still > around it is probably for a reason :) :) These test cases seem to try to load the module (and hence run the tests), and then try to unload the module right after, so I think we should be ok there. > -Chris