diff mbox

lib: framework: Add "unsafe" test category

Message ID 1346924070-16438-1-git-send-email-colin.king@canonical.com
State Accepted
Headers show

Commit Message

Colin Ian King Sept. 6, 2012, 9:34 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Some tests we may add in the future (such as UEFI run time services)
can cause the kernel to oops if the firmware is buggy, so we should
add a new "unsafe" test category for these kinds of tests. Currently
there are no "unsafe" tests in fwts, so this does not make any difference
to output to fwts --show-tests until we start adding the actual tests,
so this is a fairly benign addition.

Also add the --unsafe and -U option to run unsafe tests.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/lib/include/fwts_framework.h |    2 ++
 src/lib/src/fwts_framework.c     |   11 ++++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

Comments

Alex Hung Sept. 10, 2012, 1:42 a.m. UTC | #1
On 09/06/2012 05:34 PM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Some tests we may add in the future (such as UEFI run time services)
> can cause the kernel to oops if the firmware is buggy, so we should
> add a new "unsafe" test category for these kinds of tests. Currently
> there are no "unsafe" tests in fwts, so this does not make any difference
> to output to fwts --show-tests until we start adding the actual tests,
> so this is a fairly benign addition.
>
> Also add the --unsafe and -U option to run unsafe tests.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>   src/lib/include/fwts_framework.h |    2 ++
>   src/lib/src/fwts_framework.c     |   11 ++++++++++-
>   2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
> index de28612..ad490c7 100644
> --- a/src/lib/include/fwts_framework.h
> +++ b/src/lib/include/fwts_framework.h
> @@ -42,6 +42,7 @@ typedef enum {
>   	FWTS_FRAMEWORK_FLAGS_INTERACTIVE_EXPERIMENTAL  = 0x00008000,
>   	FWTS_FRAMEWORK_FLAGS_POWER_STATES              = 0x00010000,
>   	FWTS_FRAMEWORK_FLAGS_ROOT_PRIV		       = 0x00020000,
> +	FWTS_FRAMEWORK_FLAGS_UNSAFE		       = 0x00040000,
>   	FWTS_FRAMEWORK_FLAGS_TEST_BIOS		       = 0x01000000,
>   	FWTS_FRAMEWORK_FLAGS_TEST_UEFI		       = 0x02000000,
>   	FWTS_FRAMEWORK_FLAGS_TEST_ACPI		       = 0x04000000,
> @@ -235,6 +236,7 @@ static inline int fwts_tests_passed(const fwts_framework *fw)
>   #define FWTS_POWER_STATES		FWTS_FRAMEWORK_FLAGS_POWER_STATES
>   #define FWTS_UTILS			FWTS_FRAMEWORK_FLAGS_UTILS
>   #define FWTS_ROOT_PRIV			FWTS_FRAMEWORK_FLAGS_ROOT_PRIV
> +#define FWTS_UNSAFE			FWTS_FRAMEWORK_FLAGS_UNSAFE
>
>   #define FWTS_TEST_BIOS			FWTS_FRAMEWORK_FLAGS_TEST_BIOS
>   #define FWTS_TEST_UEFI			FWTS_FRAMEWORK_FLAGS_TEST_UEFI
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index c6536a6..1ad3d0d 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -37,7 +37,8 @@
>   	 FWTS_BATCH_EXPERIMENTAL |	\
>   	 FWTS_INTERACTIVE_EXPERIMENTAL |\
>   	 FWTS_POWER_STATES |		\
> -	 FWTS_UTILS)
> +	 FWTS_UTILS |			\
> +	 FWTS_UNSAFE)
>
>   #define FWTS_ARGS_WIDTH 	28
>   #define FWTS_MIN_TTY_WIDTH	50
> @@ -78,6 +79,7 @@ static fwts_option fwts_framework_options[] = {
>   	{ "lp-tags-log", 	"",   0, "Output LaunchPad bug tags in results log." },
>   	{ "disassemble-aml", 	"",   0, "Disassemble AML from DSDT and SSDT tables." },
>   	{ "log-type",		"",   1, "Specify log type (plaintext, json, html or xml)." },
> +	{ "unsafe",		"U",  0, "Unsafe tests (tests that can potentially cause kernel oopses." },
>   	{ NULL, NULL, 0, NULL }
>   };
>
> @@ -230,6 +232,7 @@ static void fwts_framework_show_tests(fwts_framework *fw, bool full)
>   		{ "Interactive Experimental",	FWTS_INTERACTIVE_EXPERIMENTAL },
>   		{ "Power States",		FWTS_POWER_STATES },
>   		{ "Utilities",			FWTS_UTILS },
> +		{ "Unsafe",			FWTS_UNSAFE },
>   		{ NULL,				0 },
>   	};
>
> @@ -984,6 +987,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
>   			if (fwts_framework_log_type_parse(fw, optarg) != FWTS_OK)
>   				return FWTS_ERROR;
>   			break;
> +		case 33: /* --unsafe */
> +			fw->flags |= FWTS_FRAMEWORK_FLAGS_UNSAFE;
> +			break;
>   		}
>   		break;
>   	case 'a': /* --all */
> @@ -1051,6 +1057,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
>   	case 'u': /* --utils */
>   		fw->flags |= FWTS_FRAMEWORK_FLAGS_UTILS;
>   		break;
> +	case 'U': /* --unsafe */
> +		fw->flags |= FWTS_FRAMEWORK_FLAGS_UNSAFE;
> +		break;
>   	case 'v': /* --version */
>   		fwts_framework_show_version(stdout, argv[0]);
>   		return FWTS_COMPLETE;
>
Acked-by: Alex Hung <alex.hung@canonical.com>
Keng-Yu Lin Sept. 11, 2012, 6:15 a.m. UTC | #2
On Thu, Sep 6, 2012 at 5:34 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> Some tests we may add in the future (such as UEFI run time services)
> can cause the kernel to oops if the firmware is buggy, so we should
> add a new "unsafe" test category for these kinds of tests. Currently
> there are no "unsafe" tests in fwts, so this does not make any difference
> to output to fwts --show-tests until we start adding the actual tests,
> so this is a fairly benign addition.
>
> Also add the --unsafe and -U option to run unsafe tests.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/lib/include/fwts_framework.h |    2 ++
>  src/lib/src/fwts_framework.c     |   11 ++++++++++-
>  2 files changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
> index de28612..ad490c7 100644
> --- a/src/lib/include/fwts_framework.h
> +++ b/src/lib/include/fwts_framework.h
> @@ -42,6 +42,7 @@ typedef enum {
>         FWTS_FRAMEWORK_FLAGS_INTERACTIVE_EXPERIMENTAL  = 0x00008000,
>         FWTS_FRAMEWORK_FLAGS_POWER_STATES              = 0x00010000,
>         FWTS_FRAMEWORK_FLAGS_ROOT_PRIV                 = 0x00020000,
> +       FWTS_FRAMEWORK_FLAGS_UNSAFE                    = 0x00040000,
>         FWTS_FRAMEWORK_FLAGS_TEST_BIOS                 = 0x01000000,
>         FWTS_FRAMEWORK_FLAGS_TEST_UEFI                 = 0x02000000,
>         FWTS_FRAMEWORK_FLAGS_TEST_ACPI                 = 0x04000000,
> @@ -235,6 +236,7 @@ static inline int fwts_tests_passed(const fwts_framework *fw)
>  #define FWTS_POWER_STATES              FWTS_FRAMEWORK_FLAGS_POWER_STATES
>  #define FWTS_UTILS                     FWTS_FRAMEWORK_FLAGS_UTILS
>  #define FWTS_ROOT_PRIV                 FWTS_FRAMEWORK_FLAGS_ROOT_PRIV
> +#define FWTS_UNSAFE                    FWTS_FRAMEWORK_FLAGS_UNSAFE
>
>  #define FWTS_TEST_BIOS                 FWTS_FRAMEWORK_FLAGS_TEST_BIOS
>  #define FWTS_TEST_UEFI                 FWTS_FRAMEWORK_FLAGS_TEST_UEFI
> diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
> index c6536a6..1ad3d0d 100644
> --- a/src/lib/src/fwts_framework.c
> +++ b/src/lib/src/fwts_framework.c
> @@ -37,7 +37,8 @@
>          FWTS_BATCH_EXPERIMENTAL |      \
>          FWTS_INTERACTIVE_EXPERIMENTAL |\
>          FWTS_POWER_STATES |            \
> -        FWTS_UTILS)
> +        FWTS_UTILS |                   \
> +        FWTS_UNSAFE)
>
>  #define FWTS_ARGS_WIDTH        28
>  #define FWTS_MIN_TTY_WIDTH     50
> @@ -78,6 +79,7 @@ static fwts_option fwts_framework_options[] = {
>         { "lp-tags-log",        "",   0, "Output LaunchPad bug tags in results log." },
>         { "disassemble-aml",    "",   0, "Disassemble AML from DSDT and SSDT tables." },
>         { "log-type",           "",   1, "Specify log type (plaintext, json, html or xml)." },
> +       { "unsafe",             "U",  0, "Unsafe tests (tests that can potentially cause kernel oopses." },
>         { NULL, NULL, 0, NULL }
>  };
>
> @@ -230,6 +232,7 @@ static void fwts_framework_show_tests(fwts_framework *fw, bool full)
>                 { "Interactive Experimental",   FWTS_INTERACTIVE_EXPERIMENTAL },
>                 { "Power States",               FWTS_POWER_STATES },
>                 { "Utilities",                  FWTS_UTILS },
> +               { "Unsafe",                     FWTS_UNSAFE },
>                 { NULL,                         0 },
>         };
>
> @@ -984,6 +987,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
>                         if (fwts_framework_log_type_parse(fw, optarg) != FWTS_OK)
>                                 return FWTS_ERROR;
>                         break;
> +               case 33: /* --unsafe */
> +                       fw->flags |= FWTS_FRAMEWORK_FLAGS_UNSAFE;
> +                       break;
>                 }
>                 break;
>         case 'a': /* --all */
> @@ -1051,6 +1057,9 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
>         case 'u': /* --utils */
>                 fw->flags |= FWTS_FRAMEWORK_FLAGS_UTILS;
>                 break;
> +       case 'U': /* --unsafe */
> +               fw->flags |= FWTS_FRAMEWORK_FLAGS_UNSAFE;
> +               break;
>         case 'v': /* --version */
>                 fwts_framework_show_version(stdout, argv[0]);
>                 return FWTS_COMPLETE;
> --
> 1.7.10.4
>
Acked-by: Keng-Yu Lin <kengyu@canonical.com>
diff mbox

