Do not use __attribute__((constructor))
[lttv.git] / lttv / lttv / sync / sync_chain_unittest.c
index 9b4b869c7f32bac3b622ac71a115e05050b7aaee..79b3b58fd764b401303dfe3aefab8b0538bba32f 100644 (file)
 #include <sys/stat.h>
 #include <unistd.h>
 
+#include "event_processing_text.h"
+#include "event_matching_tcp.h"
+#include "event_matching_broadcast.h"
+#include "event_matching_distributor.h"
+#include "event_analysis_chull.h"
+#include "event_analysis_linreg.h"
+#include "event_analysis_eval.h"
 #include "sync_chain.h"
 
 
@@ -98,6 +105,24 @@ int main(const int argc, char* const argv[])
        bool stats;
        const char* testCaseName;
        GString* analysisModulesNames;
+       unsigned int id;
+
+       /*
+        * Initialize event modules
+        * Call the "constructor" or initialization function of each event module
+        * so it can register itself. This must be done before elements in
+        * processingModules, matchingModules, analysisModules or moduleOptions
+        * are accessed.
+        */
+       registerProcessingText();
+
+       registerMatchingTCP();
+       registerMatchingBroadcast();
+       registerMatchingDistributor();
+
+       registerAnalysisCHull();
+       registerAnalysisLinReg();
+       registerAnalysisEval();
 
        // Initialize data structures
        syncState= malloc(sizeof(SyncState));
@@ -137,7 +162,7 @@ int main(const int argc, char* const argv[])
        else
        {
                syncState->stats= false;
-               g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, nullLog, NULL);
+               id= g_log_set_handler(NULL, G_LOG_LEVEL_DEBUG, nullLog, NULL);
        }
 
        if (optionSyncGraphs.present)
@@ -227,6 +252,11 @@ int main(const int argc, char* const argv[])
                        endUsage.ru_stime.tv_usec);
        }
 
+       if (!optionSyncStats.present)
+       {
+               g_log_remove_handler(NULL, id);
+       }
+
        return EXIT_SUCCESS;
 }
 
This page took 0.023406 seconds and 4 git commands to generate.