From d1cd99244f96bd95bbd67cc737248df346dec08b Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Thu, 25 Apr 2024 03:50:51 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@8e652dd2cb69928ea1596aa3e59845fef6854e2c=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...er_main.c.3e96ea0429977547c8b5eee564591fe0.html | 885 +++++++++++++++++++++ 1 file changed, 885 insertions(+) create mode 100644 coverage/index.worker_main.c.3e96ea0429977547c8b5eee564591fe0.html (limited to 'coverage/index.worker_main.c.3e96ea0429977547c8b5eee564591fe0.html') diff --git a/coverage/index.worker_main.c.3e96ea0429977547c8b5eee564591fe0.html b/coverage/index.worker_main.c.3e96ea0429977547c8b5eee564591fe0.html new file mode 100644 index 0000000..a7f416f --- /dev/null +++ b/coverage/index.worker_main.c.3e96ea0429977547c8b5eee564591fe0.html @@ -0,0 +1,885 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/worker_main.c
Date:2024-04-25 03:45:42
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:344379.1%
Branches:101471.4%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2022 Egor Tensin <egor@tensin.name>
3 + * This file is part of the "cimple" project.
4 + * For details, see https://github.com/egor-tensin/cimple.
5 + * Distributed under the MIT License.
6 + */
7 +
8 + #include "cmd_line.h"
9 + #include "const.h"
10 + #include "log.h"
11 + #include "worker.h"
12 +
13 + #include <getopt.h>
14 + #include <unistd.h>
15 +
16 + 60static struct settings default_settings(void)
17 + {
18 + 60 struct settings settings = {
19 + .host = default_host,
20 + .port = default_port,
21 + };
22 + 60 return settings;
23 + }
24 +
25 + 4const char *get_usage_string(void)
26 + {
27 + 4 return "[-h|--help] [-V|--version] [-v|--verbose] [-H|--host HOST] [-p|--port PORT]";
28 + }
29 +
30 + 60static int parse_settings(struct settings *settings, int argc, char *argv[])
31 + {
32 + int opt, longind;
33 +
34 + 60 *settings = default_settings();
35 +
36 + /* clang-format off */
37 + static struct option long_options[] = {
38 + {"help", no_argument, 0, 'h'},
39 + {"version", no_argument, 0, 'V'},
40 + {"verbose", no_argument, 0, 'v'},
41 + {"host", required_argument, 0, 'H'},
42 + {"port", required_argument, 0, 'p'},
43 + {0, 0, 0, 0},
44 + };
45 + /* clang-format on */
46 +
47 +
+ 2/2 +
+
✓ Branch 1 taken 114 times.
+
✓ Branch 2 taken 54 times.
+
+
+
168 while ((opt = getopt_long(argc, argv, "hVvH:p:", long_options, &longind)) != -1) {
48 +
+ 5/6 +
+
✓ Branch 0 taken 2 times.
+
✓ Branch 1 taken 2 times.
+
✗ Branch 2 not taken.
+
✓ Branch 3 taken 54 times.
+
✓ Branch 4 taken 54 times.
+
✓ Branch 5 taken 2 times.
+
+
+
114 switch (opt) {
49 + 2 case 'h':
50 + 2 exit_with_usage(0);
51 + break;
52 + 2 case 'V':
53 + 2 exit_with_version();
54 + break;
55 + case 'v':
56 + g_log_lvl = LOG_LVL_DEBUG;
57 + break;
58 + 54 case 'H':
59 + 54 settings->host = optarg;
60 + 54 break;
61 + 54 case 'p':
62 + 54 settings->port = optarg;
63 + 54 break;
64 + 2 default:
65 + 2 exit_with_usage(1);
66 + break;
67 + }
68 + }
69 +
70 + 54 return 0;
71 + }
72 +
73 + 60int main(int argc, char *argv[])
74 + {
75 + struct settings settings;
76 + 60 struct worker *worker = NULL;
77 + 60 int ret = 0;
78 +
79 + 60 ret = parse_settings(&settings, argc, argv);
80 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 54 times.
+
+
+
54 if (ret < 0)
81 + return ret;
82 +
83 + 54 ret = worker_create(&worker, &settings);
84 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 54 times.
+
+
+
54 if (ret < 0)
85 + return ret;
86 +
87 + 54 ret = worker_main(worker);
88 +
+ 1/2 +
+
✓ Branch 0 taken 54 times.
+
✗ Branch 1 not taken.
+
+
+
54 if (ret < 0)
89 + goto destroy_worker;
90 +
91 + 54destroy_worker:
92 + 54 worker_destroy(worker);
93 +
94 + 54 return ret;
95 + }
96 +
+
+ +
+ + + + -- cgit v1.2.3