Patch

diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
index de28612..ad490c7 100644
--- a/src/lib/include/fwts_framework.h
+++ b/src/lib/include/fwts_framework.h
@@ -42,6 +42,7 @@  typedef enum {
 	FWTS_FRAMEWORK_FLAGS_INTERACTIVE_EXPERIMENTAL  = 0x00008000,
 	FWTS_FRAMEWORK_FLAGS_POWER_STATES              = 0x00010000,
 	FWTS_FRAMEWORK_FLAGS_ROOT_PRIV		       = 0x00020000,
+	FWTS_FRAMEWORK_FLAGS_UNSAFE		       = 0x00040000,
 	FWTS_FRAMEWORK_FLAGS_TEST_BIOS		       = 0x01000000,
 	FWTS_FRAMEWORK_FLAGS_TEST_UEFI		       = 0x02000000,
 	FWTS_FRAMEWORK_FLAGS_TEST_ACPI		       = 0x04000000,
@@ -235,6 +236,7 @@  static inline int fwts_tests_passed(const fwts_framework *fw)
 #define FWTS_POWER_STATES		FWTS_FRAMEWORK_FLAGS_POWER_STATES
 #define FWTS_UTILS			FWTS_FRAMEWORK_FLAGS_UTILS
 #define FWTS_ROOT_PRIV			FWTS_FRAMEWORK_FLAGS_ROOT_PRIV
+#define FWTS_UNSAFE			FWTS_FRAMEWORK_FLAGS_UNSAFE
 
 #define FWTS_TEST_BIOS			FWTS_FRAMEWORK_FLAGS_TEST_BIOS
 #define FWTS_TEST_UEFI			FWTS_FRAMEWORK_FLAGS_TEST_UEFI
diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index c6536a6..1ad3d0d 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -37,7 +37,8 @@ 
 	 FWTS_BATCH_EXPERIMENTAL |	\
 	 FWTS_INTERACTIVE_EXPERIMENTAL |\
 	 FWTS_POWER_STATES |		\
-	 FWTS_UTILS)
+	 FWTS_UTILS |			\
+	 FWTS_UNSAFE)
 
 #define FWTS_ARGS_WIDTH 	28
 #define FWTS_MIN_TTY_WIDTH	50
