From 036a42c08eadbd0a2c462ca61d9d883996be8042 Mon Sep 17 00:00:00 2001 From: Tom Rondeau Date: Thu, 30 Sep 2010 16:08:53 -0400 Subject: [PATCH] Adding an XML outputter for the CPP Unit tests. This is to a) store the output information but also b) for integration with Hudson for logging and displaying the results during the build stages. This only covers a few cases so far and I need to define a better place to save the output files. --- gnuradio-core/src/tests/test_all.cc | 6 +++++- gnuradio-core/src/tests/test_filter.cc | 6 +++++- gnuradio-core/src/tests/test_general.cc | 10 +++++++--- gnuradio-core/src/tests/test_runtime.cc | 6 +++++- gruel/src/lib/test_gruel.cc | 6 +++++- 5 files changed, 27 insertions(+), 7 deletions(-) diff --git a/gnuradio-core/src/tests/test_all.cc b/gnuradio-core/src/tests/test_all.cc index 6dc1a26f..35bc0a04 100644 --- a/gnuradio-core/src/tests/test_all.cc +++ b/gnuradio-core/src/tests/test_all.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,6 +21,7 @@ */ #include +#include #include #include @@ -34,11 +35,14 @@ main (int argc, char **argv) { CppUnit::TextTestRunner runner; + std::ofstream xmlfile("cppunit_test_all.xml"); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); runner.addTest (qa_general::suite ()); runner.addTest (qa_filter::suite ()); // runner.addTest (qa_atsc::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_filter.cc b/gnuradio-core/src/tests/test_filter.cc index 56e94523..1e67b718 100644 --- a/gnuradio-core/src/tests/test_filter.cc +++ b/gnuradio-core/src/tests/test_filter.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,6 +21,7 @@ */ #include +#include #include int @@ -28,8 +29,11 @@ main (int argc, char **argv) { CppUnit::TextTestRunner runner; + std::ofstream xmlfile("cppunit_test_filter.xml"); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_filter::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_general.cc b/gnuradio-core/src/tests/test_general.cc index 063e2ee4..bc89c0b6 100644 --- a/gnuradio-core/src/tests/test_general.cc +++ b/gnuradio-core/src/tests/test_general.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,15 +21,19 @@ */ #include +#include #include int main (int argc, char **argv) { - - CppUnit::TextTestRunner runner; + CppUnit::TextTestRunner runner; + + std::ofstream xmlfile("cppunit_test_general.xml"); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_general::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gnuradio-core/src/tests/test_runtime.cc b/gnuradio-core/src/tests/test_runtime.cc index 8549f2a9..1efd9a0c 100644 --- a/gnuradio-core/src/tests/test_runtime.cc +++ b/gnuradio-core/src/tests/test_runtime.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2002 Free Software Foundation, Inc. + * Copyright 2002,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,6 +21,7 @@ */ #include +#include #include int @@ -28,8 +29,11 @@ main (int argc, char **argv) { CppUnit::TextTestRunner runner; + std::ofstream xmlfile("cppunit_test_runtime.xml"); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest (qa_runtime::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run ("", false); diff --git a/gruel/src/lib/test_gruel.cc b/gruel/src/lib/test_gruel.cc index 66930344..cb5f2d36 100644 --- a/gruel/src/lib/test_gruel.cc +++ b/gruel/src/lib/test_gruel.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2006,2009 Free Software Foundation, Inc. + * Copyright 2006,2009,2010 Free Software Foundation, Inc. * * This file is part of GNU Radio * @@ -21,6 +21,7 @@ */ #include +#include #include "pmt/qa_pmt.h" int @@ -28,8 +29,11 @@ main(int argc, char **argv) { CppUnit::TextTestRunner runner; + std::ofstream xmlfile("cppunit_gruel.xml"); + CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile); runner.addTest(qa_pmt::suite ()); + runner.setOutputter(xmlout); bool was_successful = runner.run("", false); -- 2.30.2