]> feistymeow.org Git - feisty_meow.git/commitdiff
working through busted octopus tests now
authorFred T. Hamster <fred@feistymeow.org>
Sun, 15 Feb 2026 06:25:09 +0000 (01:25 -0500)
committerFred T. Hamster <fred@feistymeow.org>
Sun, 15 Feb 2026 06:25:09 +0000 (01:25 -0500)
octopi/library/octopus/entity_data_bin.h
octopi/library/tests_cromp/makefile
octopi/library/tests_cromp/test_cromp_client.cpp
octopi/library/tests_octopus/makefile
octopi/library/tests_octopus/test_bin.cpp
octopi/library/tests_octopus/test_bin_threaded.cpp
testkit/prepare_tools.sh

index 54f5f5f2383f31e5d10d30020486aa88bdc8464e..0ed4b0040860922d17711027bd57a1f1870f509b 100644 (file)
@@ -104,6 +104,9 @@ public:
     // note that this should be called periodically by the controlling object.
     // it will not be called automatically.
 
+  basis::base_synchronizer &locker() { return *_ent_lock; }
+    //!< provided for tighter synchronization; this should be used very carefully, e.g. with auto_synchronizer.
+
 private:
   entity_item_hash *_table;  // our main storage object.
   basis::mutex *_ent_lock;  // protects our structures.
index a7ab6d68ac2e9749443fd6590cf1632b2c809a4d..ab8f75a48c3fe7ba95321b1373733a7c6a743fb3 100644 (file)
@@ -19,6 +19,6 @@ create_decoder_ring:
 run_client_server_test:
        # launch the server into the background first.  we have to hope it completes, eventually.
        ($(FEISTY_MEOW_BINARIES)/test_cromp_server &)
-       $(FEISTY_MEOW_BINARIES)/test_cromp_client
+       $(FEISTY_MEOW_BINARIES)/test_cromp_client --sends 1008
        # zap the server now, since it won't quit otherwise.
        killall test_cromp_server
index 8d99e39cfe640398dad514477855f9bb66474845..092851a5bc85b8126b8d1903ae2a9fae4edecbd3 100644 (file)
@@ -57,9 +57,6 @@ using namespace unit_test;
 
 #undef LOG
 #define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
-///#undef BASE_LOG
-///#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), astring(s))
-
 
 #define DEBUG_TESTER
   // uncomment for noisier version.
index 6784c3bdc134205a7020d7ae9f490cf13dda59f0..ba9b212351ae444d55c110d31e97bbf3592c449b 100644 (file)
@@ -4,11 +4,11 @@ include cpp/variables.def
 
 PROJECT = tests_octopus
 TYPE = test
-TARGETS = t_bin.exe t_bin_threaded.exe t_entity.exe t_identity.exe \
-  t_security.exe t_unpacker.exe t_file_transfer.exe
+TARGETS = test_bin.exe test_bin_threaded.exe test_entity.exe test_identity.exe \
+  test_security.exe test_unpacker.exe test_file_transfer.exe
 LOCAL_LIBS_USED = tentacles octopus sockets unit_test application configuration loggers \
   textual timely processes filesystem structures basis 
-VCPP_USE_SOCK = t
+#VCPP_USE_SOCK = t
 RUN_TARGETS = $(ACTUAL_TARGETS)
 
 include cpp/rules.def
index 74c850900e91764638011cdce233c1d1ab0fc3f8..b80b93f16f395f8848a6274b0c5678eda7abe9f8 100644 (file)
 \*****************************************************************************/
 
 #include <application/hoople_main.h>
+#include <application/application_shell.h>
 #include <basis/byte_array.h>
-#include <mathematics/chaos.h>
 #include <basis/functions.h>
 #include <basis/guards.h>
 #include <basis/astring.h>
-#include <application/application_shell.h>
 #include <loggers/console_logger.h>
 #include <loggers/program_wide_logger.h>
-#include <structures/static_memory_gremlin.h>
+#include <mathematics/chaos.h>
 #include <octopus/entity_data_bin.h>
 #include <octopus/entity_defs.h>
+#include <structures/static_memory_gremlin.h>
 #include <tentacles/security_infoton.h>
 #include <textual/string_manipulation.h>
