ACK: [PATCH 1/1] Add in the notion of ACPI compliance tests.
ivanhu
ivan.hu at canonical.com
Thu Nov 5 02:27:00 UTC 2015
On 2015年10月24日 05:07, Al Stone wrote:
> This patch adds in the --acpicompliance option. The idea behind this
> is to use existing ACPI tests, and add to them a number of more specific
> tests that are designed to verify that the ACPI tables being used are in
> compliance with the ACPI specification.
>
> This is not the same as --acpitests. In that case, we are generally looking
> for issues in ACPI tables that we have seen in the past and we want to be
> sure not to see them again. In some cases, those are violations of the spec,
> but they are not necessarily so.
>
> There are no tests added by this patch, but just the framework needed to
> be able to add them in subsequent patch sets.
>
> Signed-off-by: Al Stone <al.stone at linaro.org>
> ---
> README_SOURCE.txt | 1 +
> src/lib/include/fwts_framework.h | 9 +++++----
> src/lib/src/fwts_framework.c | 15 +++++++++++----
> 3 files changed, 17 insertions(+), 8 deletions(-)
>
> diff --git a/README_SOURCE.txt b/README_SOURCE.txt
> index 535bace..671dd89 100644
> --- a/README_SOURCE.txt
> +++ b/README_SOURCE.txt
> @@ -157,6 +157,7 @@ where:
> FWTS_TEST_BIOS BIOS specific
> FWTS_TEST_UEFI UEFI specific
> FWTS_TEST_ACPI ACPI specific
> + FWTS_TEST_ACPI_COMPLIANCE Test for ACPI spec compliance
>
> so, we can have FWTS_BATCH | FWTS_ROOT_PRIV | FWTS_ACPI
> for a batch test that requires root privilege and is an ACPI
> diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
> index cdf9f98..7883339 100644
> --- a/src/lib/include/fwts_framework.h
> +++ b/src/lib/include/fwts_framework.h
> @@ -53,7 +53,8 @@ typedef enum {
> FWTS_FLAG_UTILS = 0x08000000,
> FWTS_FLAG_QUIET = 0x10000000,
> FWTS_FLAG_SHOW_TESTS_FULL = 0x20000000,
> - FWTS_FLAG_SHOW_TESTS_CATEGORIES = 0x40000000
> + FWTS_FLAG_SHOW_TESTS_CATEGORIES = 0x40000000,
> + FWTS_FLAG_TEST_COMPLIANCE_ACPI = 0x100000000
> } fwts_framework_flags;
>
> #define FWTS_FLAG_TEST_MASK \
> @@ -163,7 +164,7 @@ typedef struct {
> typedef struct fwts_framework_ops {
> char *description; /* description of test */
> int (*init)(fwts_framework *); /* Initialise */
> - int (*deinit)(fwts_framework *); /* De-init */
> + int (*deinit)(fwts_framework *); /* De-init */
> int (*getopts)(fwts_framework *, int argc, char **argv); /* Arg handling */
> fwts_option *options;
> fwts_args_optarg_handler options_handler;
> @@ -248,10 +249,10 @@ static inline int fwts_tests_passed(const fwts_framework *fw)
> #define FWTS_ARRAY_LEN(s) (sizeof(s)/sizeof(s[0]))
>
> /*
> - * FWTS_ASSERT(test, message)
> + * FWTS_ASSERT(test, message)
> * compile time assertion that throws a division by zero
> * error to stop compilation if condition "test" is not true.
> - * See http://www.pixelbeat.org/programming/gcc/static_assert.html
> + * See http://www.pixelbeat.org/programming/gcc/static_assert.html
> *
> */
> #define FWTS_CONCAT(a, b) a ## b
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index b74d3e5..9739c7b 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -40,6 +40,7 @@ typedef struct {
> #define RESULTS_LOG "results"
>
> #define FWTS_FLAG_RUN_ALL \
> + (fwts_framework_flags) \
> (FWTS_FLAG_BATCH | \
> FWTS_FLAG_INTERACTIVE | \
> FWTS_FLAG_BATCH_EXPERIMENTAL | \
> @@ -48,7 +49,8 @@ typedef struct {
> FWTS_FLAG_UTILS | \
> FWTS_FLAG_UNSAFE | \
> FWTS_FLAG_TEST_UEFI | \
> - FWTS_FLAG_TEST_ACPI)
> + FWTS_FLAG_TEST_ACPI | \
> + FWTS_FLAG_TEST_COMPLIANCE_ACPI)
>
> static fwts_categories categories[] = {
> { "ACPI", FWTS_FLAG_TEST_ACPI },
> @@ -60,6 +62,7 @@ static fwts_categories categories[] = {
> { "Utilities", FWTS_FLAG_UTILS },
> { "Unsafe", FWTS_FLAG_UNSAFE },
> { "UEFI", FWTS_FLAG_TEST_UEFI },
> + { "ACPI Spec Compliance", FWTS_FLAG_TEST_COMPLIANCE_ACPI },
> { NULL, 0 },
> };
>
> @@ -106,7 +109,8 @@ static fwts_option fwts_framework_options[] = {
> { "rsdp", "R:", 1, "Specify the physical address of the ACPI RSDP." },
> { "pm-method", "", 1, "Select the power method to use. Accepted values are \"logind\", \"pm-utils\", \"sysfs\""},
> { "show-tests-categories","", 0, "Show tests and associated categories." },
> - { "acpitests", "", 0, "Run ACPI tests." },
> + { "acpitests", "", 0, "Run general ACPI tests." },
> + { "acpicompliance", "", 0, "Run ACPI tests for spec compliance." },
> { NULL, NULL, 0, NULL }
> };
>
> @@ -147,7 +151,7 @@ void fwts_framework_test_add(
> fwts_framework_test *new_test;
>
> if (flags & ~(FWTS_FLAG_RUN_ALL | FWTS_FLAG_ROOT_PRIV)) {
> - fprintf(stderr, "Test %s flags must be a bit field in 0x%x, got %x\n",
> + fprintf(stderr, "Test %s flags must be a bit field in 0x%lx, got 0x%lx\n",
> name, FWTS_FLAG_RUN_ALL, flags);
> exit(EXIT_FAILURE);
> }
> @@ -159,7 +163,7 @@ void fwts_framework_test_add(
> }
>
> /* Total up minor tests in this test */
> - for (ops->total_tests = 0;
> + for (ops->total_tests = 0;
> ops->minor_tests[ops->total_tests].test_func != NULL;
> ops->total_tests++)
> ;
> @@ -1230,6 +1234,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
> case 40: /* --acpitests */
> fw->flags |= FWTS_FLAG_TEST_ACPI;
> break;
> + case 41: /* --acpicompliance */
> + fw->flags |= FWTS_FLAG_TEST_COMPLIANCE_ACPI;
> + break;
> }
> break;
> case 'a': /* --all */
>
Acked-by: Ivan Hu <ivan.hu at canonical.com>
More information about the fwts-devel
mailing list