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.3ca591a47eaf0cc37ef7579efe6031fe.html | 885 +++++++++++++++++++++ 1 file changed, 885 insertions(+) create mode 100644 coverage/index.server_main.c.3ca591a47eaf0cc37ef7579efe6031fe.html (limited to 'coverage/index.server_main.c.3ca591a47eaf0cc37ef7579efe6031fe.html') diff --git a/coverage/index.server_main.c.3ca591a47eaf0cc37ef7579efe6031fe.html b/coverage/index.server_main.c.3ca591a47eaf0cc37ef7579efe6031fe.html new file mode 100644 index 0000000..95b0db1 --- /dev/null +++ b/coverage/index.server_main.c.3ca591a47eaf0cc37ef7579efe6031fe.html @@ -0,0 +1,885 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/server_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 "server.h"
12 +
13 + #include <getopt.h>
14 + #include <unistd.h>
15 +
16 + 35static struct settings default_settings(void)
17 + {
18 + 35 struct settings settings = {
19 + .port = default_port,
20 + .sqlite_path = default_sqlite_path,
21 + };
22 + 35 return settings;
23 + }
24 +
25 + 4const char *get_usage_string(void)
26 + {
27 + 4 return "[-h|--help] [-V|--version] [-v|--verbose] [-p|--port PORT] [-s|--sqlite PATH]";
28 + }
29 +
30 + 35static int parse_settings(struct settings *settings, int argc, char *argv[])
31 + {
32 + int opt, longind;
33 +
34 + 35 *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 + {"port", required_argument, 0, 'p'},
42 + {"sqlite", required_argument, 0, 's'},
43 + {0, 0, 0, 0},
44 + };
45 + /* clang-format on */
46 +
47 +
+ 2/2 +
+
✓ Branch 1 taken 64 times.
+
✓ Branch 2 taken 29 times.
+
+
+
93 while ((opt = getopt_long(argc, argv, "hVvp:s:", long_options, &longind)) != -1) {
48 +
+ 5/6 +
+
✓ Branch 0 taken 2 times.
+
✓ Branch 1 taken 2 times.
+
✗ Branch 2 not taken.
+
✓ Branch 3 taken 29 times.
+
✓ Branch 4 taken 29 times.
+
✓ Branch 5 taken 2 times.
+
+
+
64 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 + 29 case 'p':
59 + 29 settings->port = optarg;
60 + 29 break;
61 + 29 case 's':
62 + 29 settings->sqlite_path = optarg;
63 + 29 break;
64 + 2 default:
65 + 2 exit_with_usage(1);
66 + break;
67 + }
68 + }
69 +
70 + 29 return 0;
71 + }
72 +
73 + 35int main(int argc, char *argv[])
74 + {
75 + struct settings settings;
76 + 35 struct server *server = NULL;
77 + 35 int ret = 0;
78 +
79 + 35 ret = parse_settings(&settings, argc, argv);
80 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 29 times.
+
+
+
29 if (ret < 0)
81 + return ret;
82 +
83 + 29 ret = server_create(&server, &settings);
84 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 29 times.
+
+
+
29 if (ret < 0)
85 + return ret;
86 +
87 + 29 ret = server_main(server);
88 +
+ 1/2 +
+
✓ Branch 0 taken 29 times.
+
✗ Branch 1 not taken.
+
+
+
29 if (ret < 0)
89 + goto destroy_server;
90 +
91 + 29destroy_server:
92 + 29 server_destroy(server);
93 +
94 + 29 return ret;
95 + }
96 +
+
+ +
+ + + + -- cgit v1.2.3