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

GCC Code Coverage Report

+ +
+ +
+
+ + + + + + + + + + + + + +
Directory:src/
File:src/ci.c
Date:2024-04-25 03:45:42
+
+
+ + + + + + + + + + + + + + + + + + + +
ExecTotalCoverage
Lines:374778.7%
Branches:91850.0%
+
+
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
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 "ci.h"
9 + #include "file.h"
10 + #include "git.h"
11 + #include "log.h"
12 + #include "process.h"
13 +
14 + #include <git2.h>
15 + #include <stddef.h>
16 + #include <stdlib.h>
17 +
18 + /* clang-format off */
19 + static const char *ci_scripts[] = {
20 + "./.ci.sh",
21 + "./.ci",
22 + "./ci.sh",
23 + "./ci",
24 + NULL,
25 + };
26 +
27 + static const char *ci_env[] = {
28 + "CI=y",
29 + "CIMPLE=y",
30 + NULL,
31 + };
32 + /* clang-format on */
33 +
34 + 9180static int ci_run_script(const char *script, struct proc_output *result)
35 + {
36 + 9180 const char *args[] = {script, NULL};
37 + 9180 return proc_capture(args, ci_env, result);
38 + }
39 +
40 + 9180int ci_run(struct proc_output *result)
41 + {
42 +
+ 1/2 +
+
✓ Branch 0 taken 36720 times.
+
✗ Branch 1 not taken.
+
+
+
36720 for (const char **script = ci_scripts; *script; ++script) {
43 +
+ 2/2 +
+
✓ Branch 1 taken 27540 times.
+
✓ Branch 2 taken 9180 times.
+
+
+
36720 if (!file_exists(*script))
44 + 27540 continue;
45 +
+ 1/2 +
+
✗ Branch 1 not taken.
+
✓ Branch 2 taken 9180 times.
+
+
+
9180 log("Going to run: %s\n", *script);
46 + 9180 return ci_run_script(*script, result);
47 + }
48 +
49 + log("Couldn't find any CI scripts to run\n");
50 + return -1;
51 + }
52 +
53 + 9180static void ci_cleanup_git_repo(git_repository *repo)
54 + {
55 + 9180 rm_rf(git_repository_workdir(repo));
56 + 9180 libgit_repository_free(repo);
57 + 9180}
58 +
59 + 9180static int ci_prepare_git_repo(git_repository **repo, const char *url, const char *rev)
60 + {
61 + 9180 int ret = 0;
62 +
63 + 9180 ret = libgit_clone_to_tmp(repo, url);
64 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
65 + return ret;
66 +
67 + 9180 ret = libgit_checkout(*repo, rev);
68 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
69 + goto cleanup_repo;
70 +
71 + 9180 return ret;
72 +
73 + cleanup_repo:
74 + ci_cleanup_git_repo(*repo);
75 +
76 + return ret;
77 + }
78 +
79 + 9180int ci_run_git_repo(const char *url, const char *rev, struct proc_output *output)
80 + {
81 + 9180 char *oldpwd = NULL;
82 + 9180 git_repository *repo = NULL;
83 + 9180 int ret = 0;
84 +
85 + 9180 ret = ci_prepare_git_repo(&repo, url, rev);
86 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
87 + goto exit;
88 +
89 + 9180 ret = my_chdir(git_repository_workdir(repo), &oldpwd);
90 +
+ 1/2 +
+
✗ Branch 0 not taken.
+
✓ Branch 1 taken 9180 times.
+
+
+
9180 if (ret < 0)
91 + goto free_repo;
92 +
93 + 9180 ret = ci_run(output);
94 +
+ 1/2 +
+
✓ Branch 0 taken 9180 times.
+
✗ Branch 1 not taken.
+
+
+
9180 if (ret < 0)
95 + goto oldpwd;
96 +
97 + 9180oldpwd:
98 + 9180 my_chdir(oldpwd, NULL);
99 + 9180 free(oldpwd);
100 +
101 + 9180free_repo:
102 + 9180 ci_cleanup_git_repo(repo);
103 +
104 + 9180exit:
105 + 9180 return ret;
106 + }
107 +
+
+ +
+ + + + -- cgit v1.2.3