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 --- ....client.c.7eeddcdb2bd1344daca0a340abd305ae.html | 1036 ++++++++++++++++++++ 1 file changed, 1036 insertions(+) create mode 100644 coverage/index.client.c.7eeddcdb2bd1344daca0a340abd305ae.html (limited to 'coverage/index.client.c.7eeddcdb2bd1344daca0a340abd305ae.html') diff --git a/coverage/index.client.c.7eeddcdb2bd1344daca0a340abd305ae.html b/coverage/index.client.c.7eeddcdb2bd1344daca0a340abd305ae.html new file mode 100644 index 0000000..2c136b4 --- /dev/null +++ b/coverage/index.client.c.7eeddcdb2bd1344daca0a340abd305ae.html @@ -0,0 +1,1036 @@ + + + + + + GCC Code Coverage Report + + + + + +

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/client.c
Date:2023-08-28 07:33:56
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:435578.2%
Branches:132454.2%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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 "compiler.h"
11 + #include "const.h"
12 + #include "json_rpc.h"
13 + #include "log.h"
14 + #include "net.h"
15 + #include "protocol.h"
16 + #include "run_queue.h"
17 +
18 + #include <stdlib.h>
19 + #include <string.h>
20 +
21 + struct client {
22 + int dummy;
23 + };
24 +
25 + 9182int client_create(struct client **_client)
26 + {
27 + 9182 int ret = 0;
28 +
29 + 9182 struct client *client = malloc(sizeof(struct client));
30 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9182 times.
+
+
+
9182 if (!client) {
31 + log_errno("malloc");
32 + return -1;
33 + }
34 +
35 + 9182 *_client = client;
36 + 9182 return ret;
37 + }
38 +
39 + 9180void client_destroy(struct client *client)
40 + {
41 + 9180 free(client);
42 + 9180}
43 +
44 + 9182static int make_request(struct jsonrpc_request **request, int argc, const char **argv)
45 + {
46 +
+ 2/2 +
+
✓ Branch 0 taken 1 times.
+
✓ Branch 1 taken 9181 times.
+
+
+
9182 if (argc < 1) {
47 + 1 exit_with_usage_err("no action specified");
48 + return -1;
49 + }
50 +
51 +
+ 2/2 +
+
✓ Branch 0 taken 9180 times.
+
✓ Branch 1 taken 1 times.
+
+
+
9181 if (!strcmp(argv[0], CMD_RUN)) {
52 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (argc != 3)
53 + return -1;
54 +
55 + 9180 struct run *run = NULL;
56 + 9180 int ret = run_create(&run, 0, argv[1], argv[2]);
57 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
58 + return ret;
59 +
60 + 9180 ret = run_request_create(request, run);
61 + 9180 run_destroy(run);
62 + 9180 return ret;
63 + }
64 +
65 + 1 return -1;
66 + }
67 +
68 + 9182int client_main(UNUSED const struct client *client, const struct settings *settings, int argc,
69 + const char **argv)
70 + {
71 + 9182 int ret = 0;
72 +
73 + 9182 struct jsonrpc_request *request = NULL;
74 + 9182 ret = make_request(&request, argc, argv);
75 +
+ 2/2 +
+
✓ Branch 0 taken 1 times.
+
✓ Branch 1 taken 9180 times.
+
+
+
9181 if (ret < 0) {
76 + 1 exit_with_usage_err("invalid request");
77 + return ret;
78 + }
79 +
80 + 9180 ret = net_connect(settings->host, settings->port);
81 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
82 + goto free_request;
83 + 9180 int fd = ret;
84 +
85 + 9180 ret = jsonrpc_request_send(request, fd);
86 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
87 + goto close;
88 +
89 + 9180 struct jsonrpc_response *response = NULL;
90 + 9180 ret = jsonrpc_response_recv(&response, fd);
91 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
92 + goto close;
93 +
94 +
+ 1/2 +
+
✓ Branch 1 taken 9180 times.
+
✗ Branch 2 not taken.
+
+
+
9180 if (jsonrpc_response_is_error(response)) {
95 + log_err("server failed to process the request\n");
96 + ret = -1;
97 + goto free_response;
98 + }
99 +
100 + 9180free_response:
101 + 9180 jsonrpc_response_destroy(response);
102 +
103 + 9180close:
104 + 9180 net_close(fd);
105 +
106 + 9180free_request:
107 + 9180 jsonrpc_request_destroy(request);
108 +
109 + 9180 return ret;
110 + }
111 +
+
+ +
+ + + + -- cgit v1.2.3