Received: by 2002:a05:6a10:e898:0:0:0:0 with SMTP id gl24csp4317524pxb; Mon, 8 Feb 2021 13:22:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJNd1APhNKVXuPCPdWOc7AmRMRfjVzE3LAOBtoYc+STAYc2sNRjxv5wC3lyG4h6NN79W9m X-Received: by 2002:a17:906:354b:: with SMTP id s11mr19088972eja.460.1612819369356; Mon, 08 Feb 2021 13:22:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612819369; cv=none; d=google.com; s=arc-20160816; b=i2BQVOOOUTKgYSpMTmlaphvjlGsK/aGYi4sPVgjE0yHRvDGo5kaiikTEnpxTJKa6QG 2uMR+OhVdCNsVZBUZfDI8Bf6j7/hgDlXX3vcOsRD15S9Swg4MbWeG1prqdi96zCR/4Yf 3LvdEh7aFPE3VYiyicvCxAm8BWoUeC1t5LVOSOWCmEkr2kZMLuworf6E38ALmrMSATUi H8LerAhr2tfG9QZs0rfaxtMTiBEHz2N8H4qAhbpJ/nBNWG/b9Y27Z7eCBcOnaSk/ZAV8 /EkKgL+jF/FxC10uUVEp8HQQV/4dxJb287SuSYGyqXpV/c/olzyO5wz/2BS0CaB6Xynr hArg== 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=ttAs23eK9WWshPI9dgw0AuBA8N37siScIza7OZHcCrY=; b=Xip3Vg6vRQFPEBUfr7dnjUzn2m9zXKvokaTj/Xc3v8J0HoC0YfI5hqS/WAWZKu/Umc IjxA7te+26yVu8hzR55niIzO+1ZQ4gucEIeUOoDur/fSSY7OKKwdilE0G/tfGPEW8cWO sBBE5vCiD9An+5Q5lr1pfg4kX4lYPd3ffnkkHatKmaEEZ9qeuymZoFo+DtBM1tCGzXVl pHhrst0cekXbIArSp+MHpeaAWSyO3VRONULx6nlRi23dXjI08VoNwNH2320hw/IhE2fl aKsIrrIZTH2TOf6cgK7qvQsJsS+kkqZfXprnf9P3k6cZFRzTTi+uWDKe5hVkPDjth34C Sh0g== 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 s10si12623267edj.416.2021.02.08.13.22.25; Mon, 08 Feb 2021 13:22:49 -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 S232871AbhBHVTU convert rfc822-to-8bit (ORCPT + 99 others); Mon, 8 Feb 2021 16:19:20 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:32126 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236683AbhBHULF (ORCPT ); Mon, 8 Feb 2021 15:11:05 -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-422-9yvR3X4jPPqT7IH_AM0SnA-1; Mon, 08 Feb 2021 15:10:08 -0500 X-MC-Unique: 9yvR3X4jPPqT7IH_AM0SnA-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 36CAF6D4E0; Mon, 8 Feb 2021 20:10:07 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.194.115]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB41819727; Mon, 8 Feb 2021 20:10:04 +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 21/24] perf tests: Add daemon stop command test Date: Mon, 8 Feb 2021 21:09:05 +0100 Message-Id: <20210208200908.1019149-22-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 stop command. The test stops the daemon and verifies all the configured sessions are properly terminated. Signed-off-by: Jiri Olsa --- tools/perf/tests/shell/daemon.sh | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh index 90a6e8caddfb..3b6b5aa5587c 100755 --- a/tools/perf/tests/shell/daemon.sh +++ b/tools/perf/tests/shell/daemon.sh @@ -295,9 +295,63 @@ EOF rm -f ${config_new} rm -f ${config_empty} } + +test_stop() +{ + echo "test daemon stop" + + 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 + +[session-time] +run = -e task-clock +EOF + + sed -i -e "s|BASE|${base}|" ${config} + + # start daemon + daemon_start ${config} size + + local pid_size=`perf daemon --config ${config} -x: | head -2 | tail -1 | awk 'BEGIN { FS = ":" } ; { print $1 }'` + local pid_time=`perf daemon --config ${config} -x: | head -3 | tail -1 | awk 'BEGIN { FS = ":" } ; { print $1 }'` + + # check that sessions are running + if [ ! -d "/proc/${pid_size}" ]; then + echo "FAILED: session size not up" + fi + + if [ ! -d "/proc/${pid_time}" ]; then + echo "FAILED: session time not up" + fi + + # stop daemon + daemon_exit ${base} ${config} + + # check that sessions are gone + if [ -d "/proc/${pid_size}" ]; then + echo "FAILED: session size still up" + fi + + if [ -d "/proc/${pid_time}" ]; then + echo "FAILED: session time still up" + fi + + rm -rf ${base} + rm -f ${config} +} + error=0 test_list test_reconfig +test_stop exit ${error} -- 2.29.2