From patchwork Thu Oct 18 15:28:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10647511 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9828C112B for ; Thu, 18 Oct 2018 15:28:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89F3828C20 for ; Thu, 18 Oct 2018 15:28:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7E3D928D9D; Thu, 18 Oct 2018 15:28:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 224C428C20 for ; Thu, 18 Oct 2018 15:28:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 065A06E052; Thu, 18 Oct 2018 15:28:42 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2BC176E01C for ; Thu, 18 Oct 2018 15:28:32 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id 61-v6so34170084wrb.6 for ; Thu, 18 Oct 2018 08:28:32 -0700 (PDT) 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; bh=EPf+MrJHS7n0XSaVExB0CZlfFvnYLkrVBlBgKICa4NM=; b=A3dksdmauRcnLiktSCtw6+/1mu0Sksk0nJR/jvrlh/uwHCk+yIY+IbkvH2er3Msvdq LFrD+feKwVAC05Hskdzq7JVh2qF5Ro5sThztMTTuHFJAXBYMg3EBxaFNCoxn6fQ3pkTC m58mW6NWRWKNrui/YtmBVcDfCotfgKvLvD+V7ssOU6fv2Gdot60AtD9VXDIdlb3zTikS qDBa2+7CI5gVWh/UGdoJlqA1T/Lsq3tiFAdcmtxyQ+1GWqAUKaWjZ6IN+Y+0V8uN9uhV tj5xrPGTttiHYyE5sW/5Vj1rMjcetDXgQb1VH8baTrb/MAP4Cc3Nn351S2pcsVjat3gs H/5g== X-Gm-Message-State: ABuFfojxd9EZX195tyQC29sjsJ2vPBfeFGYcCu+wAlwxgHtJmudDnW7c WpmMYjGF/SFpTfrU8KiSUUBlyFhCdYU= X-Google-Smtp-Source: ACcGV62WSKOxlPplhyDEFDs7EYlQzvNHTnor8xlh8NQYxTp9ZLCtQdIHSz+4qZ4HaVbzRnq4mLkCMA== X-Received: by 2002:adf:da43:: with SMTP id r3-v6mr30079773wrl.221.1539876510636; Thu, 18 Oct 2018 08:28:30 -0700 (PDT) Received: from localhost.localdomain ([91.110.193.16]) by smtp.gmail.com with ESMTPSA id i6-v6sm19530387wrq.4.2018.10.18.08.28.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 08:28:29 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 18 Oct 2018 16:28:06 +0100 Message-Id: <20181018152815.31816-9-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181018152815.31816-1-tvrtko.ursulin@linux.intel.com> References: <20181018152815.31816-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 08/17] gem_wsim: More wsim_err X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel-gfx@lists.freedesktop.org MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin A few more opportunities to compact the code by using the error logging helper. Signed-off-by: Tvrtko Ursulin --- benchmarks/gem_wsim.c | 54 ++++++++++++------------------------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/benchmarks/gem_wsim.c b/benchmarks/gem_wsim.c index a6ee6c493424..0010f46c357d 100644 --- a/benchmarks/gem_wsim.c +++ b/benchmarks/gem_wsim.c @@ -2366,9 +2366,7 @@ int main(int argc, char **argv) switch (c) { case 'W': if (master_workload >= 0) { - if (verbose) - fprintf(stderr, - "Only one master workload can be given!\n"); + wsim_err("Only one master workload can be given!\n"); return 1; } master_workload = nr_w_args; @@ -2381,9 +2379,7 @@ int main(int argc, char **argv) break; case 'a': if (append_workload_arg) { - if (verbose) - fprintf(stderr, - "Only one append workload can be given!\n"); + wsim_err("Only one append workload can be given!\n"); return 1; } append_workload_arg = optarg; @@ -2444,10 +2440,8 @@ int main(int argc, char **argv) } if (!balancer) { - if (verbose) - fprintf(stderr, - "Unknown balancing mode '%s'!\n", - optarg); + wsim_err("Unknown balancing mode '%s'!\n", + optarg); return 1; } break; @@ -2460,14 +2454,12 @@ int main(int argc, char **argv) } if ((flags & HEARTBEAT) && !(flags & SEQNO)) { - if (verbose) - fprintf(stderr, "Heartbeat needs a seqno based balancer!\n"); + wsim_err("Heartbeat needs a seqno based balancer!\n"); return 1; } if ((flags & VCS2REMAP) && (flags & I915)) { - if (verbose) - fprintf(stderr, "VCS remapping not supported with i915 balancing!\n"); + wsim_err("VCS remapping not supported with i915 balancing!\n"); return 1; } @@ -2484,31 +2476,24 @@ int main(int argc, char **argv) } if (!nr_w_args) { - if (verbose) - fprintf(stderr, "No workload descriptor(s)!\n"); + wsim_err("No workload descriptor(s)!\n"); return 1; } if (nr_w_args > 1 && clients > 1) { - if (verbose) - fprintf(stderr, - "Cloned clients cannot be combined with multiple workloads!\n"); + wsim_err("Cloned clients cannot be combined with multiple workloads!\n"); return 1; } if ((flags & GLOBAL_BALANCE) && !balancer) { - if (verbose) - fprintf(stderr, - "Balancer not specified in global balancing mode!\n"); + wsim_err("Balancer not specified in global balancing mode!\n"); return 1; } if (append_workload_arg) { append_workload_arg = load_workload_descriptor(append_workload_arg); if (!append_workload_arg) { - if (verbose) - fprintf(stderr, - "Failed to load append workload descriptor!\n"); + wsim_err("Failed to load append workload descriptor!\n"); return 1; } } @@ -2517,9 +2502,7 @@ int main(int argc, char **argv) struct w_arg arg = { NULL, append_workload_arg, 0 }; app_w = parse_workload(&arg, flags, NULL); if (!app_w) { - if (verbose) - fprintf(stderr, - "Failed to parse append workload!\n"); + wsim_err("Failed to parse append workload!\n"); return 1; } } @@ -2531,18 +2514,13 @@ int main(int argc, char **argv) w_args[i].desc = load_workload_descriptor(w_args[i].filename); if (!w_args[i].desc) { - if (verbose) - fprintf(stderr, - "Failed to load workload descriptor %u!\n", - i); + wsim_err("Failed to load workload descriptor %u!\n", i); return 1; } wrk[i] = parse_workload(&w_args[i], flags, app_w); if (!wrk[i]) { - if (verbose) - fprintf(stderr, - "Failed to parse workload %u!\n", i); + wsim_err("Failed to parse workload %u!\n", i); return 1; } } @@ -2602,10 +2580,8 @@ int main(int argc, char **argv) if (balancer && balancer->init) { int ret = balancer->init(balancer, w[i]); if (ret) { - if (verbose) - fprintf(stderr, - "Failed to initialize balancing! (%u=%d)\n", - i, ret); + wsim_err("Failed to initialize balancing! (%u=%d)\n", + i, ret); return 1; } }