Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2812512pxb; Sat, 30 Jan 2021 15:58:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzgky4GRkyHGwWxNz+znNvJi8lxjP1C63Q2ZzsRX2fTY1GoNZz8NOH1VVQzNjKljzVj8tsA X-Received: by 2002:a17:906:cf86:: with SMTP id um6mr481891ejb.426.1612051094914; Sat, 30 Jan 2021 15:58:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612051094; cv=none; d=google.com; s=arc-20160816; b=XPrvn/r3GMjM0PSmYbhpwXB6R1X+lmL7hlug+wSuq1xUOT6J75qOfK2bJ+sI2OO3gl 3jeLrI3/9pr+w1XUYV+L5+AmcZXZFNuDaPY5FJWfNGSerC8Ftn+CJ72280A/zjB38Q1J W+jWo6zrcp4Qneph7zTNnBVZeU4nvQZrDv7FVmyGlWblAohcK59h5FMmIb6vczVKQHoW P0rq39g5mhJ7N/2ImZDZAkpoG8TsIh5d1vEtrOGkpjd5ek0GfRXmaFv5eiggmyW3rH10 aR4ly6Gvs5r+zd2pnUROq3p5m2c2x1NzXodu5jwST+TMTjalB3MPKOHauk73Dh5ubBXq BFFg== 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=xjMPjI0Uqpwk123Vqc+JKO6BHILeTcq+8RL4push5a8=; b=CnV7DORANiJxBeKML+vcZXmiOuyrbb7YkQ9pYheGhgcmWgUGHdjSF7LJwk2DeybFGB qnPfss986xlD7JF1hh8td/tTV1nEKXN6XD6lMn6LRGhBMvZsbfAPkjebyBkI1uqEB41Y gcZgApggxyVRfaNcjkc4CF2cJnrcv2oIIlSIvic06ykIyeWzBoxJ+qDxkcKlM/DdKKhS ktjMCwc94LWGmISmu4mkFLPBnqqJvwPl4I54UKEH8gjkxghZgC/OgwMvuU70GCMbaZjW qvb0il0Ti8u7YZtcLCitNTDPwv5fUVoY3hUQdxfgBFN/LYQJ9sac2yPZFBi4bzGDfoNJ 82ig== 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 gt18si5840629ejc.143.2021.01.30.15.57.44; Sat, 30 Jan 2021 15:58:14 -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 S232290AbhA3X4i convert rfc822-to-8bit (ORCPT + 99 others); Sat, 30 Jan 2021 18:56:38 -0500 Received: from us-smtp-delivery-44.mimecast.com ([205.139.111.44]:57001 "EHLO us-smtp-delivery-44.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232599AbhA3Xu7 (ORCPT ); Sat, 30 Jan 2021 18:50:59 -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-386-4S-TqaaaMMKSXPnYQSguyQ-1; Sat, 30 Jan 2021 18:50:03 -0500 X-MC-Unique: 4S-TqaaaMMKSXPnYQSguyQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0198A911B4; Sat, 30 Jan 2021 23:50:02 +0000 (UTC) Received: from krava.redhat.com (unknown [10.40.192.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8EB1D60DA0; Sat, 30 Jan 2021 23:49:59 +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 , Stephane Eranian , Alexei Budankov Subject: [PATCH 20/24] perf tests: Add daemon reconfig test Date: Sun, 31 Jan 2021 00:48:52 +0100 Message-Id: <20210130234856.271282-21-jolsa@kernel.org> In-Reply-To: <20210130234856.271282-1-jolsa@kernel.org> References: <20210129134855.195810-1-jolsa@redhat.com> <20210130234856.271282-1-jolsa@kernel.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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 daemon reconfiguration. The test changes the configuration file and checks that the session is changed properly. Signed-off-by: Jiri Olsa --- tools/perf/tests/shell/daemon.sh | 119 +++++++++++++++++++++++++++++++ 1 file changed, 119 insertions(+) diff --git a/tools/perf/tests/shell/daemon.sh b/tools/perf/tests/shell/daemon.sh index 874e1fd77c7e..90a6e8caddfb 100755 --- a/tools/perf/tests/shell/daemon.sh +++ b/tools/perf/tests/shell/daemon.sh @@ -177,8 +177,127 @@ EOF rm -f ${config} } +test_reconfig() +{ + echo "test daemon reconfig" + + 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 + + # check 2nd session + # pid:time:-e task-clock:base/time:base/time/output:base/time/control:base/time/ack:0 + local line=`perf daemon --config ${config} -x: | head -3 | tail -1` + check_line_other "${line}" time "-e task-clock" ${base}/session-time \ + ${base}/session-time/output ${base}/session-time/control ${base}/session-time/ack "0" + local pid=`echo "${line}" | awk 'BEGIN { FS = ":" } ; { print $1 }'` + + # prepare new config + local config_new=${config}.new + cat < ${config_new} +[daemon] +base=BASE + +[session-size] +run = -e cpu-clock + +[session-time] +run = -e cpu-clock +EOF + + # TEST 1 - change config + + sed -i -e "s|BASE|${base}|" ${config_new} + cp ${config_new} ${config} + + # wait for old session to finish + tail --pid=${pid} -f /dev/null + + # wait for new one to start + local state="FAIL" + while [ "${state}" != "OK" ]; do + state=`perf daemon ping --config ${config} --session time | awk '{ print $1 }'` + done + + # check reconfigured 2nd session + # pid:time:-e task-clock:base/time:base/time/output:base/time/control:base/time/ack:0 + local line=`perf daemon --config ${config} -x: | head -3 | tail -1` + check_line_other "${line}" time "-e cpu-clock" ${base}/session-time \ + ${base}/session-time/output ${base}/session-time/control ${base}/session-time/ack "0" + + # TEST 2 - empty config + + local config_empty=${config}.empty + cat < ${config_empty} +[daemon] +base=BASE +EOF + + # change config + sed -i -e "s|BASE|${base}|" ${config_empty} + cp ${config_empty} ${config} + + # wait for sessions to finish + local state="OK" + while [ "${state}" != "FAIL" ]; do + state=`perf daemon ping --config ${config} --session time | awk '{ print $1 }'` + done + + local state="OK" + while [ "${state}" != "FAIL" ]; do + state=`perf daemon ping --config ${config} --session size | awk '{ print $1 }'` + done + + local one=`perf daemon --config ${config} -x: | wc -l` + + if [ ${one} -ne "1" ]; then + echo "FAILED: wrong list output" + error=1 + fi + + # TEST 3 - config again + + cp ${config_new} ${config} + + # wait for size to start + local state="FAIL" + while [ "${state}" != "OK" ]; do + state=`perf daemon ping --config ${config} --session size | awk '{ print $1 }'` + done + + # wait for time to start + local state="FAIL" + while [ "${state}" != "OK" ]; do + state=`perf daemon ping --config ${config} --session time | awk '{ print $1 }'` + done + + # stop daemon + daemon_exit ${base} ${config} + + rm -rf ${base} + rm -f ${config} + rm -f ${config_new} + rm -f ${config_empty} +} error=0 test_list +test_reconfig exit ${error} -- 2.29.2