Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp124pxb; Mon, 8 Feb 2021 13:23:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJyDiuKw54gheKiv4XFx/o1V3yX21uylH4aiPiHVTqW/IOMsBcSzaTkTO3X51BaHIPAFsbyg X-Received: by 2002:a17:906:e15:: with SMTP id l21mr18728875eji.376.1612819433722; Mon, 08 Feb 2021 13:23:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612819433; cv=none; d=google.com; s=arc-20160816; b=CgTeWkTkiwom6FqqbKcuQkEqPEOTiXJ9zrzTf4QXVJ7tsIdTT5upb03cFd+NUKbos3 u1/HjRSgOqJcL8UqJYzNMmSjlhGuPZaDJCoCoU9FJIUf5Qtlnl/QFuxYoupPRIdlv9RK z1sw5eLmmk2JWwUQiu2ifVWkVNWKcmwww6S+t6lJU5qBsc+J+TyzyOJp2QttKc8clTkT INQQlx7cJkW/mzAEzujWkLMv8C1GKsIHuTUYtQ4RgBs/eaX3BjIZGau2Sq+p8gTu9ksw ceoJqLR9y83KSIv6DO1qwZxjSIWiVixUUlrNxtIJjP9clW/TRw4BeQNS/wR40wXNiMiL usXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=yRv4HhcwQmUjORUZ+Zd5ZkSh7n/+ER61MShD4xmD1Lw=; b=NWY3vnlhFblL1Lj+1oWdCw3Z1Su6dxbdL1T5NUHieiY+xvNPZVHk2IsAYjBcIIj7nZ vvd8PtYDIXuHLHBc+aim3oqQ6f+sBLQkN7CvFSMdM3KTN/e+fAbsXMs6ksGFmFKAbvab 5vHQNamBn/CbVivt9iT2O+iPVRu2nRh+qwvxuJJkiE5nehqUdRNc1IqIyVE9iKlKJhbE e++rV5iAjk2yfJ0Rf6ESXSEOgfSTO8CGzC9Yi5RwDI0shp4oHzYj/DwBRJR8Qa5kjybf Zieyh2MW1A+Bpq39k9XYdLXjWICxQPPRsnOjdIHhi6NjSskothQEhBB4Yo4zLfoqI8+2 Wzyw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r25si15754604edc.514.2021.02.08.13.23.26; Mon, 08 Feb 2021 13:23:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235781AbhBHVUt convert rfc822-to-8bit (ORCPT + 99 others); Mon, 8 Feb 2021 16:20:49 -0500 Received: from us-smtp-delivery-44.mimecast.com ([207.211.30.44]:31571 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236657AbhBHULL (ORCPT ); Mon, 8 Feb 2021 15:11:11 -0500 Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-J3dPTVKKPk-CeFKFUq0SYg-1; Mon, 08 Feb 2021 15:10:16 -0500 X-MC-Unique: J3dPTVKKPk-CeFKFUq0SYg-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 10C73801965; Mon, 8 Feb 2021 20:10:15 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id C71F419C59; Mon, 8 Feb 2021 20:10:12 +0000 (UTC) From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Alexander Shishkin , Michael Petlan , Ian Rogers , Alexei Budankov Subject: [PATCH 24/24] perf tests: Add daemon lock test Date: Mon, 8 Feb 2021 21:09:08 +0100 Message-Id: <20210208200908.1019149-25-jolsa@kernel.org> In-Reply-To: <20210208200908.1019149-1-jolsa@kernel.org> References: <20210208200908.1019149-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@kernel.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Transfer-Encoding: 8BIT Content-Type: text/plain; charset=WINDOWS-1252 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Adding test for perf daemon lock ensuring only one instance of daemon can run over one base directory. Signed-off-by: Jiri Olsa --- tools/perf/tests/shell/daemon.sh | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh index 9fcb98768633..e5b824dd08d9 100755 --- a/tools/perf/tests/shell/daemon.sh +++ b/tools/perf/tests/shell/daemon.sh @@ -426,6 +426,43 @@ EOF rm -f ${config} } +test_lock() +{ + echo "test daemon lock" + + local config=$(mktemp /tmp/perf.daemon.config.XXX) + local base=$(mktemp -d /tmp/perf.daemon.base.XXX) + + # prepare config + cat < ${config} +[daemon] +base=BASE + +[session-size] +run = -e cpu-clock +EOF + + sed -i -e "s|BASE|${base}|" ${config} + + # start daemon + daemon_start ${config} size + + # start second daemon over the same config/base + failed=`perf daemon start --config ${config} 2>&1 | awk '{ print $1 }'` + + # check that we failed properly + if [ ${failed} != "failed:" ]; then + error=1 + echo "FAILED: daemon lock failed" + fi + + # stop daemon + daemon_exit ${base} ${config} + + rm -rf ${base} + rm -f ${config} +} + error=0 test_list @@ -433,5 +470,6 @@ test_reconfig test_stop test_signal test_ping +test_lock exit ${error} -- 2.29.2