tool: hal-compatibility-checker: Add option --reset to remove result file 58/313158/3 accepted/tizen/unified/20240621.010407 accepted/tizen/unified/toolchain/20240624.121430 accepted/tizen/unified/x/20240624.031935 accepted/tizen/unified/x/asan/20240625.092340
authorYoungjae Cho <y0.cho@samsung.com>
Wed, 19 Jun 2024 11:14:01 +0000 (20:14 +0900)
committerYoungjae Cho <y0.cho@samsung.com>
Wed, 19 Jun 2024 11:21:55 +0000 (20:21 +0900)
Change-Id: I023148c4534625a073282324e7567b26e54fe5d2
Signed-off-by: Youngjae Cho <y0.cho@samsung.com>
tools/hal-compatibility-checker/main.c

index c4eb3e6fecc912e687e2fea27ef78972b41c4bc4..754c0a5d55baaf37651fc36484f06f970600d435 100644 (file)
@@ -44,6 +44,7 @@ enum {
        OPT_REDIRECT_ALL,
        OPT_REDIRECT_STDOUT,
        OPT_REDIRECT_STDERR,
+       OPT_RESET,
        OPT_END,
 };
 
@@ -63,6 +64,9 @@ static const struct option long_option[] = {
        [OPT_REDIRECT_STDERR]
                = { "redirect-stderr",  required_argument,      NULL,   0 },
 
+       [OPT_RESET]
+               = { "reset",    no_argument,    NULL,   0 },
+
        { 0, },
 };
 
@@ -154,6 +158,9 @@ static void show_help(void)
                "\n"
                "\t--redirect-stderr=FILE|dlog\n"
                "\t\tredirect stderr to FILE or dlog with tag "LOG_TAG_HAL_COMPATIBILITY_CHECKER".\n"
+               "\n"
+               "\t--reset\n"
+               "\t\tremove the existing result file.\n"
          );
 }
 
@@ -163,6 +170,7 @@ int main(int argc, char *argv[])
        int help = 0;
        int index;
        bool skip_if_result_exist = false;
+       bool reset_file = false;
        const char *skip_if_result_exist_dir = NULL;
        const char *platform_manifest_dir = NULL;
        const char *outfile = NULL;
@@ -194,6 +202,9 @@ int main(int argc, char *argv[])
                        case OPT_REDIRECT_STDERR:
                                errfile = optarg;
                                break;
+                       case OPT_RESET:
+                               reset_file = true;
+                               break;
                        default:
                                break;
                        }
@@ -221,6 +232,11 @@ int main(int argc, char *argv[])
                return 0;
        }
 
+       if (reset_file) {
+               unlink("/opt/etc/hal/.hal-compatibility-checker");
+               return 0;
+       }
+
        for (enum hal_module module = 0; module < HAL_MODULE_END; ++module) {
                enum hal_common_backend_compatibility compatibility;
                char module_name[128] = "Unknown";