[PATCH] fwts: Better options handling for --dump

Anthony Wong anthony.wong at canonical.com
Wed Jul 22 05:16:43 UTC 2015


If --dump was given as the first option, it ignored --lspci or
--dumpfile. Correct this so that the order of these options does not
matter.

Signed-off-by: Anthony Wong <anthony.wong at canonical.com>
---
 src/lib/include/fwts_framework.h |  1 +
 src/lib/src/fwts_framework.c     | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/lib/include/fwts_framework.h b/src/lib/include/fwts_framework.h
index 40554a6..cdf9f98 100644
--- a/src/lib/include/fwts_framework.h
+++ b/src/lib/include/fwts_framework.h
@@ -39,6 +39,7 @@ typedef enum {
 	FWTS_FLAG_SHOW_TESTS			= 0x00000008,
 	FWTS_FLAG_SHOW_PROGRESS_DIALOG		= 0x00000010,
 	FWTS_FLAG_ACPICA_DEBUG			= 0x00000020,
+	FWTS_FLAG_DUMP				= 0x00000040,
 	FWTS_FLAG_BATCH				= 0x00001000,
 	FWTS_FLAG_INTERACTIVE			= 0x00002000,
 	FWTS_FLAG_BATCH_EXPERIMENTAL		= 0x00004000,
diff --git a/src/lib/src/fwts_framework.c b/src/lib/src/fwts_framework.c
index 92431a9..c3f1dea 100644
--- a/src/lib/src/fwts_framework.c
+++ b/src/lib/src/fwts_framework.c
@@ -1146,8 +1146,8 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
 			fwts_framework_show_version(stdout, argv[0]);
 			return FWTS_COMPLETE;
 		case 16: /* --dump */
-			fwts_dump_info(fw);
-			return FWTS_COMPLETE;
+			fw->flags |= FWTS_FLAG_DUMP;
+			break;
 		case 17: /* --table-path */
 			fwts_framework_strdup(&fw->acpi_table_path, optarg);
 			break;
@@ -1241,8 +1241,8 @@ int fwts_framework_options_handler(fwts_framework *fw, int argc, char * const ar
 		fw->flags |= FWTS_FLAG_BATCH;
 		break;
 	case 'd': /* --dump */
-		fwts_dump_info(fw);
-		return FWTS_COMPLETE;
+		fw->flags |= FWTS_FLAG_DUMP;
+		break;
 	case 'D': /* --show-progress-dialog */
 		fw->flags = (fw->flags &
 				~(FWTS_FLAG_QUIET |
@@ -1388,6 +1388,10 @@ int fwts_framework_args(const int argc, char **argv)
 		fwts_framework_show_tests_categories();
 		goto tidy_close;
 	}
+	if (fw->flags & FWTS_FLAG_DUMP) {
+		fwts_dump_info(fw);
+		goto tidy_close;
+	}
 	if ((fw->flags & FWTS_FLAG_RUN_ALL) == 0)
 		fw->flags |= FWTS_FLAG_BATCH;
 	if ((fw->lspci == NULL) || (fw->results_logname == NULL)) {
-- 
1.9.1




More information about the fwts-devel mailing list