From patchwork Tue Jan 19 00:26:12 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Al Stone X-Patchwork-Id: 59948 Delivered-To: patches@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2280718lbb; Mon, 18 Jan 2016 16:26:45 -0800 (PST) X-Received: by 10.202.195.17 with SMTP id t17mr20752723oif.80.1453163205398; Mon, 18 Jan 2016 16:26:45 -0800 (PST) Return-Path: Received: from mail-oi0-x22f.google.com (mail-oi0-x22f.google.com. [2607:f8b0:4003:c06::22f]) by mx.google.com with ESMTPS id s3si5066592oex.18.2016.01.18.16.26.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Jan 2016 16:26:45 -0800 (PST) Received-SPF: pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c06::22f as permitted sender) client-ip=2607:f8b0:4003:c06::22f; Authentication-Results: mx.google.com; spf=pass (google.com: domain of al.stone@linaro.org designates 2607:f8b0:4003:c06::22f as permitted sender) smtp.mailfrom=al.stone@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-oi0-x22f.google.com with SMTP id k206so185287606oia.1 for ; Mon, 18 Jan 2016 16:26:45 -0800 (PST) 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; bh=HQP/dw+m6nff4akPBwAQVwQD4UjQc0/cRBJ45PnCSeI=; b=W664xjixTEgpb4pQoOz1sWA5nrLFZ5vD2UdRpARDhcmdVrPzPm1LLTjYzyB5FjUEav 3RlAf75ksG4Fh+vaBA7A1SbMIDINt5Od4SXeCJIBsNeJ5GW3ZTJnFbFauhmHg09NousE 0cdIKlha0NO9TNbLMLfIl9lssDOgI6tdyeOgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=HQP/dw+m6nff4akPBwAQVwQD4UjQc0/cRBJ45PnCSeI=; b=SBlnrOlVlo+ueibbSUQaApiNVkK21ma3N2HTwLkPTO5rlD4rV0eqyRXJ/1hbx1/Cs1 PWWNOYt4+RxAsVJUfZETURmJ9BkI8JXgPwJBMC1EOcLeleqT+IM0oVysNNyXQbcbkoMa Bn/ruMe7AZ3Kp25+NLs0EoTgJonX+a3UQ6oB89/G1QniadKHDx05xucDqcc+f7Mb4yYQ shmqHubblIyZ2gL7qY1jbClPd29wwed4estL94oZxrcm6KsNhI9cfDN+0NOInJxquPQC ncMBtJzTcOPql4IkzUkBQ8ZCF9fvVqs1e5JqIG1egbkKXLH9o1C/dT/Ql1nYOOwtZlKL sq8g== X-Gm-Message-State: ALoCoQlhe0BKPkBo5ZcpFRNkz5Jdf5gCsHaJM39qmJ+Uz+UEzk7rY2FMXfse39GmbloQmCvlntHCZmzW2fZqmp5IVjjwYyFYrw== X-Received: by 10.202.212.141 with SMTP id l135mr18696531oig.54.1453163205096; Mon, 18 Jan 2016 16:26:45 -0800 (PST) Return-Path: Received: from fidelio.ahs3 (c-50-134-239-249.hsd1.co.comcast.net. [50.134.239.249]) by smtp.googlemail.com with ESMTPSA id y9sm14289969obg.4.2016.01.18.16.26.43 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 18 Jan 2016 16:26:43 -0800 (PST) From: Al Stone To: fwts-devel@lists.ubuntu.com Cc: linaro-acpi@lists.linaro.org, patches@linaro.org, Al Stone Subject: [PATCH v3 3/6] Add mechanism to tell FWTS what architecture is being tested Date: Mon, 18 Jan 2016 17:26:12 -0700 Message-Id: <1453163175-5801-4-git-send-email-al.stone@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1453163175-5801-1-git-send-email-al.stone@linaro.org> References: <1453163175-5801-1-git-send-email-al.stone@linaro.org> In some cases, we will want to run FWTS on one architecture, but use it test firmware tables that may be for another architecture. For example, we may want to test ACPI tables for arm64 machines on an x86 laptop. Previous patches provided the fwts_architecture as a typedef, along with some helper functions. Here, we add in framework variables for the host (the machine running FWTS) and the target (the arch of the tables being tested) and then initialize them properly. Further, we add the --arch= parameter so that the user can specify the target architecture. By default, the target will be assumed to be the same as the host. Signed-off-by: Al Stone --- src/lib/include/fwts_framework.h | 3 +++ src/lib/src/fwts_framework.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+) -- 2.5.0 diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h index a35ed19..c9ea4bb 100644 --- a/src/lib/include/fwts_framework.h +++ b/src/lib/include/fwts_framework.h @@ -26,6 +26,7 @@ typedef struct fwts_framework fwts_framework; +#include "fwts_arch.h" #include "fwts_log.h" #include "fwts_list.h" #include "fwts_acpica_mode.h" @@ -148,6 +149,8 @@ typedef struct fwts_framework { fwts_acpica_mode acpica_mode; /* ACPICA mode flags */ void *rsdp; /* ACPI RSDP address */ fwts_pm_method pm_method; + fwts_architecture host_arch; /* arch FWTS was built for */ + fwts_architecture target_arch; /* arch being tested */ } fwts_framework; typedef struct { diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c index fec444f..e3f03f6 100644 --- a/src/lib/src/fwts_framework.c +++ b/src/lib/src/fwts_framework.c @@ -127,6 +127,7 @@ static fwts_option fwts_framework_options[] = { { "acpitests", "", 0, "Run general ACPI tests." }, { "acpicompliance", "", 0, "Run ACPI tests for spec compliance." }, { "log-level", "", 1, "Specify error level to report failed test messages," }, + { "arch", "", 1, "Specify arch of the tables being tested (defaults to current host)." }, { NULL, NULL, 0, NULL } }; @@ -1127,6 +1128,22 @@ static int fwts_framework_ll_parse(fwts_framework *fw, const char *arg) return FWTS_ERROR; } +/* + * fwts_framework_an_parse() + * parse arch (architecture) name option + */ +static int fwts_framework_an_parse(fwts_framework *fw, const char *arg) +{ + fw->target_arch = fwts_arch_get_arch(arg); + if (fw->target_arch == FWTS_ARCH_OTHER) { + fprintf(stderr, "--arch can be one of: %s\n", + fwts_arch_names()); + return FWTS_ERROR; + } + + return FWTS_OK; +} + int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const argv[], int option_char, int long_index) { FWTS_UNUSED(argc); @@ -1280,6 +1297,10 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar if (fwts_framework_ll_parse(fw, optarg) != FWTS_OK) return FWTS_ERROR; break; + case 43: /* --arch */ + if (fwts_framework_an_parse(fw, optarg) != FWTS_OK) + return FWTS_ERROR; + break; } break; case 'a': /* --all */ @@ -1381,6 +1402,10 @@ int fwts_framework_args(const int argc, char **argv) /* Set the power method to FWTS_PM_UNDEFINED before we parse arguments */ fw->pm_method = FWTS_PM_UNDEFINED; + /* Set host/target test architecture defaults */ + fw->host_arch = fwts_arch_get_host(); + fw->target_arch = fw->host_arch; + ret = fwts_args_add_options(fwts_framework_options, fwts_framework_options_handler, NULL); if (ret == FWTS_ERROR)