Received: by 10.192.165.148 with SMTP id m20csp4924946imm; Tue, 24 Apr 2018 10:37:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqGiUW2a/axkaM2Uv2UIdhH4r0WMV0p1qCWLrWuubNKgEvJmR/fuHSc1AM29pmGafxLx2EU X-Received: by 10.98.227.15 with SMTP id g15mr1329673pfh.68.1524591426362; Tue, 24 Apr 2018 10:37:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524591426; cv=none; d=google.com; s=arc-20160816; b=ZYjs683Xy62XdbRT15z00BZ0iKnuSjrd0ZCd/OPZud/fnKEZlZM2IgwpVlmeyL9Y3G GLgQV35VqnDBLojCmN0iUxd/QzYmgOtQk8bjKK4d7hSaEVoQ9jBOpjRLTY+/bHZSLO4z OfxnWi8PAEd0QTbTmDUtDv+K5C/6WwQrckOaGqArAV3kGvimgGzwmCKR+bF2OQDSg4qk e5vJ6DARL6eAFNj0VwFOLN/TPIaWoAHmchxbGdcAk0Iz0ZsTMd7sy0uZfH1mXKuliMXF qNkiE2FLqoEpkq4kLT77C6HN2KkqvCcLUfjyVbCtLkTRvCJqW9nNReAqSB5HdSjkEOw1 x5eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=yqkbI0KYXmUkFZkzDfCcFN7qjimaC2kgEOC3xvjuJNM=; b=JY6ZTndh2eCRcJ4YxBzWOGilhP/4BwdRaTJeZPnwkDd6hTboAltkO28ajf0eWca9SQ B5aOqZVCr+Nzj36DLwHrixv/fXVSAnvHiUXZWhed4UFN1BwAQZ0RcxAF0zaGeHK3qOOi Gggx7Nq5IGE+wGEqKGEXcT6rAQFpPpIgup7mxjE9Pdk9G3snmYa96aTWP18MsH51mpyy 30G4NRxSjnay9fZdn7l2rlOJd7iqYEKYuNaZUP85G1WzclZXLzrXpMwPStUTeIqAj0Db y/aAr7bbufROc7NUQko74kwDE2YvUvzRS3c5oi/RU7G5lDkeivJXlW/dr3OsJTEkoWrI +vCQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n74si13887131pfk.51.2018.04.24.10.36.51; Tue, 24 Apr 2018 10:37:06 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752938AbeDXRfR (ORCPT + 99 others); Tue, 24 Apr 2018 13:35:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:46597 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751226AbeDXRfO (ORCPT ); Tue, 24 Apr 2018 13:35:14 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 552B9AC64; Tue, 24 Apr 2018 17:35:12 +0000 (UTC) Date: Tue, 24 Apr 2018 19:35:11 +0200 From: Libor Pechacek To: Joe Lawrence Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, live-patching@vger.kernel.org, Jiri Kosina , Artem Savkov , Josh Poimboeuf , Petr Mladek , Miroslav Benes , Nicolai Stange Subject: Re: [PATCH v3] selftests/livepatch: introduce tests Message-ID: <20180424173511.frrpg45bndwffvkh@fmn.suse.cz> References: <1523544871-29444-1-git-send-email-joe.lawrence@redhat.com> <1523544871-29444-2-git-send-email-joe.lawrence@redhat.com> <20180420125605.e4eye7ncukyivleh@fm.suse.cz> <20180423144317.too6ucui37m7oj7y@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180423144317.too6ucui37m7oj7y@redhat.com> User-Agent: NeoMutt/20170912 (1.9.0) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 23-04-18 10:43:17, Joe Lawrence wrote: > On Fri, Apr 20, 2018 at 02:56:05PM +0200, Libor Pechacek wrote: [...] > > > + > > > + # Wait for livepatch transition ... > > > + local i=0 > > > + while [[ $(cat /sys/kernel/livepatch/"$mod"/transition) != "0" ]]; do > > > + i=$((i+1)) > > > + if [[ $i -eq $MAX_RETRIES ]]; then > > > + die "failed to complete transition for module $mod" > > > > FWIW, qa_test_klp tests dump blocking processes' stacks at this place for more > > efficient information exchange between tester and developer. > > (klp_dump_blocking_processes() in https://github.com/lpechacek/qa_test_klp, > > file klp_tc_functions.sh) > > > > ... If I read the klp_dump_blocking_processes() code correctly and > understand your comment, you are suggesting that reading (any) > /sys/kernel/livepatch/*/transition would be simpler? No module > parameter needed as only one should ever be transitioning at a given > time? Exactly. [...] > > > +# modname - module name to unload > > > +function disable_lp() { > > > + local mod="$1" > > > > ^^^VVVV - mixed indentation with tabs and spaces. Intentional? > > (same in set_pre_patch_ret and several other places) > > > > Ahh, thanks for spotting that. checkpatch doesn't seem to complain > about shell script indentation. Funny that shellcheck didn't either. > > > > + > > > + echo "% echo 0 > /sys/kernel/livepatch/$mod/enabled" > /dev/kmsg > > > + echo 0 > /sys/kernel/livepatch/"$mod"/enabled > > > > How about folding disable_lp functionality into module unload function? That > > would save extra invocation of disable_lp in test scripts. > > > > Maybe this is just a stylistic thing, but I preferred the test scripts > to be rather explicit about what they are doing. Instead of a do-it-all > test_it() call, I liked how part_a(), part_b(), part_c() spelled things > out. > > In some instances, these functions were once combined, but I ran > into a scenario where I needed only a part of that function because I > was injecting an error. That experience lead me to keep the test "api" > more RISC than CISC :) Understood. Thanks for explanation. [...] > > > diff --git a/tools/testing/selftests/livepatch/test-callbacks.sh b/tools/testing/selftests/livepatch/test-callbacks.sh > > > new file mode 100755 > > > index 000000000000..739d09bb3cff > > > --- /dev/null > > > +++ b/tools/testing/selftests/livepatch/test-callbacks.sh > > > @@ -0,0 +1,607 @@ > > > +#!/bin/bash > > > +# SPDX-License-Identifier: GPL-2.0 > > > +# Copyright (C) 2018 Joe Lawrence > > > + > > > +. functions.sh > > > > This assumes functions.sh is in $CWD. > > > > Good point. In the past, I've used something like: > > SCRIPTDIR="$(readlink -f $(dirname $(type -p $0)))" > > but I notice that not many selftests do anything special at all: > > % grep '^\. ' $(find . tools/testing/selftests/ -name '*.sh') > ... > > only the perf tests do, and they use ". $(dirname $0)/..." so I'll use > that convention for these tests. Indeed! I'm for following the crowd. Thanks for putting the scripts together. Good job done! Libor -- Libor Pechacek SUSE Labs