From c30f2cb0e51dd6894eb034db7739ca43a7c7a474 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor@cloudius-systems.com>
Date: Mon, 11 Feb 2013 17:59:40 +0200
Subject: [PATCH] Move the pci device prints out to a separate file and reduce
 the verbosity

---
 loader.cc            |  6 ------
 tests/tst-devices.hh | 24 ++++++++++++++++++++++++
 tests/tst-hub.cc     |  3 +++
 3 files changed, 27 insertions(+), 6 deletions(-)
 create mode 100644 tests/tst-devices.hh

diff --git a/loader.cc b/loader.cc
index 1de496994..2b32d8d7b 100644
--- a/loader.cc
+++ b/loader.cc
@@ -132,16 +132,10 @@ void* do_main_thread(void *_args)
 
     //Tests malloc and free using threads.
     unit_tests::tests::instance().execute_tests();
-    //test_alloc();
-    //test_threads();
 
     // Enumerate PCI devices
-    pci::pci_devices_print();
     pci::pci_device_enumeration();
 
-    // List all devices
-    hw::device_manager::instance()->list_devices();
-
     // Initialize all drivers
     hw::driver_manager* drvman = hw::driver_manager::instance();
     drvman->register_driver(new virtio::virtio_blk(0));
diff --git a/tests/tst-devices.hh b/tests/tst-devices.hh
new file mode 100644
index 000000000..d7c5cfe23
--- /dev/null
+++ b/tests/tst-devices.hh
@@ -0,0 +1,24 @@
+#ifndef __TST_DEVICES__
+#define __TST_DEVICES__
+
+#include "tst-hub.hh"
+#include "drivers/pci.hh"
+#include "debug.hh"
+
+class test_devices : public unit_tests::vtest {
+
+public:
+
+    void run()
+    {
+            // Comment it out to reduce output
+            //pci::pci_devices_print();
+
+            // List all devices
+            hw::device_manager::instance()->list_devices();
+
+            debug("Devices test succeeded");
+    }
+};
+
+#endif
diff --git a/tests/tst-hub.cc b/tests/tst-hub.cc
index 6fe00450a..cafc1109c 100644
--- a/tests/tst-hub.cc
+++ b/tests/tst-hub.cc
@@ -2,6 +2,7 @@
 #include "tst-threads.hh"
 #include "tst-malloc.hh"
 #include "tst-timer.hh"
+#include "tst-devices.hh"
 
 using namespace unit_tests;
 
@@ -9,10 +10,12 @@ void tests::execute_tests() {
     test_threads threads;
     test_malloc malloc;
     test_timer timer;
+    test_devices dev;
 
     instance().register_test(&threads);
     instance().register_test(&malloc);
     instance().register_test(&timer);
+    instance().register_test(&dev);
 
     instance().run();
 }
-- 
GitLab