From patchwork Fri Jun 2 16:08:39 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101289 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp480141qge; Fri, 2 Jun 2017 09:21:52 -0700 (PDT) X-Received: by 10.55.207.92 with SMTP id e89mr8762952qkj.200.1496420512866; Fri, 02 Jun 2017 09:21:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420512; cv=none; d=google.com; s=arc-20160816; b=QZvxDUDLIvfth/Z5i65Q8rd1D3kA8UfYAraIO0IA/xdLK9Ne7wjAn1m07VfMNe+y1X AWWfe2aCyUcy2v+vRrqnBeDQQ2eLeuuw9Q0wdPm2Tiwm0OL2v+FoRdFWF8neh+3kF2op KHwSUpoXInM8CXXjmiBpOeiawZoDGOcWxyH/URwgw3EOb1P7kjSPS0qKfYB6MZuknpbz ZGglxhdmoAus32bKk1ncbxoOi0PCsKAE2ug0KkEPAxWrgbb9sL3G+j/2YkfaJT5gvFsf AbOPMqQAFiIPHEsop7rIW69RoUxO+eS79/di9shaOy3EvAC/mca+QRuagLgN6eCH8/jf lUmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=RU4+EJ+EXZD3Wmqy/PcLF7yTeCLMz8Hxyt8CEZm80xk=; b=RCUBxfqKhmg2oTeFhqm8ifuOSj7o/+0h3Pyi4daJPOFKO3tl1Gm0Uuq1dTqv404PZp BJfGO+PMTCZmcBrHMHZYtixv29QWlLtuunTmlYfZFzWVsSWNOVvtCrwPjE7mJH/weQfI deVtgpzQupO1au8kioywBC6H8CIe7u5l7LLNRkVBV2jlbCB6UYL5cL80z8StyZEOYtAx tHFmyz7gchCzdSo64RQB5QOoAQJFks/Udwu3xHa5vzb/u31u+iJPye1svITjwxdgjm5X bXGTyli+pYdqmKtv3Zeuu2dyWqKD/OSUgbJnppkNI+FKx6vlrgpn3oIqWoe773XQRpjP mWzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h47si23464154qta.167.2017.06.02.09.21.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:21:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50640 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpKg-00016G-Gh for patch@linaro.org; Fri, 02 Jun 2017 12:21:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp7w-0005wQ-1Y for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp7t-0004yL-LF for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:40 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:34454) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7t-0004xw-Ey for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:37 -0400 Received: by mail-wr0-x230.google.com with SMTP id g76so9355359wrd.1 for ; Fri, 02 Jun 2017 09:08:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=RU4+EJ+EXZD3Wmqy/PcLF7yTeCLMz8Hxyt8CEZm80xk=; b=hOEC9xBrE32vRscbTnN/jhpp7ioyXHHNGNw0P564nZcdqCnFagpcsIofiYOPdFyxVn p0tzUY0wWGUxWEGvj00UOFzKzVjFjwKAc50DDGsjsSYr5rAogLAtYP6Cr1vKjL/MEjZL eeF3XzoFHHVrzeS6smUQW2plz+yB1AEJfaQz0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=RU4+EJ+EXZD3Wmqy/PcLF7yTeCLMz8Hxyt8CEZm80xk=; b=ZQfJxlCvtMajohuyzne8lxW+LzDu1s2sZH7GNZyztlf5yHp9EA3L2PPlTpIKg+v5hZ 82L13T4WTB96x8OW+qO2tL6ay324haQembJfwKiQ3yl3pre4D1opyyG1TFXr5yNG55VC ySRMVWERr97bH2raBsuLbjdfTcx7nRZTNMfcf5XY02R6m54qHuiw3a3R/ypeuCcEEno/ Abd2LRwz5ILYYPh0aLhcMMvGCqQ9vn0Y/lMNEWCUQVYwdxWtmIXRIe67+2US47/aez48 2dTcf15TGnLGkrgqmVtOlCpLe9YJyxu72Bax88ntNShtH93YAwVPf/fdIx17uXU3ZNBf Cqdw== X-Gm-Message-State: AODbwcC6878TFT6uAgJx9LBtzQtPpWsJu5xBt/DkPs9z17mzQbt+uCj/ 5Aify9+Iei4+tKrIXCQO9w== X-Received: by 10.223.168.2 with SMTP id l2mr5563280wrc.94.1496419716481; Fri, 02 Jun 2017 09:08:36 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id x37sm40325658wrb.42.2017.06.02.09.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:34 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 6A20B3E01BB; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:39 +0100 Message-Id: <20170602160848.4913-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::230 Subject: [Qemu-devel] [RISU PATCH v4 01/10] .gitignore: ignore build directories X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" These are generated by the build-all-arches script. Signed-off-by: Alex Bennée --- .gitignore | 1 + 1 file changed, 1 insertion(+) -- 2.13.0 Reviewed-by: Peter Maydell diff --git a/.gitignore b/.gitignore index fc84419..fca9128 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ risu core config.h Makefile.in +build From patchwork Fri Jun 2 16:08:40 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101292 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp481346qge; Fri, 2 Jun 2017 09:24:41 -0700 (PDT) X-Received: by 10.233.220.71 with SMTP id q68mr8842434qkf.199.1496420681183; Fri, 02 Jun 2017 09:24:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420681; cv=none; d=google.com; s=arc-20160816; b=GMDv9UYoqSrUcF+7/bcsPey8EfPR4sNyQjkDv0Il+O/N1XPxnNHMj/nzT8xNpZcAys vH4WzyAJULPvf1jJZeg32i4XY0d3zflqeQXwZT6750MnIRPr8imA5Fnj6E66/5HCrw2M U4SPp1mX4Rlae3TYCkoJLVx0mYgA9P7rT3BfCSClCQvrz6HtaTteqKyr0UAJ2TSrFjc3 iNGd4FsLwy48ILn2bZkrYsYwHtilimDXp1D+cqbFacNV6zWW8q8HgSmdRwOAPF5cZO8g cNiSbYIyeNzmvZqHqC9jaUGCzvba2NfrRVlezmfi9aRJhk/oJlJ5nXiyrP3Jy4mH0ZUk x6zA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=/eETwYi8yC5aBcH5pI9IhkPlstvELhvMY9I3yhbPgkw=; b=p5fqX8kw5/4Y7B7QzqMOW11n14mpxW5StsowMVEzJ9fksR9YBbQtoLcpPl4s78epY8 pqPqmu0y0kOyssRucxC4/mgLBOe1en7zWPtTkgf4YMp5260qNF9GoHxiwTAH8kM1LL8H 099s5mHnMScT20RuYqqyy+pc9c+Qdl3X7dDj+Fo3TGDKMe6nTH1mNUOaotdKNbnANI6D MNrMrN22VdakCO7PbR3RJPebtCSagjV+BtiIJ+Bvqs+D9Uv6t+EQgNtWXsiX09QJRIyV VmZWm+rn6CnhDEoEk4QtLY01hv1Ra6ajzWh5FLOOuS3+avIoFjSMvmLfwXRXk5QunBz5 BbrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id j11si23893587qtc.85.2017.06.02.09.24.40 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:24:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50655 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpNO-0003uE-KS for patch@linaro.org; Fri, 02 Jun 2017 12:24:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54400) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp7w-0005wl-8R for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp7u-0004yo-V8 for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:40 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:35830) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7u-0004yQ-OA for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:38 -0400 Received: by mail-wm0-x236.google.com with SMTP id b84so29299893wmh.0 for ; Fri, 02 Jun 2017 09:08:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/eETwYi8yC5aBcH5pI9IhkPlstvELhvMY9I3yhbPgkw=; b=eVwO3j1xJy7R/p4N8UiB2I+bEhC4a5/VhICVoSzIfJs6hGRJpmE2H/t+KTlyudeyfq KreYr6kPdz0TFfv48Ib9886CB7Z1IuDHhfBKcHagXZicca+FBJ/ibJg1OSRa1/2Xaeyn 5jfnnixU/cMSSjPltNiIda5gXXLWc7Zozua3s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/eETwYi8yC5aBcH5pI9IhkPlstvELhvMY9I3yhbPgkw=; b=pq5vw+cM3Iy1RpkwjUOCwWRcyHhiUZ7Q0ObbB+DmGspytEryAr7doiwPSJToWbWlFJ buXOjQQ13RJsJZnkKpFzWZ4mPJghja+3ySTka3EoUWB6Ss4Hjjr8HXe14o0syJ5Lfwvn gZw5CfFbvX7M1GtYj6mjpcTWeBSm3Rr0BmHuz/6mSlw/MFrDV0QA2mHvHZ2JHzqFV70Z /iIx849FqzJ2IoHUHdLsWhPNhtF5C8+xpgPw0tPxjXPkwXgBU2cUF/6+HnV84VnyLEYE Fs18cMsWMi9YeXDMEvNICzfsaSLfMq/q+H7j//PeTkZePp+ovqxwdW2ZYrpyYlb2Dd2X 38uQ== X-Gm-Message-State: AODbwcAMSfnrvjF8DO++fIqCs8pv0diTvm/8K4Nrem/dKX7QghaMUBX9 S7Vibgy7fUG+TGAE X-Received: by 10.28.4.203 with SMTP id 194mr46571wme.118.1496419717422; Fri, 02 Jun 2017 09:08:37 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id h73sm4435042wma.10.2017.06.02.09.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:34 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 74C183E028C; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:40 +0100 Message-Id: <20170602160848.4913-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 Subject: [Qemu-devel] [RISU PATCH v4 02/10] build-all-archs: support cross building via docker X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" If we want to link to any other libraries we might find using simple cross toolchains doesn't work so well. One way around this is to use a dockerised cross-toolchain which then won't clash with your host system. If the user specifies --use-docker the obvious will be done. By default we use the QEMU projects qemu:debian-FOO-cross images as RISU hackers are likely to be QEMU developers too. However any docker tag can be passed on the command line. If none of the docker images have usable compilers we fall back to checking the host path. Signed-off-by: Alex Bennée --- build-all-archs | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 66 insertions(+), 6 deletions(-) -- 2.13.0 diff --git a/build-all-archs b/build-all-archs index 2768727..78f062e 100755 --- a/build-all-archs +++ b/build-all-archs @@ -11,15 +11,65 @@ # Contributors: # Peter Maydell (Linaro) - initial implementation -# So we notice risugen failing even though it's in a pipeline -set -o pipefail +# Simple usage +usage() { + cat <<-EOF + Usage: $0 [options] + + Options include: + --use-docker[=tags] use docker cross compile + + If specifying docker the default will be to use the any + qemu:debian-FOO-cross targets available on your system. +EOF + exit 1 +} + +while [[ "$1" = -* ]]; do + opt="$1"; shift + arg= + if [[ "$opt" = *=* ]]; then + arg="${opt#*=}" + opt="${opt%%=*}" + fi + case "$opt" in + --use-docker) + if [ -z "$arg" ]; then + default_tags=$(docker images qemu --format "{{.Repository}}:{{.Tag}}" | grep "\(arm\|power\).*cross$") + docker_tags=$(echo $default_tags | sed 's/\n/\s/g' ) + else + docker_tags="$arg" + fi + ;; + --help) + usage + ;; + *) + usage + ;; + esac +done # Debian stretch and Ubuntu Xenial have cross compiler packages for # all of these: -# gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-m68k-linux-gnu -# gcc-powerpc64le-linux-gnu gcc-powerpc64-linux-gnu +# gcc-arm-linux-gnueabihf gcc-aarch64-linux-gnu gcc-m68k-linux-gnu +# gcc-powerpc64le-linux-gnu gcc-powerpc64-linux-gnu +# If docker is enabled we just brute force the various images until we +# can set the one that has a workable cross compiler. + +DOCKER_RUN="docker run --rm -t -u $(id -u) -v $(pwd):$(pwd) -w $(pwd)" program_exists() { + if [ ! -z "$docker_tags" ]; then + use_docker_tag="" + for tag in $docker_tags; do + if ${DOCKER_RUN} ${tag} /bin/bash -c "command -v $1 >/dev/null"; then + use_docker_tag=$tag + return + fi + done + fi + command -v "$1" >/dev/null 2>&1 } @@ -30,19 +80,29 @@ for triplet in aarch64-linux-gnu arm-linux-gnueabihf m68k-linux-gnu \ if ! program_exists "${triplet}-gcc"; then echo "Skipping ${triplet}: no compiler found" continue + else + echo "Building ${triplet} on ${use_docker_tag:-host}..." fi # Do a complete rebuild from scratch, because it's cheap enough. rm -rf build/${triplet} mkdir -p build/${triplet} - (cd build/${triplet} && CROSS_PREFIX="${triplet}-" ../../configure) - make -C build/${triplet} EXTRA_CFLAGS=-Werror + CONFIGURE="cd build/${triplet} && CROSS_PREFIX="${triplet}-" ../../configure" + MAKE="make -C build/${triplet} EXTRA_CFLAGS=-Werror" + if [ -z "$use_docker_tag" ]; then + /bin/bash -c "${CONFIGURE}" + ${MAKE} + else + ${DOCKER_RUN} $use_docker_tag /bin/bash -c "${CONFIGURE}" + ${DOCKER_RUN} $use_docker_tag /bin/bash -c "${MAKE}" + fi done # Now run risugen for all architectures mkdir -p build/risuout +set -o pipefail # detect failures in pipeline for f in *.risu; do echo "Running risugen on $f..." From patchwork Fri Jun 2 16:08:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101282 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp475445qge; Fri, 2 Jun 2017 09:11:55 -0700 (PDT) X-Received: by 10.55.4.137 with SMTP id 131mr9621148qke.140.1496419915632; Fri, 02 Jun 2017 09:11:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496419915; cv=none; d=google.com; s=arc-20160816; b=yCQXDt02uf4/9G/wGTTIB5uxSXhTZoOuydQh5vLZzUAyDNGD4IcT8SKbO3h7edkrSL YcaQrsu5dcFFO2G979fYPCo2Q51yJY7F5/+zp3LKw93YmZMcRPgZor3P/oInoI7Hfp9o LZOU3qxKFwOwxhzhMJoTMllF31uIZnKxKCYgcnuDpZ3SXeR+Xnzjs19hh1RV9mPV7am+ 2DNeB8zFNDd0p82ebwZTlCk9DO2Ruk5Eelra6OdwoYutTqzHhc+NY7G1jFwffadq4HPw Ifx+gfZD8soPN9ka5f2D+fplbPoBYXTwuuTf99HE6VQNYL63ftBPytg8azXqYB0yDYxL Pmmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=i53bjYCFRwspWhHeexTtRr0V4E+fero576Y6nVyjLAs=; b=FB0+/rVZngOOU2XTW4hcADEyYDP5454JxCeD1HkGl26TextsS8qfrNV0RlkJYxj6zk bz76/AEJ+TO/EQ7cqMUuh+UxZvy/Oc3nlsElAORUP18Vj+g2afvkl8HHaSS/e1conor1 XGljpmfss610mFwC3wVTb7trbZxGRNmaY/z+t1y8FJx7ZH1Cb8B06DY6kPhT/wpCVGib MRSrEuTjSpACyKax+DI7BimmGj6xslpP8lwkij3vObJDN1NfBm3gI6UI6WIiPTNjpYzG 5dqj8fXpdGNV7jMK8raciSIWyVmtK+2a99pcIWGrSvAg6L+Pg/CEYCYg+nkwnsbROymK YVkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id k72si13867201qke.301.2017.06.02.09.11.55 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:11:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpB3-0008HT-56 for patch@linaro.org; Fri, 02 Jun 2017 12:11:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54403) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp7w-0005wt-DW for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp7v-0004z6-FM for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:40 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:37102) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7v-0004yj-8c for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:39 -0400 Received: by mail-wm0-x234.google.com with SMTP id d127so30557378wmf.0 for ; Fri, 02 Jun 2017 09:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=i53bjYCFRwspWhHeexTtRr0V4E+fero576Y6nVyjLAs=; b=MqB0sIYODaxU/IrNrZv6nKC/AaQOpnjn5t6aTI3LFbqXK215kM/Awx/w+C7bNxRWU2 BURgTRH8DUsMef0tSfVaELkivk2QduvbrsnzjWyHunvKU8IUBLu58Wc+K5OGJjjVdelP lEI0D6/slVh66rCxtrdk4j/0M5f8sF29L8hpo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i53bjYCFRwspWhHeexTtRr0V4E+fero576Y6nVyjLAs=; b=OqPJPN0qfeiIa80YM5edt4mCRUvwhtr8pypuUYxJE/m+WqJz6iVsivcZSjToCcy+uE DYW02RHy0dphrYZN7IJ6jQI3BZ50BrxTRKRF6/MkXMC+zikvQkqftkEpc4wLizejUlWa nkCsPbk7kk99N1lYGY4JPdLFCOfNAFZSqGMFtRfiN4grnmVoeWfwkp2MoaQG95nj2KHL DFlJKEQ72Ap/syFm97RONneSFXPO60GbTIWyyZ1CLfSxScVDKAZFyGt36OSw7UsDrMjK Sdx4Vf+//nRNwVrC6wUzf8z5EpqSseftechIyCP927w1xaLw5H16kWXUOpmUr1PnFJfV RPQw== X-Gm-Message-State: AODbwcAMip6srr8in8XNlRx+wS7jejFucdd0TUw3AJvUIVxIdH5T86Xu m9dcC4kWtJNU7N/A X-Received: by 10.28.149.65 with SMTP id x62mr35426wmd.35.1496419718271; Fri, 02 Jun 2017 09:08:38 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id e73sm2258505wmd.1.2017.06.02.09.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:36 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 7FA7A3E031F; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:41 +0100 Message-Id: <20170602160848.4913-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::234 Subject: [Qemu-devel] [RISU PATCH v4 03/10] build-all-archs: support --static flag X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Alex Bennée --- build-all-archs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.13.0 diff --git a/build-all-archs b/build-all-archs index 78f062e..788ba36 100755 --- a/build-all-archs +++ b/build-all-archs @@ -18,6 +18,7 @@ usage() { Options include: --use-docker[=tags] use docker cross compile + --static build a static binary If specifying docker the default will be to use the any qemu:debian-FOO-cross targets available on your system. @@ -41,6 +42,9 @@ while [[ "$1" = -* ]]; do docker_tags="$arg" fi ;; + --static) + CONF="--static" + ;; --help) usage ;; @@ -88,7 +92,7 @@ for triplet in aarch64-linux-gnu arm-linux-gnueabihf m68k-linux-gnu \ rm -rf build/${triplet} mkdir -p build/${triplet} - CONFIGURE="cd build/${triplet} && CROSS_PREFIX="${triplet}-" ../../configure" + CONFIGURE="cd build/${triplet} && CROSS_PREFIX=${triplet}- ../../configure ${CONF}" MAKE="make -C build/${triplet} EXTRA_CFLAGS=-Werror" if [ -z "$use_docker_tag" ]; then From patchwork Fri Jun 2 16:08:42 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101285 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp477080qge; Fri, 2 Jun 2017 09:15:12 -0700 (PDT) X-Received: by 10.55.73.133 with SMTP id w127mr8475387qka.4.1496420112144; Fri, 02 Jun 2017 09:15:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420112; cv=none; d=google.com; s=arc-20160816; b=T6ary+N0Qmz+8uQSn1SZDmrmA6/bY5KhOr5X3KahBvWyud3jpwhhwFzFyK+zOoiBUc KibWZhc39nOh95bejeY24RJOMAp1oAYIlcLEm1DjCPxQwhEOYFToC6tm+8xeZqsD4fVl 5mQgB0qPje7W8XuqHebuOITVS6XzYc6NQ6pgqg8c3MCLtg5wcKqLUxiQdwGCkGHNyW2s shnB9FBwXIaG8BmO4J1wdzsI3JXRwSh1Yma1+3lAY13M/vWtbNJVfHIVU0dITosFOsFD QLFfMfHs4swCtTatUbGjgPzV1aaWqcLry+NBk744tqO7eQVtF0+L1VRajT5OZBi2QULd 6JDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=m2Sj5CrIL6xhDtC2TyR+kCFC63AH4THHdbHxe3URKPE=; b=Skl6eTztdY4B64ZDPZXKEKfU6bpxP0UMv/CA5Cfd0xdTfATVu3Tmf1bMzbsGz7r7HX A/0w/ZUsENevYmxzjXIWzfgThBpB3rPAKYenn43N/YZiqauJPxWP7RIepvbRLglX6p6H OTnX9kEy5Z+QYcJlotQWuW6g1UBb6DvFAs0/hMzaNi2x068pGUatqr2mwaQ1LglWgjyv bJmF4qFf2ZbUN2ylOxZCmCqS18c9xS7AfKcE+RLwWtoMaO0fdbtBP3gMTEOuDNuHO/Xz fuNrbpzK4zm/NK2GfRsNcALG/S3hcBArANW59O/e3vSab344UE7pa8I6c44xDLGFmTCi tTFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t66si23275079qkf.279.2017.06.02.09.15.11 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:15:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50600 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpED-0003Xx-Nw for patch@linaro.org; Fri, 02 Jun 2017 12:15:09 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54426) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp7x-0005xx-Cn for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp7w-0004zp-Ah for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:41 -0400 Received: from mail-wm0-x22e.google.com ([2a00:1450:400c:c09::22e]:37107) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7w-0004zA-4V for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:40 -0400 Received: by mail-wm0-x22e.google.com with SMTP id d127so30557701wmf.0 for ; Fri, 02 Jun 2017 09:08:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=m2Sj5CrIL6xhDtC2TyR+kCFC63AH4THHdbHxe3URKPE=; b=BEV1Hzk/Fq8Co8geNljD3BD3cxgPHOA76lXXy/FyBKYPG+vOT+sVG6pqRCkmiYZoTm w3tKI1UNtldQRMLxYzsacA70esKGYejmHGRpf98fDI2HwHDqmQMwgBb2fftHyBHyJHwK x9DXTfaQdLz+cuXikkp9aCRqANLljlgCP0aZ4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=m2Sj5CrIL6xhDtC2TyR+kCFC63AH4THHdbHxe3URKPE=; b=bQjVyM7U5yFMwlmIynNyk2fKKn5aX8/Nzv9+w52vFNmoteEy7Jb8ir/bJhvwrRA1Az /qelmxl3EG6nf5g7ty93vHqxlEnCrgHCTMITkUA+o2YGxwH7tA2aOAWqiXtx7zdSgM3u NHuAfHbdkorqc7sWC26f5dWlmfHydx/bMZW/yqRLuEUeXe3kGwbLHzZur8IARbAdLeRG 8JWOqGYovk1lyR8RXNQ4xdsUBoGlOXyCYT93XJ4eLiA/foHG/UZY3mqj0UJhYeVUI/44 RjBQh4X56ViXNwIRaD+JSHp3Se5okIC6VjD41h34h8zbhTnR1/x7ly+6suyRNADLKXZ1 SnQQ== X-Gm-Message-State: AODbwcCfVcH4fqLfeX47IwEhwIGQkOSvFv0BE0qK/GIBftQMYSp6D9Wa tGvbg+XqHRhdHgro X-Received: by 10.28.135.82 with SMTP id j79mr69742wmd.10.1496419719145; Fri, 02 Jun 2017 09:08:39 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 39sm23892416wru.50.2017.06.02.09.08.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:36 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 8A2993E0334; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:42 +0100 Message-Id: <20170602160848.4913-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::22e Subject: [Qemu-devel] [RISU PATCH v4 04/10] risu: a bit more verbosity when running X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Before this is could seem a little quite when running as you had no indication stuff was happening (or how fast). I only dump on the master side as I want to minimise the amount of qemu logs to sift through. Signed-off-by: Alex Bennée -- v3 - use portable fmt string for image_start_address - include arm dumping position --- risu.c | 15 +++++++++++++-- risu.h | 3 +++ risu_aarch64.c | 3 +++ risu_arm.c | 3 +++ 4 files changed, 22 insertions(+), 2 deletions(-) -- 2.13.0 diff --git a/risu.c b/risu.c index 7e42160..bcdc219 100644 --- a/risu.c +++ b/risu.c @@ -37,6 +37,16 @@ sigjmp_buf jmpbuf; /* Should we test for FP exception status bits? */ int test_fp_exc = 0; +long executed_tests = 0; +void report_test_status(void *pc) +{ + executed_tests += 1; + if (executed_tests % 100 == 0) { + fprintf(stderr,"Executed %ld test instructions (pc=%p)\r", + executed_tests, pc); + } +} + void master_sigill(int sig, siginfo_t *si, void *uc) { switch (recv_and_compare_register_info(master_socket, uc)) @@ -61,6 +71,7 @@ void apprentice_sigill(int sig, siginfo_t *si, void *uc) return; case 1: /* end of test */ + fprintf(stderr, "\nend of test\n"); exit(0); default: /* mismatch */ @@ -129,7 +140,7 @@ int master(int sock) } master_socket = sock; set_sigill_handler(&master_sigill); - fprintf(stderr, "starting image\n"); + fprintf(stderr, "starting master image at 0x%"PRIxPTR"\n", image_start_address); image_start(); fprintf(stderr, "image returned unexpectedly\n"); exit(1); @@ -139,7 +150,7 @@ int apprentice(int sock) { apprentice_socket = sock; set_sigill_handler(&apprentice_sigill); - fprintf(stderr, "starting image\n"); + fprintf(stderr, "starting apprentice image at 0x%"PRIxPTR"\n", image_start_address); image_start(); fprintf(stderr, "image returned unexpectedly\n"); exit(1); diff --git a/risu.h b/risu.h index 883bcf7..1eeb885 100644 --- a/risu.h +++ b/risu.h @@ -37,6 +37,7 @@ extern uintptr_t image_start_address; extern void *memblock; extern int test_fp_exc; +extern int ismaster; /* Ops code under test can request from risu: */ #define OP_COMPARE 0 @@ -72,6 +73,8 @@ int recv_and_compare_register_info(int sock, void *uc); */ int report_match_status(void); +void report_test_status(void *pc); + /* Interface provided by CPU-specific code: */ /* Move the PC past this faulting insn by adjusting ucontext diff --git a/risu_aarch64.c b/risu_aarch64.c index 9c6809d..5625979 100644 --- a/risu_aarch64.c +++ b/risu_aarch64.c @@ -16,6 +16,9 @@ void advance_pc(void *vuc) { ucontext_t *uc = vuc; uc->uc_mcontext.pc += 4; + if (ismaster) { + report_test_status((void *) uc->uc_mcontext.pc); + } } void set_ucontext_paramreg(void *vuc, uint64_t value) diff --git a/risu_arm.c b/risu_arm.c index f570828..eaf4f6c 100644 --- a/risu_arm.c +++ b/risu_arm.c @@ -44,6 +44,9 @@ void advance_pc(void *vuc) { ucontext_t *uc = vuc; uc->uc_mcontext.arm_pc += insnsize(uc); + if (ismaster) { + report_test_status((void *) uc->uc_mcontext.arm_pc); + } } From patchwork Fri Jun 2 16:08:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101284 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp476630qge; Fri, 2 Jun 2017 09:14:21 -0700 (PDT) X-Received: by 10.237.40.3 with SMTP id r3mr2866781qtd.44.1496420061196; Fri, 02 Jun 2017 09:14:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420061; cv=none; d=google.com; s=arc-20160816; b=HVzm3geLEwhxO35hTrYRzvmE86pnRHR0uHoRjl43sIF/EkPtemdIXrSESi1QfClsSJ hI4pelXJoWP/XrmBJcAKV66ppB+3lgORJzG+UYpZP71TFzIoiIU0QcGwlcHP/TO5ZtoW 5B6xbOqnWfLu8paDoZHhqjWZzjtWGnRfQwPWc4URC6v19fs3PILVVSt2NNHd8gEPSe+E D61p3NMS4nii1Rif4DHJ6f1ysxfS19w74x0zN1SsZCe6/cm0NAW1mrEtLKDr6FH8impm JXRqrg72fzT7AdZfJwsTwWQu6TgqEH+BqT7PfS42A43xfIVx2sKQsL+2/WPoK8G7nFE4 qBcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=zIWDJyHcm7Zx4NDl20LaKIxjzF+Ai3Lttbv5o84g6co=; b=aDJFHEJohI3RiWpkVcE7Mcq7vUnpzQXZ+NzMn3Um5taAQf1tB4l8p/nOhPlg2Jmr9E DI6fuvqeE5RhiQSu6svaUq7QVY3kFE/Q4QSWiQ/+OlKQ50iHUXicwgv+SEMdW98Vlx9k rVaUbg3jiapQCl1qPzxjmyojTIoF6OL0S7xO/COXgW1Is/+mjyRSmtw6/xXj7QflOfEx wFfT987AlciqrjQHqX7iom2QPmhoyr3o2+iUWzhY8cF7RB0eX/ysWICmXUNeot2dkXMc 8J2F+bB/PHHq2ktESxhmGuK8PgLDd09+p4KMN9IbztsfFr3mLoQSzq4cWXh20iMD178s ZMHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id k10si23620128qtk.222.2017.06.02.09.14.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:14:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50595 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpDO-0002cx-A9 for patch@linaro.org; Fri, 02 Jun 2017 12:14:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp7z-00060C-EW for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp7x-00050n-Sb for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:43 -0400 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:35976) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7x-000507-J7 for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:41 -0400 Received: by mail-wr0-x22b.google.com with SMTP id v111so2774043wrc.3 for ; Fri, 02 Jun 2017 09:08:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zIWDJyHcm7Zx4NDl20LaKIxjzF+Ai3Lttbv5o84g6co=; b=hT6iJLGJz/xx1pdrCloJoJ/HbRdk2n7/ROvTgdh+wKLWbl/wQIW1uTe6ATE4S8B3Gb AWrihwmm/36DeOVUv3Xbf+lRhbMA6INqqg7nee51xeLZViLBAOw0VDb5+TF2OrRglBkr 8YJFFRN0Ia98mTswr82UCvNszFd7enHdPq11I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zIWDJyHcm7Zx4NDl20LaKIxjzF+Ai3Lttbv5o84g6co=; b=kZ9Mcsy9NuCMWl0vMejIwprjgF9p/5xuBBMLZoFuzz2JrIXHZvbg8BrkWuPcEIL3X3 A7ZU8/X7BwBo6DDQui1+p9o1S08yBPnXO2gt8XdmuPQwgxbLgLsqkl1nZ9Ow65XZgbTW gg/OagY1sM2otD60mjSKMkPVvu/MBTtc4kHDYJErJvS965DQy5ud1EIaVIdcmRcvUadL nZT825OC8mkCi/iSFbuTh5glYVi2seGZeWOntFxaHRdTOjIEHp1u3bbVu2BLAhr2B/XQ 7C+V0WpWp02vlvXAUJhQTwEAKJJpjNMf+wKpT87MIwIRHgSl0IdrzrE8WzwDtHE2UK2N 6yrg== X-Gm-Message-State: AODbwcBof48haCDmAQO2qs2WQG0DTcVtfWzT9AX4aQrF7dLs6sn1t5yy lAi1ySmS1riPk7XqSc9Qkw== X-Received: by 10.223.169.120 with SMTP id u111mr277420wrc.203.1496419720549; Fri, 02 Jun 2017 09:08:40 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m38sm24693378wrm.4.2017.06.02.09.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:37 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 950193E0349; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:43 +0100 Message-Id: <20170602160848.4913-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [RISU PATCH v4 05/10] risu: paramterise send/receive functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is a precursor to record/playback support. Instead of passing the socket fd we now pass helper functions for reading/writing and responding. This will allow us to do the rest of the record/playback cleanly outside of the main worker function. Signed-off-by: Alex Bennée --- v4 - split header code - fix formatting foo-bar's v3 - new for v3 - arm, aarch64, ppc64 --- reginfo.c | 118 +++++++++++++++++++++++++++++++------------------------------- risu.c | 23 ++++++++++-- risu.h | 11 ++++-- 3 files changed, 89 insertions(+), 63 deletions(-) -- 2.13.0 diff --git a/reginfo.c b/reginfo.c index 96c6342..6498459 100644 --- a/reginfo.c +++ b/reginfo.c @@ -21,33 +21,35 @@ uint8_t apprentice_memblock[MEMBLOCKLEN]; static int mem_used = 0; static int packet_mismatch = 0; -int send_register_info(int sock, void *uc) +int send_register_info(write_fn write_fn, void *uc) { - struct reginfo ri; - int op; - reginfo_init(&ri, uc); - op = get_risuop(&ri); - - switch (op) { - case OP_COMPARE: - case OP_TESTEND: - default: - /* Do a simple register compare on (a) explicit request - * (b) end of test (c) a non-risuop UNDEF - */ - return send_data_pkt(sock, &ri, sizeof(ri)); - case OP_SETMEMBLOCK: - memblock = (void *)(uintptr_t)get_reginfo_paramreg(&ri); - break; - case OP_GETMEMBLOCK: - set_ucontext_paramreg(uc, - get_reginfo_paramreg(&ri) + (uintptr_t)memblock); - break; - case OP_COMPAREMEM: - return send_data_pkt(sock, memblock, MEMBLOCKLEN); - break; - } - return 0; + struct reginfo ri; + int op; + reginfo_init(&ri, uc); + op = get_risuop(&ri); + + switch (op) { + case OP_TESTEND: + write_fn(&ri, sizeof(ri)); + return 1; + case OP_SETMEMBLOCK: + memblock = (void *)(uintptr_t)get_reginfo_paramreg(&ri); + break; + case OP_GETMEMBLOCK: + set_ucontext_paramreg(uc, + get_reginfo_paramreg(&ri) + (uintptr_t)memblock); + break; + case OP_COMPAREMEM: + return write_fn(memblock, MEMBLOCKLEN); + break; + case OP_COMPARE: + default: + /* Do a simple register compare on (a) explicit request + * (b) end of test (c) a non-risuop UNDEF + */ + return write_fn(&ri, sizeof(ri)); + } + return 0; } /* Read register info from the socket and compare it with that from the @@ -58,54 +60,52 @@ int send_register_info(int sock, void *uc) * that says whether it is register or memory data, so if the two * sides get out of sync then we will fail obscurely. */ -int recv_and_compare_register_info(int sock, void *uc) +int recv_and_compare_register_info(read_fn read_fn, respond_fn resp_fn, void *uc) { - int resp = 0, op; - - reginfo_init(&master_ri, uc); - op = get_risuop(&master_ri); - - switch (op) { - case OP_COMPARE: - case OP_TESTEND: - default: - /* Do a simple register compare on (a) explicit request - * (b) end of test (c) a non-risuop UNDEF - */ - if (recv_data_pkt(sock, &apprentice_ri, sizeof(apprentice_ri))) { + int resp = 0, op; + + reginfo_init(&master_ri, uc); + op = get_risuop(&master_ri); + + switch (op) { + case OP_COMPARE: + case OP_TESTEND: + default: + /* Do a simple register compare on (a) explicit request + * (b) end of test (c) a non-risuop UNDEF + */ + if (read_fn(&apprentice_ri, sizeof(apprentice_ri))) { packet_mismatch = 1; resp = 2; - - } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { + } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { /* register mismatch */ resp = 2; - - } else if (op == OP_TESTEND) { + } else if (op == OP_TESTEND) { resp = 1; - } - send_response_byte(sock, resp); - break; + } + resp_fn(resp); + break; case OP_SETMEMBLOCK: - memblock = (void *)(uintptr_t)get_reginfo_paramreg(&master_ri); - break; + memblock = (void *)(uintptr_t)get_reginfo_paramreg(&master_ri); + break; case OP_GETMEMBLOCK: - set_ucontext_paramreg(uc, get_reginfo_paramreg(&master_ri) + - (uintptr_t)memblock); - break; + set_ucontext_paramreg(uc, get_reginfo_paramreg(&master_ri) + + (uintptr_t)memblock); + break; case OP_COMPAREMEM: mem_used = 1; - if (recv_data_pkt(sock, apprentice_memblock, MEMBLOCKLEN)) { - packet_mismatch = 1; - resp = 2; + if (read_fn(apprentice_memblock, MEMBLOCKLEN)) { + packet_mismatch = 1; + resp = 2; } else if (memcmp(memblock, apprentice_memblock, MEMBLOCKLEN) != 0) { - /* memory mismatch */ - resp = 2; + /* memory mismatch */ + resp = 2; } - send_response_byte(sock, resp); + resp_fn(resp); break; } - return resp; + return resp; } /* Print a useful report on the status of the last comparison diff --git a/risu.c b/risu.c index bcdc219..22571cd 100644 --- a/risu.c +++ b/risu.c @@ -47,9 +47,28 @@ void report_test_status(void *pc) } } +/* Master functions */ + +int read_sock(void *ptr, size_t bytes) +{ + return recv_data_pkt(master_socket, ptr, bytes); +} + +void respond_sock(int r) +{ + send_response_byte(master_socket, r); +} + +/* Apprentice function */ + +int write_sock(void *ptr, size_t bytes) +{ + return send_data_pkt(apprentice_socket, ptr, bytes); +} + void master_sigill(int sig, siginfo_t *si, void *uc) { - switch (recv_and_compare_register_info(master_socket, uc)) + switch (recv_and_compare_register_info(read_sock, respond_sock, uc)) { case 0: /* match OK */ @@ -63,7 +82,7 @@ void master_sigill(int sig, siginfo_t *si, void *uc) void apprentice_sigill(int sig, siginfo_t *si, void *uc) { - switch (send_register_info(apprentice_socket, uc)) + switch (send_register_info(write_sock, uc)) { case 0: /* match OK */ diff --git a/risu.h b/risu.h index 1eeb885..71ea94f 100644 --- a/risu.h +++ b/risu.h @@ -53,17 +53,24 @@ struct reginfo; /* Functions operating on reginfo */ +/* To keep the read/write logic from multiplying across all arches + * we wrap up the function here to keep all the changes in one place + */ +typedef int (*write_fn) (void *ptr, size_t bytes); +typedef int (*read_fn) (void *ptr, size_t bytes); +typedef void (*respond_fn) (int response); + /* Send the register information from the struct ucontext down the socket. * Return the response code from the master. * NB: called from a signal handler. */ -int send_register_info(int sock, void *uc); +int send_register_info(write_fn write_fn, void *uc); /* Read register info from the socket and compare it with that from the * ucontext. Return 0 for match, 1 for end-of-test, 2 for mismatch. * NB: called from a signal handler. */ -int recv_and_compare_register_info(int sock, void *uc); +int recv_and_compare_register_info(read_fn read_fn, respond_fn respond, void *uc); /* Print a useful report on the status of the last comparison * done in recv_and_compare_register_info(). This is called on From patchwork Fri Jun 2 16:08:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101287 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp478958qge; Fri, 2 Jun 2017 09:19:15 -0700 (PDT) X-Received: by 10.200.37.106 with SMTP id 39mr10052132qtn.92.1496420355736; Fri, 02 Jun 2017 09:19:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420355; cv=none; d=google.com; s=arc-20160816; b=JKGkgdwr+wJoiy+u2FrfBubZ5kVJAVjv2Ejt3o7ENFisb1PJI5gWo3RYApJJdew4Nk tF5kZoMaLVBHJoTPubLLgSRcgg1RJjy0PAq/trJgPQvdanGB6L6sakuDuW7daUPtAidA eynIOU+fVFU/NFEuP2BwvW/4gveEJJhbtGipbqjJO48dRl7eIwLcJ0zfT/wp3LU+k+cx WBXaECS+K5qfxmzgWKYCau9KIvv3ezvTX9ej8hjjRiZrOZHGpru7i6Jed+84klb+GtsU fxonEKGLbPRUod+LnWFcjnaMowT8qzLKBY8Zt4EgtJyq62RezZ522Mt1+53dslMoMZxo wOug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Jhoagad3XQ0S+iSghR7fyRcD8gT8B2WNOo3E/mpvp+Q=; b=SjUYnu9BV68C+XTXLQ93/uQV3tyuI8NAQ7qklDXIBhu73gjctGYNSOCW3s7VD2CKeb 75DcD8qah6AM83HQ2v33K2wi6D5jSvG2ONPVnjdwTs5oYfk/jvtWtpJLbvHAe4QoYiBS c/BuiF4Jyi89I61OJaHx6gnwf81K4FN6xiVc/D5i8HVkJbPjN17+c4yZfnfItRi4AaR5 muNVNOcFnxLc2rWTRTOewD5QnT8teLOqqGPcpx9SO2X1UBFLIJsK11jllGf1JDZk5dWL dOp8JBzrXj71vdLCbDvKi8aA2f8Vey7E7JwBzEoFwVkh68+gLGOmV9liAVA8Nsc39odG yNSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id b29si23811303qtb.70.2017.06.02.09.19.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:19:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50624 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpI9-0007Vg-49 for patch@linaro.org; Fri, 02 Jun 2017 12:19:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54461) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp7z-00060f-W5 for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp7y-00051o-Kd for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:43 -0400 Received: from mail-wr0-x22b.google.com ([2a00:1450:400c:c0c::22b]:35979) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7y-00050g-CC for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:42 -0400 Received: by mail-wr0-x22b.google.com with SMTP id v111so2774232wrc.3 for ; Fri, 02 Jun 2017 09:08:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Jhoagad3XQ0S+iSghR7fyRcD8gT8B2WNOo3E/mpvp+Q=; b=ZDu788duBLYIs6Z+UsIufWcznYl267+GSR+KvzTi0K8NLbRAzOv/NrHIxglAaOjbLW LWvYPhKDMw2B7eVuzB5DRGYa8FXmFBUY3Yp580rD0t9GOSENCn6J30eoe5gOC3km7x4k u+ZlFqLdL0X6W787g72Y3SxqLkB24CoxmD7yU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Jhoagad3XQ0S+iSghR7fyRcD8gT8B2WNOo3E/mpvp+Q=; b=aCPF80G+XfYhLR7Gne3cs2CuVUu+iDhYphsFSjYM+/jQOEcnjQgoZywBjBLzxIqm2k gTg1KNDuRNKOEAWHYf/BqHxBeBb5oi2xvwG0yfKBaZ8FCGWu68iMo0sYWOvUAVe4vb56 ubtXCtUW7Byh+REcbAD5LtTEkNnYkkUzsUdzAQInYwTFwRpAuAx8WjFcTT8zZcGftD/m mnX/RbR/Yres4UvYqpMEuqX1N0WqfY0T7CK6lE9crvplwydWRqfnIn5+u1kqfmCqB1ZR 1Xa+7z5vFUNUSpfK0K8mBZyWAFJ7B9baX9QEBHn95S7WkVdK7hSO0Cxu6HWrFVOUK0Ec oF2A== X-Gm-Message-State: AODbwcB7YkUhYVQXzbQyYf5hEwn9OeT/Dow9OlzSVZHduwdFxXq3WhMU PyHjZWh+jGrwAiF0 X-Received: by 10.223.139.81 with SMTP id v17mr6407420wra.70.1496419721430; Fri, 02 Jun 2017 09:08:41 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id p76sm2640094wma.15.2017.06.02.09.08.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:37 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 9FA033E03B5; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:44 +0100 Message-Id: <20170602160848.4913-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::22b Subject: [Qemu-devel] [RISU PATCH v4 06/10] risu: add header to trace stream X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" I've also added a header packet with pc/risu op in it so we can keep better track of how things are going. Signed-off-by: Alex Bennée --- v4 - split from previous patch --- reginfo.c | 103 +++++++++++++++++++++++++++++++++++++-------------------- risu.h | 9 +++++ risu_aarch64.c | 5 +++ risu_arm.c | 5 +++ risu_m68k.c | 5 +++ risu_ppc64.c | 5 +++ 6 files changed, 96 insertions(+), 36 deletions(-) -- 2.13.0 diff --git a/reginfo.c b/reginfo.c index 6498459..be7bcdb 100644 --- a/reginfo.c +++ b/reginfo.c @@ -24,10 +24,20 @@ static int packet_mismatch = 0; int send_register_info(write_fn write_fn, void *uc) { struct reginfo ri; + trace_header_t header; int op; + reginfo_init(&ri, uc); op = get_risuop(&ri); + /* Write a header with PC/op to keep in sync */ + header.pc = get_pc(&ri); + header.risu_op = op; + if (write_fn(&header, sizeof(header)) != 0) { + fprintf(stderr,"%s: failed header write\n", __func__); + return -1; + } + switch (op) { case OP_TESTEND: write_fn(&ri, sizeof(ri)); @@ -63,51 +73,72 @@ int send_register_info(write_fn write_fn, void *uc) int recv_and_compare_register_info(read_fn read_fn, respond_fn resp_fn, void *uc) { int resp = 0, op; + trace_header_t header; reginfo_init(&master_ri, uc); op = get_risuop(&master_ri); - switch (op) { - case OP_COMPARE: - case OP_TESTEND: - default: - /* Do a simple register compare on (a) explicit request - * (b) end of test (c) a non-risuop UNDEF - */ - if (read_fn(&apprentice_ri, sizeof(apprentice_ri))) { - packet_mismatch = 1; - resp = 2; - } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { - /* register mismatch */ - resp = 2; - } else if (op == OP_TESTEND) { - resp = 1; - } - resp_fn(resp); - break; - case OP_SETMEMBLOCK: - memblock = (void *)(uintptr_t)get_reginfo_paramreg(&master_ri); - break; - case OP_GETMEMBLOCK: - set_ucontext_paramreg(uc, get_reginfo_paramreg(&master_ri) + - (uintptr_t)memblock); - break; - case OP_COMPAREMEM: - mem_used = 1; - if (read_fn(apprentice_memblock, MEMBLOCKLEN)) { - packet_mismatch = 1; - resp = 2; - } else if (memcmp(memblock, apprentice_memblock, MEMBLOCKLEN) != 0) { - /* memory mismatch */ - resp = 2; - } - resp_fn(resp); - break; + if (read_fn(&header, sizeof(header)) != 0) { + fprintf(stderr,"%s: failed header read\n", __func__); + return -1; + } + + if (header.risu_op == op ) { + + /* send OK for the header */ + resp_fn(0); + + switch (op) { + case OP_COMPARE: + case OP_TESTEND: + default: + /* Do a simple register compare on (a) explicit request + * (b) end of test (c) a non-risuop UNDEF + */ + if (read_fn(&apprentice_ri, sizeof(apprentice_ri))) { + packet_mismatch = 1; + resp = 2; + + } else if (!reginfo_is_eq(&master_ri, &apprentice_ri)) { + /* register mismatch */ + resp = 2; + + } else if (op == OP_TESTEND) { + resp = 1; + } + resp_fn(resp); + break; + case OP_SETMEMBLOCK: + memblock = (void *)(uintptr_t)get_reginfo_paramreg(&master_ri); + break; + case OP_GETMEMBLOCK: + set_ucontext_paramreg(uc, get_reginfo_paramreg(&master_ri) + + (uintptr_t)memblock); + break; + case OP_COMPAREMEM: + mem_used = 1; + if (read_fn(apprentice_memblock, MEMBLOCKLEN)) { + packet_mismatch = 1; + resp = 2; + } else if (memcmp(memblock, apprentice_memblock, MEMBLOCKLEN) != 0) { + /* memory mismatch */ + resp = 2; + } + resp_fn(resp); + break; + } + } else { + fprintf(stderr, "out of sync %" PRIxPTR "/%" PRIxPTR " %d/%d\n", + get_pc(&master_ri), header.pc, + op, header.risu_op); + resp = 2; + resp_fn(resp); } return resp; } + /* Print a useful report on the status of the last comparison * done in recv_and_compare_register_info(). This is called on * exit, so need not restrict itself to signal-safe functions. diff --git a/risu.h b/risu.h index 71ea94f..c01a9c3 100644 --- a/risu.h +++ b/risu.h @@ -51,6 +51,12 @@ extern int ismaster; struct reginfo; +typedef struct +{ + uintptr_t pc; + uint32_t risu_op; +} trace_header_t; + /* Functions operating on reginfo */ /* To keep the read/write logic from multiplying across all arches @@ -102,6 +108,9 @@ uint64_t get_reginfo_paramreg(struct reginfo *ri); */ int get_risuop(struct reginfo *ri); +/* Return the PC from a reginfo */ +uintptr_t get_pc(struct reginfo *ri); + /* initialize structure from a ucontext */ void reginfo_init(struct reginfo *ri, ucontext_t *uc); diff --git a/risu_aarch64.c b/risu_aarch64.c index 5625979..312bd6a 100644 --- a/risu_aarch64.c +++ b/risu_aarch64.c @@ -43,3 +43,8 @@ int get_risuop(struct reginfo *ri) uint32_t risukey = 0x00005af0; return (key != risukey) ? -1 : op; } + +uintptr_t get_pc(struct reginfo *ri) +{ + return ri->pc; +} diff --git a/risu_arm.c b/risu_arm.c index eaf4f6c..a61256b 100644 --- a/risu_arm.c +++ b/risu_arm.c @@ -73,3 +73,8 @@ int get_risuop(struct reginfo *ri) uint32_t risukey = (isz == 2) ? 0xdee0 : 0xe7fe5af0; return (key != risukey) ? -1 : op; } + +uintptr_t get_pc(struct reginfo *ri) +{ + return ri->gpreg[15]; +} diff --git a/risu_m68k.c b/risu_m68k.c index f84ac7a..35b3c03 100644 --- a/risu_m68k.c +++ b/risu_m68k.c @@ -33,3 +33,8 @@ int get_risuop(struct reginfo *ri) uint32_t risukey = 0x4afc7000; return (key != risukey) ? -1 : op; } + +uintptr_t get_pc(struct reginfo *ri) +{ + return ri->gregs[R_PC]; +} diff --git a/risu_ppc64.c b/risu_ppc64.c index b575078..e702a00 100644 --- a/risu_ppc64.c +++ b/risu_ppc64.c @@ -38,3 +38,8 @@ int get_risuop(struct reginfo *ri) uint32_t risukey = 0x00005af0; return (key != risukey) ? -1 : op; } + +uintptr_t get_pc(struct reginfo *ri) +{ + return ri->nip; +} From patchwork Fri Jun 2 16:08:45 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101286 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp477138qge; Fri, 2 Jun 2017 09:15:18 -0700 (PDT) X-Received: by 10.237.60.77 with SMTP id u13mr10228483qte.18.1496420118104; Fri, 02 Jun 2017 09:15:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420118; cv=none; d=google.com; s=arc-20160816; b=ZSrWYni5b0Zttqyym7biBHBw/oPXgw+j91F42Or8uit0eHPdpekXrKllaPtHAFX23o AKywu+AWhmH7CwUQgg/yBeIpFEUwXdxIg5afA5Fn5N0d6NfTNoRkjjXUea0d9PezeDgy b9jjVVVAhVsNYRUoLEQp7aVpbQ939c1HmbpMngkRWSBMit6UhTfeyHxs+LtrIeFKXrZw B0tqtf0Yl9WtFy4yhiNk5suU9qWN+d1/Lu71amFmT8jbvF2iLqtc2aaUsG40eSQjhghb TyBqfjn3fI1Xkzs4c79rkFQDSKipVS3wTXd43jE+euOXo4MHVuKmhLyuRnudSkqbQWfi 4ceg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Ro1ytADxnG64aJjlX9UADcYFs9uHSdXlpYSXxFKZhRw=; b=UgPawh4bw1XyGBGNTV4t7nMxPBqsyAQkntkfgrHlsfiPACjHY36t2ZV+EC8G6svNXZ JkyZ52L3bhIrLzZzJxvOJ3Ckula66RmYMkXDOf3A4Mg5A8HrdMRXV5fCHIfHQ//62b+f 39KB9/GNMEGv5wQbm0IMFpbal+i4P7qr0By20ZN4vRodn3xuFOKHGwTXzYxB9HQ2pCI9 6LxecHXiqZmataE97u2ECQ4Wcho+jArao/M3gARBIlb8J12ZLNKtDFqPrA9GW+LDKMHV EmiiS2TuWhryuylqUaKFOsSkqCCj5DmG56TCUOUYMRm3MvmneqY/O9gF+p8w2hGYc3mz dGxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id f14si23824857qta.315.2017.06.02.09.15.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:15:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50602 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpEJ-0003ch-EC for patch@linaro.org; Fri, 02 Jun 2017 12:15:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54504) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp82-000631-5J for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp80-00053O-PV for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:46 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:34836) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp80-00052s-GR for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:44 -0400 Received: by mail-wm0-x234.google.com with SMTP id b84so29301844wmh.0 for ; Fri, 02 Jun 2017 09:08:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Ro1ytADxnG64aJjlX9UADcYFs9uHSdXlpYSXxFKZhRw=; b=RKnpbbT6/VK/XTLsZ6nXCo1vFx+kJgO3Bvcef+/5Gavekx50oSvhKyeRB3FIDZRfmb GQYqB2zB76QYHkDjWF+tgQaHJ9ie5oZgmmspl0DjNY7SPIHh3XQraoOFIEeujIS/jaWy toj7m9nVK+4D5e2vSFzAWelXfIzhz/qsUaiDw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Ro1ytADxnG64aJjlX9UADcYFs9uHSdXlpYSXxFKZhRw=; b=c1h4fPxk+PB5RkWvDCfCMAPV9QoUY9l7tO/U08y6GaO6Oi1vxqztrJHjWaXY3HB0CB yW7ohu5wRP8j7jARYibCU4olj+kFZCw4Qt8rgxihCm/XZQNTea30rRBboOsG4+78Ws9S 3eUbE65nAsyqntwEy/2GA/X1VxzYZlZwWW8qlXFCK5ZN1SWZ9F5FeYa5KwipMdrVqJdR KVH6TygBhUXkNXsRoSp5eDx8cvnNztFs91dsF91+XQnyPkUGJvfu0iOXYTyiL4PVGc2B l313nC3ecCTbjaUzFpROT+ts8HHsa9omWIQQS06X60u+Mu6kgxPLGrXDPS+rST3HanjI pOag== X-Gm-Message-State: AODbwcAYtlb73FbDwfkP1CKGt3uW/b28d9cDd1gZp2aDfgy7e/xtIdQh wHa2WQvFeKkdODKr X-Received: by 10.28.211.5 with SMTP id k5mr42073wmg.11.1496419723532; Fri, 02 Jun 2017 09:08:43 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id n92sm22903763wrb.62.2017.06.02.09.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:39 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id AA5C13E0422; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:45 +0100 Message-Id: <20170602160848.4913-8-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::234 Subject: [Qemu-devel] [RISU PATCH v4 07/10] risu: add simple trace and replay support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This adds a very dumb and easily breakable trace and replay support. In --master mode the various risu ops trigger a write of register/memory state into a binary file which can be played back to an apprentice. Currently there is no validation of the image source so feeding the wrong image will fail straight away. The trace files will get very big for any appreciable sized test file and this will be addressed in later patches. Signed-off-by: Alex Bennée --- v4 - fix formatting mess - abort() instead of reporting de-sync - don't fake return for compiler v3 - fix options parsing - re-factored so no need for copy & paste v2 - moved read/write functions into main risu.c - cleaned up formatting - report more in apprentice --trace mode --- risu.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 84 insertions(+), 13 deletions(-) -- 2.13.0 diff --git a/risu.c b/risu.c index 22571cd..137cbbf 100644 --- a/risu.c +++ b/risu.c @@ -31,6 +31,7 @@ void *memblock = 0; int apprentice_socket, master_socket; +int trace_file = 0; sigjmp_buf jmpbuf; @@ -40,10 +41,12 @@ int test_fp_exc = 0; long executed_tests = 0; void report_test_status(void *pc) { - executed_tests += 1; - if (executed_tests % 100 == 0) { - fprintf(stderr,"Executed %ld test instructions (pc=%p)\r", - executed_tests, pc); + if (ismaster || trace_file) { + executed_tests += 1; + if (executed_tests % 100 == 0) { + fprintf(stderr,"Executed %ld test instructions (pc=%p)\r", + executed_tests, pc); + } } } @@ -54,6 +57,12 @@ int read_sock(void *ptr, size_t bytes) return recv_data_pkt(master_socket, ptr, bytes); } +int write_trace(void *ptr, size_t bytes) +{ + size_t res = write(trace_file, ptr, bytes); + return (res == bytes) ? 0 : 1; +} + void respond_sock(int r) { send_response_byte(master_socket, r); @@ -66,9 +75,36 @@ int write_sock(void *ptr, size_t bytes) return send_data_pkt(apprentice_socket, ptr, bytes); } +int read_trace(void *ptr, size_t bytes) +{ + size_t res = read(trace_file, ptr, bytes); + return (res == bytes) ? 0 : 1; +} + +void respond_trace(int r) +{ + switch (r) { + case 0: /* test ok */ + case 1: /* end of test */ + break; + default: + /* should not get here */ + abort(); + break; + } +} + void master_sigill(int sig, siginfo_t *si, void *uc) { - switch (recv_and_compare_register_info(read_sock, respond_sock, uc)) + int r; + + if (trace_file) { + r = send_register_info(write_trace, uc); + } else { + r = recv_and_compare_register_info(read_sock, respond_sock, uc); + } + + switch (r) { case 0: /* match OK */ @@ -82,7 +118,15 @@ void master_sigill(int sig, siginfo_t *si, void *uc) void apprentice_sigill(int sig, siginfo_t *si, void *uc) { - switch (send_register_info(write_sock, uc)) + int r; + + if (trace_file) { + r = recv_and_compare_register_info(read_trace, respond_trace, uc); + } else { + r = send_register_info(write_sock, uc); + } + + switch (r) { case 0: /* match OK */ @@ -94,6 +138,9 @@ void apprentice_sigill(int sig, siginfo_t *si, void *uc) exit(0); default: /* mismatch */ + if (trace_file) { + report_match_status(); + } exit(1); } } @@ -155,7 +202,13 @@ int master(int sock) { if (sigsetjmp(jmpbuf, 1)) { - return report_match_status(); + if (trace_file) { + close(trace_file); + fprintf(stderr,"\nDone...\n"); + return 0; + } else { + return report_match_status(); + } } master_socket = sock; set_sigill_handler(&master_sigill); @@ -184,6 +237,7 @@ void usage (void) fprintf(stderr, "between master and apprentice risu processes.\n\n"); fprintf(stderr, "Options:\n"); fprintf(stderr, " --master Be the master (server)\n"); + fprintf(stderr, " -t, --trace=FILE Record/playback trace file\n"); fprintf(stderr, " -h, --host=HOST Specify master host machine (apprentice only)\n"); fprintf(stderr, " -p, --port=PORT Specify the port to connect to/listen on (default 9191)\n"); } @@ -194,6 +248,7 @@ int main(int argc, char **argv) uint16_t port = 9191; char *hostname = "localhost"; char *imgfile; + char *trace_fn = NULL; int sock; // TODO clean this up later @@ -204,13 +259,14 @@ int main(int argc, char **argv) { { "help", no_argument, 0, '?'}, { "master", no_argument, &ismaster, 1 }, + { "trace", required_argument, 0, 't' }, { "host", required_argument, 0, 'h' }, { "port", required_argument, 0, 'p' }, { "test-fp-exc", no_argument, &test_fp_exc, 1 }, { 0,0,0,0 } }; int optidx = 0; - int c = getopt_long(argc, argv, "h:p:", longopts, &optidx); + int c = getopt_long(argc, argv, "h:p:t:", longopts, &optidx); if (c == -1) { break; @@ -223,6 +279,11 @@ int main(int argc, char **argv) /* flag set by getopt_long, do nothing */ break; } + case 't': + { + trace_fn = optarg; + break; + } case 'h': { hostname = optarg; @@ -253,17 +314,27 @@ int main(int argc, char **argv) } load_image(imgfile); - + if (ismaster) { - fprintf(stderr, "master port %d\n", port); - sock = master_connect(port); + if (trace_fn) + { + trace_file = open(trace_fn, O_WRONLY|O_CREAT, S_IRWXU); + } else { + fprintf(stderr, "master port %d\n", port); + sock = master_connect(port); + } return master(sock); } else { - fprintf(stderr, "apprentice host %s port %d\n", hostname, port); - sock = apprentice_connect(hostname, port); + if (trace_fn) + { + trace_file = open(trace_fn, O_RDONLY); + } else { + fprintf(stderr, "apprentice host %s port %d\n", hostname, port); + sock = apprentice_connect(hostname, port); + } return apprentice(sock); } } From patchwork Fri Jun 2 16:08:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101291 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp480652qge; Fri, 2 Jun 2017 09:22:59 -0700 (PDT) X-Received: by 10.55.90.196 with SMTP id o187mr9007293qkb.113.1496420579223; Fri, 02 Jun 2017 09:22:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420579; cv=none; d=google.com; s=arc-20160816; b=wukzaZOmmB5vQJcWAhtm5mhvJKua2E0k35DAViz84372r6RMSwW/iy9jlGchRFyvp0 K0gesxeM8DKyP7MV0It/c51Zp5YcrSFEjJb+nbuRayZfeX/gr3Xq4OwMiOSANkEXcQW1 WEPa4v5+KJuwZSSIHzzeDmW/1cqbqaJu3Rvz8MtcjrWENZmg4Dwqy9wa12leLl9KJKaI GDct4nnBL6jZK/HjB88+ASCEK8vaNoJlHLwkY8gDag/0QQiDIgReTgPdiHQI4sdiWVtq rTEb0nZy3/exLBHWb3Dtu+ZYmJI3YiUiNWoMQwY1u/URkoqlIHKtSfK8o9pIoOxcPJq4 Z+Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=aoDGsASb1Sn5DU/8OVTdKtYRk9ItiOqu9FWIY1Effxs=; b=PWUGZlXYtB64aKg/7S51Zt1yaNwfgDMQjHuloaho51sPXukEodz/jMtE1Sw6BmHkxc +Vd6gAhML6yqNAvycosMvUycm5LJfQYQ/P81bApJupnGN6TaO9CISvmzhJGyfNWJ0RsN u08n71sqVu+OwGUXMDYaz9yd/KnYdSKC8RUVHyaoq69ernU2QSDw6WLvSvYIvncZdysL pJm/4ICv0cMOS4KJQ1nNZwSiH4L7xssp965vyJTX0jFUWNQDhaaG0B3dj5XSE1PtDnQc ZMeimoCKQAG7pNKQV1omxhc+/Ft57c0Sk/GaO1ALR9UYg4A1Ukwd19UeIhDa9ZZpFkEH DI6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id e126si23144393qkb.105.2017.06.02.09.22.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:22:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50644 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpLk-000213-ET for patch@linaro.org; Fri, 02 Jun 2017 12:22:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp81-00062D-Dx for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp80-000536-43 for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:45 -0400 Received: from mail-wr0-x230.google.com ([2a00:1450:400c:c0c::230]:34477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp7z-00052T-Q5 for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:44 -0400 Received: by mail-wr0-x230.google.com with SMTP id g76so9356778wrd.1 for ; Fri, 02 Jun 2017 09:08:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aoDGsASb1Sn5DU/8OVTdKtYRk9ItiOqu9FWIY1Effxs=; b=A42UanfzIrr/Tr/SdPlBh6aao4TB98YVh7DUH1VWnNdlGlGSakKgsYSMkkqLAgIjfK N/D1+XjY4FVqOCIJ+Iu0Alc5v6JOHYI+w9J/pa79a43N8toL6VLB3cWhDMoy3Uj1Dphk UeO/vsZPM3ZpAM1hKE5HLLMogTfoK4D1ZXvjI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aoDGsASb1Sn5DU/8OVTdKtYRk9ItiOqu9FWIY1Effxs=; b=Td4NbWMBYXIexs7UMcnKsC8m5/cpFgUt3emqAeNntMDSfX4colhIOZWpZg12oKQwK1 DzShlzA3+50axIvnZRXvd02kvyo9xWlcBUfM5Q/3PxZYBJpidGW+LZj5dgmWBraOz9gB xv8ZwLyFI4c1/g9DymNTwYquZ1NP5ESFBGFoFYep1kcEnqGKrdbgBLVrg2GKSSxyO/jV K4h5ZbP+rdrjVF7bErlAfOtasaNnWByOPmzWTOWaVkbka6x+/bKWGUAKHCD3n6YSbgTl wBBC/gN9jDN2fcUrd4qovz0tGMAM3tIYl1Hnu4lrJQMpRxD/B0cogm8QVaZ/5CelkynB 2Tew== X-Gm-Message-State: AODbwcAZft3zy7dPXGg0UmciFzstI+kEuYu0LG6YMe6QcwbdgceA/z9F sn5pLbLHRJdbRh/l X-Received: by 10.223.169.83 with SMTP id u77mr597010wrc.13.1496419722813; Fri, 02 Jun 2017 09:08:42 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id y6sm27577949wrc.51.2017.06.02.09.08.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:39 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B51A93E0449; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:46 +0100 Message-Id: <20170602160848.4913-9-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::230 Subject: [Qemu-devel] [RISU PATCH v4 08/10] risu: add support compressed tracefiles X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This uses the magic of zlib's gzread/write interface to wrap the tracefile in compression. The code changes are tiny. I spent more time messing about with the configure/linker stuff to auto-detect bits. As you need decent multi-arch support or a correctly setup cross toolchain we fall back if we can't compile with zlib. This unfortunately needs some #ifdef hackery around the zlib bits in risu.c. Signed-off-by: Alex Bennée -- v4 - removed redundant config.h output, added HAVE_ZLIB - added BUILD_INC to deal with out-of-tree builds --- Makefile | 4 ++-- configure | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- risu.c | 30 +++++++++++++++++++++++++++--- 3 files changed, 82 insertions(+), 7 deletions(-) -- 2.13.0 diff --git a/Makefile b/Makefile index 9a29bb4..ca80eef 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ VPATH=$(SRCDIR) CFLAGS ?= -g -ALL_CFLAGS = -Wall -D_GNU_SOURCE -DARCH=$(ARCH) $(CFLAGS) $(EXTRA_CFLAGS) +ALL_CFLAGS = -Wall -D_GNU_SOURCE -DARCH=$(ARCH) $(BUILD_INC) $(CFLAGS) $(EXTRA_CFLAGS) PROG=risu SRCS=risu.c comms.c reginfo.c risu_$(ARCH).c risu_reginfo_$(ARCH).c @@ -35,7 +35,7 @@ all: $(PROG) $(BINS) dump: $(RISU_ASMS) $(PROG): $(OBJS) - $(CC) $(STATIC) $(ALL_CFLAGS) -o $@ $^ + $(CC) $(STATIC) $(ALL_CFLAGS) -o $@ $^ $(LDFLAGS) %.risu.asm: %.risu.bin ${OBJDUMP} -b binary -m $(ARCH) -D $^ > $@ diff --git a/configure b/configure index c4b5adb..1dc527b 100755 --- a/configure +++ b/configure @@ -32,6 +32,10 @@ compile() { $CC $CFLAGS -c -o ${1}.o ${1}.c 2>/dev/null } +link() { + $LD $LDFLAGS -l${2} -o ${1} ${1}.o 2>/dev/null +} + check_define() { c=${tmp_dir}/check_define_${1} cat > ${c}.c < ${c}.c < +#include +#include +#include + +int main(void) { $1 thisone; return 0; } +EOF + compile $c +} + +check_lib() { + c=${tmp_dir}/check_lib${1} + cat > ${c}.c < +#include <$2.h> + +int main(void) { $3; return 0; } +EOF + compile $c && link $c $1 +} + +generate_config() { + cfg=config.h + echo "generating config.h..." + + echo "/* config.h - generated by the 'configure' script */" > $cfg + echo "#ifndef CONFIG_H" >> $cfg + echo "#define CONFIG_H 1" >> $cfg + + if check_lib z zlib "zlibVersion()"; then + echo "#define HAVE_ZLIB 1" >> $cfg + LDFLAGS=-lz + fi + + echo "#endif /* CONFIG_H */" >> $cfg + + echo "...done" +} + generate_makefilein() { m=Makefile.in echo "generating Makefile.in..." @@ -65,11 +111,13 @@ generate_makefilein() { echo "# Makefile.in - generated by the 'configure' script" > $m echo "ARCH:=${ARCH}" >> $m echo "CC:=${CC}" >> $m + echo "LDFLAGS:=${LDFLAGS}" >> $m echo "AS:=${AS}" >> $m echo "OBJCOPY:=${OBJCOPY}" >> $m echo "OBJDUMP:=${OBJDUMP}" >> $m echo "STATIC:=${STATIC}" >> $m echo "SRCDIR:=${SRCDIR}" >> $m + echo "BUILD_INC:=${BUILD_INC}" >> $m echo "...done" } @@ -118,6 +166,7 @@ done CC="${CC-${CROSS_PREFIX}gcc}" AS="${AS-${CROSS_PREFIX}as}" +LD="${LD-${CROSS_PREFIX}ld}" OBJCOPY="${OBJCOPY-${CROSS_PREFIX}objcopy}" OBJDUMP="${OBJDUMP-${CROSS_PREFIX}objdump}" @@ -125,15 +174,17 @@ if test "x${ARCH}" = "x"; then guess_arch fi -generate_makefilein - # Are we in a separate build tree? If so, link the Makefile # so that 'make' works. if test ! -e Makefile; then echo "linking Makefile..." + BUILD_INC="-I $(pwd)" ln -s "${SRCDIR}/Makefile" . fi +generate_config +generate_makefilein + rm -r "$tmp_dir" echo "type 'make' to start the build" diff --git a/risu.c b/risu.c index 137cbbf..275c5a9 100644 --- a/risu.c +++ b/risu.c @@ -26,6 +26,8 @@ #include #include +#include "config.h" + #include "risu.h" void *memblock = 0; @@ -33,6 +35,11 @@ void *memblock = 0; int apprentice_socket, master_socket; int trace_file = 0; +#ifdef HAVE_ZLIB +#include +gzFile gz_trace_file; +#endif + sigjmp_buf jmpbuf; /* Should we test for FP exception status bits? */ @@ -59,7 +66,11 @@ int read_sock(void *ptr, size_t bytes) int write_trace(void *ptr, size_t bytes) { +#ifdef HAVE_ZLIB + size_t res = gzwrite(gz_trace_file, ptr, bytes); +#else size_t res = write(trace_file, ptr, bytes); +#endif return (res == bytes) ? 0 : 1; } @@ -77,7 +88,11 @@ int write_sock(void *ptr, size_t bytes) int read_trace(void *ptr, size_t bytes) { +#ifdef HAVE_ZLIB + size_t res = gzread(gz_trace_file, ptr, bytes); +#else size_t res = read(trace_file, ptr, bytes); +#endif return (res == bytes) ? 0 : 1; } @@ -202,9 +217,12 @@ int master(int sock) { if (sigsetjmp(jmpbuf, 1)) { - if (trace_file) { - close(trace_file); - fprintf(stderr,"\nDone...\n"); + if (trace_file) + { +#ifdef HAVE_ZLIB + gzclose(gz_trace_file); +#endif + fprintf(stderr,"Done...\n"); return 0; } else { return report_match_status(); @@ -320,6 +338,9 @@ int main(int argc, char **argv) if (trace_fn) { trace_file = open(trace_fn, O_WRONLY|O_CREAT, S_IRWXU); +#ifdef HAVE_ZLIB + gz_trace_file = gzdopen(trace_file, "wb9"); +#endif } else { fprintf(stderr, "master port %d\n", port); sock = master_connect(port); @@ -331,6 +352,9 @@ int main(int argc, char **argv) if (trace_fn) { trace_file = open(trace_fn, O_RDONLY); +#ifdef HAVE_ZLIB + gz_trace_file = gzdopen(trace_file, "rb"); +#endif } else { fprintf(stderr, "apprentice host %s port %d\n", hostname, port); sock = apprentice_connect(hostname, port); From patchwork Fri Jun 2 16:08:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101288 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp479177qge; Fri, 2 Jun 2017 09:19:43 -0700 (PDT) X-Received: by 10.200.36.87 with SMTP id d23mr9249269qtd.196.1496420383413; Fri, 02 Jun 2017 09:19:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420383; cv=none; d=google.com; s=arc-20160816; b=S4Ae5KGSjiDRt5qWVQl3xqAd9i0v0Z2K/gYBj2PBJRB9HgitfQbgsEAlrUyHLo9Pmp pSQID3D30apJ1GWjgCRPaCrSRe5FoxVRogEVBZz+NXecxMv5yBCsv+39wdxyxdsaDn9e t5qlGro/o6XRgxXRHs0g+XqkUBob7JvWipwd8+LQ4Y3xzw+u9o/izq7ia0+wCTsU2imD F1fRdOrakyqBFLcMfSPiwpt2NumHS4p2MYEcdBAPfaTusreqrC4AOhXdril/R6VwuyO4 htejKv1V9E2D7HELSy29MjMqycY3NeBoNz37s39hJDc0XEkAEs8YlsITdncXolY6dnhL Islw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=Yp2jK5JqlUCZ+yhejSiG3aiPjCcKY6rPfChxXDCnC6A=; b=yE9MeukqV6MiShXNVz92CO0VGXbkto1LiopafmFwq2032qgHB+VV6AX9TOgeGiyPwx 6uWRUSoOvXRwACzfIrt+aSFMm1zhrib+dCEOCISXlXTn/VP20BVbq8yzZqqLy9Mmcz7F jZ87uX3DyC/OAJjB2Rj9rPJABWLmTCGNBpp3pobl01RsZaZ5BKRQBLLTo3Ew9M1ifVNK EwprvasxoILT/DkqPmpcakj4nkh2zxhOGF+l8emGlzN23H5csLhd2YXSTHwZJP5JfhkX GJfDdpa1atSdIKv17opEc/aOZG9u221c3MEwIKz76qAMyBe4KSOl4EuJfq98Jx83VQY4 UeIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id t4si23683924qta.25.2017.06.02.09.19.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:19:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpIa-0007dR-Ps for patch@linaro.org; Fri, 02 Jun 2017 12:19:40 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54533) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp84-000675-SI for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp81-000545-HE for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:48 -0400 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]:38244) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp81-00053L-BH for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:45 -0400 Received: by mail-wm0-x236.google.com with SMTP id n195so30610681wmg.1 for ; Fri, 02 Jun 2017 09:08:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Yp2jK5JqlUCZ+yhejSiG3aiPjCcKY6rPfChxXDCnC6A=; b=GUDAiS9HG8sVkFBgGOHlbrrN7UJEz4aZ9RGH68vqxu2LxAeMS+XspVedQ/+k8Dhjif B3VKwJAaSKaOuuBpSQmecQo3VhyWptDedoDN1lWhkywlv3VlpYUZ8M1gItD/GOyrnVc9 fcxSyGxYGC+Ibzu+586Ood3CmuyckhrPGBdGg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Yp2jK5JqlUCZ+yhejSiG3aiPjCcKY6rPfChxXDCnC6A=; b=lP7dvy5Nir+P/y8l3GlM/2kvW08SY+78g3zQIiV15elahSH3opIBM/2yOnDvQpKQPd IJmjWNKucvVhmXdNm0UExful7LrgFfQDY5dwo/gsyQSKnJs838CJk3zdzUZ73i9Lllrr u9zIrTOasJ0UiuaTyKWrcwwJbRV+AA8QdkkFQR6ies5dijuDNphjGJpAcXpbmDAC+5w7 iyhWH0s/xK8/BIsp0/Z8Tgk/y0ZkflOBAeRs2YAVTNtwkJ6vITwqSufLA+PZ6dQHUvo1 /E5YtOd+wFZHBhA01RSIjWEwLaQ7YNEAI/lGWN1g072fWT95h/jx1+9OeCBLZ7FOTN2o uq3Q== X-Gm-Message-State: AODbwcCs0SXozThwNh2Ocn/qdfZYQUP1yjQtCBpsoshH59Q3S2U+Oa6s UfggRU5jAg0mkPkP X-Received: by 10.28.21.13 with SMTP id 13mr42235wmv.13.1496419724460; Fri, 02 Jun 2017 09:08:44 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u198sm3074695wmd.29.2017.06.02.09.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:41 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id BFC0F3E0454; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:47 +0100 Message-Id: <20170602160848.4913-10-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::236 Subject: [Qemu-devel] [RISU PATCH v4 09/10] new: record_traces.sh helper script X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" A simple script to run through a bunch of binaries and generate their trace files. Signed-off-by: Alex Bennée --- v3 - allow overriding of RISU binary --- record_traces.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 record_traces.sh -- 2.13.0 diff --git a/record_traces.sh b/record_traces.sh new file mode 100755 index 0000000..78ce47f --- /dev/null +++ b/record_traces.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# Record traces +# +# A risu helper script to batch process a bunch of binaries and record their outputs +# +set -e + +if test -z "$RISU"; then + script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) + RISU=${script_dir}/risu +fi + +for f in $@; do + echo "Running risu against $f" + t="$f.trace" + ${RISU} --master $f -t $t + echo "Checking trace file OK" + ${RISU} $f -t $t +done From patchwork Fri Jun 2 16:08:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 101290 Delivered-To: patch@linaro.org Received: by 10.140.96.100 with SMTP id j91csp480181qge; Fri, 2 Jun 2017 09:21:59 -0700 (PDT) X-Received: by 10.200.53.51 with SMTP id y48mr665615qtb.98.1496420519093; Fri, 02 Jun 2017 09:21:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1496420519; cv=none; d=google.com; s=arc-20160816; b=wOrRIQkBR55LuDsnrlCFLX4bnVoas9UV7cnrWiGllG2czh0NWuFMCNV6p9fi3CcVGK o/DXmPUj1LothpDnSCpSRDoYPisHZP8ULFb+2aCxnMdN7xeYm/4eqMjNaqyMrbKni166 BZnAmWgqF+buU9mq4ZkfpNmMFd48pm2g71X3m4ElRlkMOHGw7902R9WsN70eaoisSwd0 gYOsKpSK25pFJHE0u3wXK1ss6yT/oiWKqR/Y5nnWBcGp42e+5r7lCT1q5dTgm/NZaQBL rqNublCP8OUaNHxXSb/3J8vJFmqrXGVOhjlXeaqoPOz9t4oxAlPYlHAwiP30RBvahLUn vj3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=kVUVMW/AsmLeYm1c7h4wJg2rsGFgMmHVI2Sldv2IKGY=; b=tZ7Kq6gYCrWHgaQk0QwtpPMmX/X2yKsZF0BZ9D/sdAAE4TcFZ0kz8KAPy7AQxWwZF8 BXQ8ETqKRjXkyH3NpPoPYCaUjDU2r68i7GzNhSUyrke+I0cfsSW4HvqRUcy13MpLYbYo +ElzjRjmdrAVS50+fdpEgsQalXw6Vl0R0PwfFQz1x4rypMwDlhzxuHt/e2p5Kxm2Uzvv vTFjseJneVBbRTwSsJmUhqEK+jhwIBqgqP1BG0knZw0Ko8k8tD4ZFJO259ZE86Gl1dGY mZ5pI8VCx6bXZT4SI1ItK1p0/dpRHxu50hBCuLjUHtDZktRvS/aXB0JZaOYjIQlZRWeW KB0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id d80si5072039qkg.202.2017.06.02.09.21.58 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 02 Jun 2017 09:21:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50639 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGpKm-00013L-Et for patch@linaro.org; Fri, 02 Jun 2017 12:21:56 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dGp84-000671-RD for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dGp82-00054t-NB for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:48 -0400 Received: from mail-wm0-x232.google.com ([2a00:1450:400c:c09::232]:37139) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dGp82-00054A-Gs for qemu-devel@nongnu.org; Fri, 02 Jun 2017 12:08:46 -0400 Received: by mail-wm0-x232.google.com with SMTP id d127so30559941wmf.0 for ; Fri, 02 Jun 2017 09:08:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=kVUVMW/AsmLeYm1c7h4wJg2rsGFgMmHVI2Sldv2IKGY=; b=C5YKLzKQQKnisbuJhTP9Dw8NKMdFEdxxzq+Rs3+WRjbKtVNh5IyNssO/zspHYbzHE8 fpPX6bFd4GtRwya/JKayLyoSp76PGuYgqNTqLFKrbyaQsA3QRMsyhRxsnfwWtKfMXQi6 yAZ4z4ObMRnzdlq0vs9k7XtA/N7H3l1bciVBw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=kVUVMW/AsmLeYm1c7h4wJg2rsGFgMmHVI2Sldv2IKGY=; b=sp4X5qKLknunkleOzKXGrVCeoGlsg6JvfX/J0x4DtPGoK+EV5viOH9+QkDUSHG2Dkl Nv2rH6+j/BGmO6VnUz3ZJNAi660dBe9ihkCawqvUYSbNT21s/GQLEzJpGGgbJzUiMGKy RY/BSfAJXbfuBDCuIm4zpcwJbxvXym3NtJAXFTC0n/HKIIh5wI6BMLpe0+HcqAAyTqHZ kUOneCJCOuI6ZhU54FNXWPGeYo3qgt/j3h1Mo4tbnPEoIlb1pgpEy8av47jBq6LtzSQj Pd1e0GodOZfxda56Jyg1nebQVgln4y++d2BHu5ccD4h6oBTD1n4/q/gA8aG2GBnGmn+u RMhg== X-Gm-Message-State: AODbwcCHiyX3POJcvK3EtVlrhev7xaAxvvEYyXTEVJT8w1A+AUNHg11s CtBQ7j3dVT7/KvW8 X-Received: by 10.28.14.205 with SMTP id 196mr41789wmo.13.1496419725444; Fri, 02 Jun 2017 09:08:45 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id a9sm43284977wrc.22.2017.06.02.09.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Jun 2017 09:08:41 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C9ABC3E0488; Fri, 2 Jun 2017 17:08:54 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Fri, 2 Jun 2017 17:08:48 +0100 Message-Id: <20170602160848.4913-11-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170602160848.4913-1-alex.bennee@linaro.org> References: <20170602160848.4913-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::232 Subject: [Qemu-devel] [RISU PATCH v4 10/10] new: run_risu.sh script X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" A simple script to work through running all of a bunch of files with record/playback traces. Dumps a summary and the number of failed tests at the end. Signed-off-by: Alex Bennée --- v3 - tweak to allow specifying RISU binary --- run_risu.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 run_risu.sh -- 2.13.0 diff --git a/run_risu.sh b/run_risu.sh new file mode 100755 index 0000000..7740d6f --- /dev/null +++ b/run_risu.sh @@ -0,0 +1,53 @@ +#!/bin/bash +# +# Run risu against a set of binaries + trace files +# +# +#set -e + +passed=() +failed=() +missing=() + +if test -z "$RISU"; then + script_dir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd -P) + RISU=${script_dir}/risu +fi + +for f in $@; do + t="$f.trace" + echo "Running $f against $t" + if [ -e $t ]; then + ${QEMU} ${RISU} $f -t $t + if [ $? == 0 ]; then + passed=( "${passed[@]}" $f ) + else + failed=( "${failed[@]}" $f ) + fi + else + missing=( "${missing[@]}" $f ) + fi +done + +if test ${#missing[@]} -gt 0; then + echo "Tests missing ${#missing[@]} trace files:" + for m in "${missing[@]}"; do + echo "$m" + done +fi + +if test ${#passed[@]} -gt 0; then + echo "Passed ${#passed[@]} tests:" + for p in "${passed[@]}"; do + echo "$p" + done +fi + +if test ${#failed[@]} -gt 0; then + echo "Failed ${#failed[@]} tests:" + for f in "${failed[@]}"; do + echo "$f" + done +fi + +exit ${#failed[@]}