+#include <unit_test/unit_base.h>
 
 #include <stdio.h>
 
@@ -38,14 +39,15 @@ using namespace basis;
 using namespace loggers;
 using namespace octopi;
 using namespace textual;
+using namespace unit_test;
 
 const int ITEM_COUNT = 10000;
   // the number of times to repeat each test operation.
 
-#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger().get(), astring(s))
-#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger().get(), astring(s))
+#define LOG(s) CLASS_EMERGENCY_LOG(program_wide_logger::get(), astring(s))
+#define BASE_LOG(s) EMERGENCY_LOG(program_wide_logger::get(), astring(s))
 
-class test_bin : public application_shell
+class test_bin : virtual public unit_base, virtual public application_shell
 {
 public:
   test_bin() : application_shell() {}
@@ -72,7 +74,7 @@ LOG(a_sprintf("test type %d beginning...%c", q, c));
 //LOG("note memory usage and hit a key:");
 //c = getchar();
 
-    program_wide_logger().get().eol(parser_bits::NO_ENDING);
+    program_wide_logger::get().eol(parser_bits::NO_ENDING);
     for (int i = 1; i <= ITEM_COUNT; i++) {
       // test the basic filling of the values in an entity.
       octopus_request_id req_id;
@@ -91,12 +93,12 @@ LOG(a_sprintf("test type %d beginning...%c", q, c));
         fflush(NULL_POINTER);
       }
     }
-    program_wide_logger().get().eol(parser_bits::CRLF_AT_END);
+    program_wide_logger::get().eol(parser_bits::CRLF_AT_END);
     LOG("");
 
     int items_seen = 0;
 
-    program_wide_logger().get().eol(parser_bits::NO_ENDING);
+    program_wide_logger::get().eol(parser_bits::NO_ENDING);
     if (q == ANY) {
       while (item_list.length()) {
         octopus_request_id id;
@@ -160,7 +162,7 @@ LOG(a_sprintf("test type %d beginning...%c", q, c));
     } else {
       deadly_error(class_name(), "looping", "bad enum value");
     }
-    program_wide_logger().get().eol(parser_bits::CRLF_AT_END);
+    program_wide_logger::get().eol(parser_bits::CRLF_AT_END);
     LOG("");
     item_list.reset();
     item_list.shrink();
index e939c9b96dca6b4043971d12c6e1cfcb342478bc..f069fe8d427c5acb22d0bfc805577fa4f1d11615 100644 (file)
 \*****************************************************************************/
 
 #include <application/hoople_main.h>
+#include <application/application_shell.h>
 #include <basis/byte_array.h>
-#include <mathematics/chaos.h>
+#include <configuration/application_configuration.h>
 #include <basis/functions.h>
 #include <basis/guards.h>
 #include <basis/astring.h>
 #include <basis/mutex.h>
-#include <structures/amorph.h>
-#include <structures/static_memory_gremlin.h>
 #include <loggers/console_logger.h>
-#include <processes/ethread.h>
-#include <processes/safe_roller.h>
-#include <timely/time_control.h>
-#include <timely/time_stamp.h>
+#include <mathematics/chaos.h>
 #include <octopus/entity_data_bin.h>
 #include <octopus/entity_defs.h>
 #include <octopus/unhandled_request.h>
-#include <application/application_shell.h>
-#include <configuration/application_configuration.h>
+#include <processes/ethread.h>
+#include <processes/safe_roller.h>
+#include <structures/amorph.h>
+#include <structures/static_memory_gremlin.h>
+#include <structures/string_array.h>
 #include <textual/string_manipulation.h>
+#include <timely/time_control.h>
+#include <timely/time_stamp.h>
+#include <unit_test/unit_base.h>
 
 #include <stdio.h>
 
 #endif
 
 using namespace application;
+using namespace basis;
 using namespace loggers;
+using namespace mathematics;
 using namespace octopi;
 using namespace processes;
+using namespace structures;
+using namespace textual;
 using namespace timely;
+using namespace unit_test;
 
 // global constants...
 
@@ -86,7 +93,7 @@ const int MONKS_CLEANING_TIME = 10 * SECOND_ms;
   // a very short duration for data to live.
 
 #define LOG(to_print) printf("%s\n", (char *)astring(to_print).s());
-//CLASS_EMERGENCY_LOG(program_wide_logger().get(), to_print)
+//CLASS_EMERGENCY_LOG(program_wide_logger::get().get(), to_print)
   // our macro for logging with a timestamp.
 
 // global objects...
@@ -105,9 +112,9 @@ octopus_request_id create_request_id()
   octopus_request_id req_id;
   if (randomizer().inclusive(1, 100) < 25) {
     // some of the time we make a totally random entity id.
-    int sequencer = randomizer().inclusive(1, MAXINT - 10);
-    int add_in = randomizer().inclusive(0, MAXINT - 10);
-    int process_id = randomizer().inclusive(0, MAXINT - 10);
+    int sequencer = randomizer().inclusive(1, MAXINT32 - 10);
+    int add_in = randomizer().inclusive(0, MAXINT32 - 10);
+    int process_id = randomizer().inclusive(0, MAXINT32 - 10);
     req_id._entity = octopus_entity(string_manipulation::make_random_name(),
         process_id, sequencer, add_in);
   } else {
@@ -118,7 +125,7 @@ octopus_request_id create_request_id()
     req_id._entity = octopus_entity("boringentity",
         process_id, sequencer, add_in);
   }
-  req_id._request_num = randomizer().inclusive(1, MAXINT - 10);
+  req_id._request_num = randomizer().inclusive(1, MAXINT32 - 10);
   return req_id;
 }
 
