From 31ce147c50e853f63b70048b0bbf71bb8889ca18 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Mon, 28 Aug 2023 07:43:34 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/cimp?= =?UTF-8?q?le@efb0a921609cf06080308a6a7c321d451489db8a=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...nt_main.c.0ff1a98449e6ae22cf540fe28921fa2d.html | 909 +++++++++++++++++++++ 1 file changed, 909 insertions(+) create mode 100644 coverage/index.client_main.c.0ff1a98449e6ae22cf540fe28921fa2d.html (limited to 'coverage/index.client_main.c.0ff1a98449e6ae22cf540fe28921fa2d.html') diff --git a/coverage/index.client_main.c.0ff1a98449e6ae22cf540fe28921fa2d.html b/coverage/index.client_main.c.0ff1a98449e6ae22cf540fe28921fa2d.html new file mode 100644 index 0000000..bfb102e --- /dev/null +++ b/coverage/index.client_main.c.0ff1a98449e6ae22cf540fe28921fa2d.html @@ -0,0 +1,909 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/client_main.c
Date:2023-08-28 07:33:56
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:344379.1%
Branches:101471.4%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
LineBranchExecSource
1 + /*
2 + * Copyright (c) 2022 Egor Tensin <Egor.Tensin@gmail.com>
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 "client.h"
9 + #include "cmd_line.h"
10 + #include "const.h"
11 + #include "log.h"
12 +
13 + #include <getopt.h>
14 + #include <unistd.h>
15 +
16 + 9188static struct settings default_settings(void)
17 + {
18 + 9188 struct settings settings = {
19 + .host = default_host,
20 + .port = default_port,
21 + };
22 + 9188 return settings;
23 + }
24 +
25 + 6const char *get_usage_string(void)
26 + {
27 + 6 return "[-h|--help] [-V|--version] [-v|--verbose] [-H|--host HOST] [-p|--port PORT] ACTION [ARG...]\n\
28 + \n\
29 + available actions:\n\
30 + \t" CMD_RUN " URL REV - schedule a CI run of repository at URL, revision REV";
31 + }
32 +
33 + 9188static int parse_settings(struct settings *settings, int argc, char *argv[])
34 + {
35 + int opt, longind;
36 +
37 + 9188 *settings = default_settings();
38 +
39 + /* clang-format off */
40 + static struct option long_options[] = {
41 + {"help", no_argument, 0, 'h'},
42 + {"version", no_argument, 0, 'V'},
43 + {"verbose", no_argument, 0, 'v'},
44 + {"host", required_argument, 0, 'H'},
45 + {"port", required_argument, 0, 'p'},
46 + {0, 0, 0, 0},
47 + };
48 + /* clang-format on */
49 +
50 +
+ 2/2 +
+
✓ Branch 1 taken 18370 times.
+
✓ Branch 2 taken 9182 times.
+
+
+
27552 while ((opt = getopt_long(argc, argv, "hVvH:p:", long_options, &longind)) != -1) {
51 +
+ 5/6 +
+
✓ Branch 0 taken 2 times.
+
✓ Branch 1 taken 2 times.
+
✗ Branch 2 not taken.
+
✓ Branch 3 taken 9182 times.
+
✓ Branch 4 taken 9182 times.
+
✓ Branch 5 taken 2 times.
+
+
+
18370 switch (opt) {
52 + 2 case 'h':
53 + 2 exit_with_usage(0);
54 + break;
55 + 2 case 'V':
56 + 2 exit_with_version();
57 + break;
58 + case 'v':
59 + g_log_lvl = LOG_LVL_DEBUG;
60 + break;
61 + 9182 case 'H':
62 + 9182 settings->host = optarg;
63 + 9182 break;
64 + 9182 case 'p':
65 + 9182 settings->port = optarg;
66 + 9182 break;
67 + 2 default:
68 + 2 exit_with_usage(1);
69 + break;
70 + }
71 + }
72 +
73 + 9182 return 0;
74 + }
75 +
76 + 9188int main(int argc, char *argv[])
77 + {
78 + struct settings settings;
79 + 9188 struct client *client = NULL;
80 + 9188 int ret = 0;
81 +
82 + 9188 ret = parse_settings(&settings, argc, argv);
83 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9182 times.
+
+
+
9182 if (ret < 0)
84 + return ret;
85 +
86 + 9182 ret = client_create(&client);
87 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9182 times.
+
+
+
9182 if (ret < 0)
88 + return ret;
89 +
90 + 9182 ret = client_main(client, &settings, argc - optind, (const char **)argv + optind);
91 +
+ 1/2 +
+
✓ Branch 0 taken 9180 times.
+
✗ Branch 1 not taken.
+
+
+
9180 if (ret < 0)
92 + goto destroy_client;
93 +
94 + 9180destroy_client:
95 + 9180 client_destroy(client);
96 +
97 + 9180 return ret;
98 + }
99 +
+
+ +
+ + + + -- cgit v1.2.3