From d85b6353945e79ef3f010ca00815fba7386f4824 Mon Sep 17 00:00:00 2001 From: Matthew Zito Date: Sun, 19 Jan 2025 01:44:01 -0800 Subject: [PATCH] tmp --- scripts/entrypoint.sh | 3 ++- src/api/commands.c | 9 +++++++-- t/integ/ipc_shpec.bash | 9 ++++++--- t/integ/utils/run.bash | 10 +++++----- 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/scripts/entrypoint.sh b/scripts/entrypoint.sh index df4b624..de3a595 100755 --- a/scripts/entrypoint.sh +++ b/scripts/entrypoint.sh @@ -8,5 +8,6 @@ if [ "$(echo "$ret" | grep 'not ok')" != "" ]; then exit 1 fi -make -s integ_test 2>/dev/null +make -s integ_test +# TODO: 2>/dev/null exit $? diff --git a/src/api/commands.c b/src/api/commands.c index a8b0a37..0971c3e 100644 --- a/src/api/commands.c +++ b/src/api/commands.c @@ -34,6 +34,7 @@ static hash_table* command_handlers_map; static void write_jobs_command (int client_fd) { write(client_fd, "[", 1); + unsigned int len = array_size(job_queue); foreach (job_queue, i) { job_t* job = (job_t*)array_get_or_panic(job_queue, i); @@ -82,16 +83,19 @@ write_crontabs_command (int client_fd) { char* cmd_esc = escape_json_string(ce->cmd); char* s = s_fmt( - "{\"id\":\"%d\",\"cmd\":\"%s\",\"schedule\":\"%s\",\"owner\":\"%s\"," + "{\"id\":\"%d\",\"filepath\":\"%s\",\"cmd\":\"%s\",\"schedule\":\"%s\"," + "\"owner\":\"%s\"," "\"envp\":\"%s\",\"next\":\"%s\"}%s", ce->id, + entry->key, cmd_esc, ce->schedule, ct->uname, se, ts, - entries != 0 || i != len - 1 ? "," : "" + entries != 0 ? "," : "" ); + log_debug(">>>> %s\n", s); write(client_fd, s, strlen(s)); @@ -101,6 +105,7 @@ write_crontabs_command (int client_fd) { free(ts); } HT_ITER_END + log_debug(">>>> %s\n", "DONE FEWL"); write(client_fd, "]", 1); } diff --git a/t/integ/ipc_shpec.bash b/t/integ/ipc_shpec.bash index 10ae757..7204bb4 100644 --- a/t/integ/ipc_shpec.bash +++ b/t/integ/ipc_shpec.bash @@ -149,11 +149,13 @@ describe 'ipc API IPC_SHOW_INFO command' end_describe describe 'ipc API IPC_LIST_CRONTABS command' - n_syscrontabs="$(find /etc/cron.{hourly,daily,weekly,monthly} -type f 2>/dev/null | wc -l)" + n_syscrontabs="$(find /etc/cron.{hourly,daily,weekly,monthly} -type f 2>/dev/null | wc -l)" start_chronic sleep 5 - out="$(sock_call '{ "command" : "IPC_LIST_CRONTABS"}' 2>/dev/null | tr -d '\0')" + out="$(sock_call '{ "command" : "IPC_LIST_CRONTABS"}')" + echo ">>>>> $out" + cat .log it 'lists all crontabs' assert equal $(jq 'length' <<< "$out") "$((n_syscrontabs + 3))" @@ -177,7 +179,8 @@ describe 'ipc API IPC_LIST_JOBS command' echo 'sleeping for 60 seconds...' sleep 60 - out="$(sock_call '{ "command" : "IPC_LIST_JOBS"}' 2>/dev/null | tr -d '\0')" + out="$(sock_call '{ "command" : "IPC_LIST_JOBS"}')" + echo ">>> $out" it 'lists all jobs' assert gt "$(jq 'length' <<< "$out")" 0 diff --git a/t/integ/utils/run.bash b/t/integ/utils/run.bash index d7303d1..ae7a349 100755 --- a/t/integ/utils/run.bash +++ b/t/integ/utils/run.bash @@ -5,12 +5,12 @@ TESTING_DIR=t/integ UTILS_F=run_utils.bash declare -a SKIP_FILES=( - # 'daemon_shpec.bash' + 'daemon_shpec.bash' # 'ipc_shpec.bash' - # 'peripherals_shpec.bash' - # 'root_shpec.bash' - # 'sig_shpec.bash' - # 'user_shpec.bash' + 'peripherals_shpec.bash' + 'root_shpec.bash' + 'sig_shpec.bash' + 'user_shpec.bash' ) run_test () {