From 1bcf9a54b7c3ea75d9230a15f25df92af28cbcd5 Mon Sep 17 00:00:00 2001
From: Olivier Stasse <ostasse@laas.fr>
Date: Wed, 24 Jul 2019 11:19:51 +0200
Subject: [PATCH] Add test to follow multi-threading.

---
 tests/test-mt.cpp | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)
 create mode 100644 tests/test-mt.cpp

diff --git a/tests/test-mt.cpp b/tests/test-mt.cpp
new file mode 100644
index 00000000..059ea2a4
--- /dev/null
+++ b/tests/test-mt.cpp
@@ -0,0 +1,35 @@
+/* Copyright 2019, LAAS-CNRS
+ *
+ * Olivier Stasse
+ *
+ */
+#include <sstream>
+#include <fstream>
+#include <iostream>
+#include <unistd.h>
+#include <dynamic-graph/process-list.hh>
+
+#define BOOST_TEST_MODULE debug-trace
+
+#include <boost/test/unit_test.hpp>
+#include <boost/test/output_test_stream.hpp>
+
+using boost::test_tools::output_test_stream;
+
+
+BOOST_AUTO_TEST_CASE(testMt)
+{
+  dynamicgraph::CPU::System aSystem;
+  
+  // create and open a character archive for output
+  std::ofstream ofs("cpu_state.dat");
+  boost::archive::text_oarchive oa(ofs);
+  oa << aSystem;
+  
+  for(unsigned int i=0;i<10;i++)
+    {
+      usleep(100000);
+      aSystem.readProcStat();
+    }
+}
+
-- 
GitLab