@@ -78,6 +79,7 @@  static fwts_option fwts_framework_options[] = {
 	{ "lp-tags-log", 	"",   0, "Output LaunchPad bug tags in results log." },
 	{ "disassemble-aml", 	"",   0, "Disassemble AML from DSDT and SSDT tables." },
 	{ "log-type",		"",   1, "Specify log type (plaintext, json, html or xml)." },
+	{ "unsafe",		"U",  0, "Unsafe tests (tests that can potentially cause kernel oopses." },
 	{ NULL, NULL, 0, NULL }
 };
 
@@ -230,6 +232,7 @@  static void fwts_framework_show_tests(fwts_framework *fw, bool full)
 		{ "Interactive Experimental",	FWTS_INTERACTIVE_EXPERIMENTAL },
 		{ "Power States",		FWTS_POWER_STATES },
 		{ "Utilities",			FWTS_UTILS },
+		{ "Unsafe",			FWTS_UNSAFE },
 		{ NULL,				0 },
 	};
 
@@ -984,6 +987,9 @@  int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
 			if (fwts_framework_log_type_parse(fw, optarg) != FWTS_OK)
 				return FWTS_ERROR;
 			break;
+		case 33: /* --unsafe */
+			fw->flags |= FWTS_FRAMEWORK_FLAGS_UNSAFE;
+			break;
 		}
 		break;
 	case 'a': /* --all */
@@ -1051,6 +1057,9 @@  int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
 	case 'u': /* --utils */
 		fw->flags |= FWTS_FRAMEWORK_FLAGS_UTILS;
 		break;
+	case 'U': /* --unsafe */
+		fw->flags |= FWTS_FRAMEWORK_FLAGS_UNSAFE;
+		break;
 	case 'v': /* --version */
 		fwts_framework_show_version(stdout, argv[0]);
 		return FWTS_COMPLETE;