summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormrb0nk500 <b0nk@b0nk.xyz>2021-09-25 15:54:30 -0400
committermrb0nk500 <b0nk@b0nk.xyz>2022-08-10 14:13:44 -0300
commit522ee790ae8a37064bbf830e25bfea8628cae1df (patch)
tree7a856996307d56d67695b079cac4a00283f89ffc
parent83c37a9e9de61247f6e5deb618e090cf6b9df952 (diff)
Add some testing code.
-rw-r--r--macros.h3
-rw-r--r--pullreqd.c12
-rw-r--r--test.conf3
3 files changed, 15 insertions, 3 deletions
diff --git a/macros.h b/macros.h
index 14e7da0..8d81953 100644
--- a/macros.h
+++ b/macros.h
@@ -9,7 +9,8 @@
#ifndef LOG_H
#include "log.h"
-#define log(priority, ...) printlog(LOG_OUT_SYSLOG, priority, __VA_ARGS__)
+/*#define log(priority, ...) syslog(priority, __VA_ARGS__)*/
+#define log(priority, ...) printlog(LOG_OUT_STDOUT, priority, __VA_ARGS__)
#define log_reason(priority, msg, ...) log(priority, msg " Reason %s", __VA_ARGS__)
#endif
diff --git a/pullreqd.c b/pullreqd.c
index 113bb11..33da015 100644
--- a/pullreqd.c
+++ b/pullreqd.c
@@ -160,6 +160,12 @@ int *init_socket(config *cfg) {
int main_loop(config *cfg, int *listen_sockets, git_repo **repos) {
int done = 0;
struct stat st;
+ file **patches = (file *[]) {
+ &(file){"lol.patch", "asfklhasflhk"},
+ &(file){"oof.patch", "you just got rekt by some young guy"},
+ NULL
+ };
+ pull_request *pr = &(pull_request){"lol", "oof", "some young guy", NULL, time(NULL), 0, {.patches = patches}, NULL};
/* Does the PR root directory exist? */
if (stat(cfg->pr_root, &st) < 0) {
@@ -168,6 +174,10 @@ int main_loop(config *cfg, int *listen_sockets, git_repo **repos) {
}
for (; !done;) {
+ if (create_pull_request_dir(pr, -1, cfg->pr_root) < 0) {
+ log(LOG_ERR, "Failed to create Pull Request directory.");
+ return -1;
+ }
break;
}
@@ -209,7 +219,7 @@ int main(int argc, char **argv) {
int exit_status = EXIT_FAILURE;
/* Start it in daemon mode. */
- init_daemon(1, "/");
+ /*init_daemon(1, "/");*/
/* Open the logfile. */
openlog("pullreqd", LOG_PID, LOG_DAEMON);
diff --git a/test.conf b/test.conf
index 54cfcea..b81c91e 100644
--- a/test.conf
+++ b/test.conf
@@ -1,4 +1,5 @@
-git-root=<insert path to git repos here>
+git-root=..
+pr-root=test
socket-type=network
socket=<insert path for type unix, or ip address/domain for type network here>
port=1488