@@ -243,20 +250,23 @@ public:
   void perform_activity(void *formal(data)) {
     FUNCDEF("perform_activity");
     while (!should_stop()) {
-      // one activation of monk has devastating consequences.  we empty out
-      // the data one item at a time until we see no data at all.  after
-      // cleaning each item, we ensure that the deadwood is cleaned out.
-      binger._ent_lock->lock();
+      {
+        // one activation of monk has devastating consequences.  we empty out
+        // the data one item at a time until we see no data at all.  after
+        // cleaning each item, we ensure that the deadwood is cleaned out.
+////      binger._ent_lock->lock();
+        auto_synchronizer l(binger.locker());
 LOG(a_sprintf("monk sees %d items.", binger.items_held()));
-      while (binger.items_held()) {
-        // grab one instance of any item in the bin.
-        octopus_request_id id;
-        infoton *found = binger.acquire_for_any(id);
-        WHACK(found);
-        // also clean out things a lot faster than normal.  
-        binger.clean_out_deadwood(MONKS_CLEANING_TIME);
+        while (binger.items_held()) {
+          // grab one instance of any item in the bin.
+          octopus_request_id id;
+          infoton *found = binger.acquire_for_any(id);
+          WHACK(found);
+          // also clean out things a lot faster than normal.  
+          binger.clean_out_deadwood(MONKS_CLEANING_TIME);
+        }
+///      binger._ent_lock->unlock();
       }
-      binger._ent_lock->unlock();
 LOG(a_sprintf("after a little cleaning, monk sees %d items.", binger.items_held()));
       // snooze.
       int sleepy_time = randomizer().inclusive(MIN_MONK_THREAD_PAUSE,
@@ -271,7 +281,7 @@ LOG(a_sprintf("after a little cleaning, monk sees %d items.", binger.items_held(
 class test_entity_data_bin_threaded : public application_shell
 {
 public:
-  test_entity_data_bin_threaded() : application_shell(class_name()) {}
+  test_entity_data_bin_threaded() : application_shell() {}
 
   DEFINE_CLASS_NAME("test_entity_data_bin_threaded");
 
@@ -329,7 +339,7 @@ int test_entity_data_bin_threaded::execute()
 // how many evaporated due to timeout.
 
 
-  guards::alert_message("t_bin_threaded:: works for all functions tested.");
+  critical_events::alert_message("t_bin_threaded:: works for all functions tested.");
   return 0;
 }
 
index 5fe1a2278281c375fb035262869c419c55a0068a..7f38d293d5c86ef1c42195a2ef5e60aa8a3dc3fd 100644 (file)
@@ -1,5 +1,7 @@
 #!/usr/bin/env bash
 
+source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
+
 # Author: Chris Koeritz
 #
 # Note: