From 04e6cc17e8222220b732515f2d3f5d71aff95306 Mon Sep 17 00:00:00 2001 From: davidpanderson Date: Tue, 3 Sep 2024 13:49:47 -0700 Subject: [PATCH] client: remove --app_test option; to use feature, edit app_test.cpp client: restore CLIENT_STATE::app_test and app_test_file; these aren't used but if I remove the client crashes on exit client: don't delete slot dirs with 'test' in their name worker: count only computing time (not sleep) toward --nsecs wsl_wrapper: add debugging output; fix kill commands --- client/app_test.cpp | 22 +++++----- client/client_state.h | 2 + client/file_names.cpp | 2 +- samples/worker/worker.cpp | 7 +-- samples/wsl_wrapper/wsl_wrapper.cpp | 66 +++++++++++++++++++++-------- 5 files changed, 65 insertions(+), 34 deletions(-) diff --git a/client/app_test.cpp b/client/app_test.cpp index 49dc1ead50..13a3695b7c 100644 --- a/client/app_test.cpp +++ b/client/app_test.cpp @@ -48,17 +48,18 @@ // You can examine the contents of the slot dir, // and examine the output files in the project dir. -#include "client_state.h" - -// set to 0 to enable - -#if 1 -void CLIENT_STATE::app_test_init() {} -#else -#include "log_flags.h" #include "project.h" #include "client_types.h" #include "result.h" +#include "client_state.h" +#include "log_flags.h" + +// set to 0 to enable + +#if 0 +void CLIENT_STATE::app_test_init() {} +#else + // The following functions create client data structures // (PROJECT, APP, APP_VERSION, WORKUNIT, RESULT, FILE_REF, FILE_INFO) @@ -155,7 +156,6 @@ static RESULT* make_result(APP_VERSION *av, WORKUNIT* wu) { // so that the client runs a test job. // void CLIENT_STATE::app_test_init() { - PROJECT *proj = make_project(); APP *app = make_app(proj); @@ -170,10 +170,10 @@ void CLIENT_STATE::app_test_init() { *make_file(app->project, "wsl_wrapper.exe", NULL, MAIN_PROG, false) ); av->app_files.push_back( - *make_file(app->project, "main.sh", NULL, INPUT_FILE, true) + *make_file(app->project, "main", NULL, INPUT_FILE, true) ); av->app_files.push_back( - *make_file(app->project, "worker", NULL, INPUT_FILE, true) + *make_file(app->project, "worker", NULL, INPUT_FILE, false) ); // can put other stuff here like diff --git a/client/client_state.h b/client/client_state.h index 241c5c8634..11bdde9e3b 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -245,6 +245,8 @@ struct CLIENT_STATE { void process_autologin(bool first); // --------------- app_test.cpp: + bool app_test; // this and the follow are not used, + string app_test_file; // but if I remove them the client crashes on exit. WTF??? void app_test_init(); // --------------- current_version.cpp: diff --git a/client/file_names.cpp b/client/file_names.cpp index bb55398fa6..ebb7366321 100644 --- a/client/file_names.cpp +++ b/client/file_names.cpp @@ -227,7 +227,7 @@ void delete_old_slot_dirs() { safe_strcpy(filename, ""); retval = dir_scan(filename, dirp, sizeof(filename)); if (retval) break; - if (!strcmp(filename, "app_test")) { + if (strstr(filename, "test")) { continue; } snprintf(path, sizeof(path), "%s/%s", SLOTS_DIR, filename); diff --git a/samples/worker/worker.cpp b/samples/worker/worker.cpp index becd47559e..dea1355429 100644 --- a/samples/worker/worker.cpp +++ b/samples/worker/worker.cpp @@ -59,7 +59,6 @@ void copy_uc(FILE* fin, FILE* fout) { int main(int argc, char** argv) { FILE* in=0, *out=0; int i, nsecs = 0; - char c; for (i=1; i