summaryrefslogtreecommitdiff
path: root/gruel/src/lib/test_gruel.cc
diff options
context:
space:
mode:
authorTom Rondeau2011-06-05 15:36:47 -0400
committerTom Rondeau2011-06-05 15:36:47 -0400
commit233f960474f86bc8cc519ce7257b29d8615c4000 (patch)
tree1a4c846119a01a5a195a9e9ee5b854384b0b6535 /gruel/src/lib/test_gruel.cc
parent024c79a7fb13c08bae7b97079a245f711ecf12a7 (diff)
parenta23a0a46c3bf446cbe09d71bc8e10b061256ef56 (diff)
downloadgnuradio-233f960474f86bc8cc519ce7257b29d8615c4000.tar.gz
gnuradio-233f960474f86bc8cc519ce7257b29d8615c4000.tar.bz2
gnuradio-233f960474f86bc8cc519ce7257b29d8615c4000.zip
Merge branch 'master' into turbo
Diffstat (limited to 'gruel/src/lib/test_gruel.cc')
-rw-r--r--gruel/src/lib/test_gruel.cc53
1 files changed, 9 insertions, 44 deletions
diff --git a/gruel/src/lib/test_gruel.cc b/gruel/src/lib/test_gruel.cc
index 2c9528b0a..7ef3520e6 100644
--- a/gruel/src/lib/test_gruel.cc
+++ b/gruel/src/lib/test_gruel.cc
@@ -1,6 +1,6 @@
/* -*- c++ -*- */
/*
- * Copyright 2006,2009,2010 Free Software Foundation, Inc.
+ * Copyright 2006,2009,2010,2011 Free Software Foundation, Inc.
*
* This file is part of GNU Radio
*
@@ -28,16 +28,19 @@
#include "pmt/qa_pmt.h"
-static void get_unittest_path (const char *filename, char *fullpath, size_t pathsize);
+#include <boost/filesystem/operations.hpp>
+#include <boost/filesystem/path.hpp>
+namespace fs = boost::filesystem;
int
main(int argc, char **argv)
{
- char path[200];
- get_unittest_path ("gruel.xml", path, 200);
-
+ fs::path path = fs::current_path() / ".unittests";
+ if (!fs::is_directory(path)) fs::create_directory(path);
+ path = path / "gruel.xml";
+
CppUnit::TextTestRunner runner;
- std::ofstream xmlfile(path);
+ std::ofstream xmlfile(path.string().c_str());
CppUnit::XmlOutputter *xmlout = new CppUnit::XmlOutputter(&runner.result(), xmlfile);
runner.addTest(qa_pmt::suite ());
@@ -47,41 +50,3 @@ main(int argc, char **argv)
return was_successful ? 0 : 1;
}
-
-
-// NOTE: These are defined in gr_unittest.h for the rest of the project;
-// rewriting here since we don't depend on gnuradio-core in gruel
-
-#ifdef MKDIR_TAKES_ONE_ARG
-#define gr_mkdir(pathname, mode) mkdir(pathname)
-#else
-#define gr_mkdir(pathname, mode) mkdir((pathname), (mode))
-#endif
-
-/*
- * Mostly taken from gr_preferences.cc/h
- * The simplest thing that could possibly work:
- * the key is the filename; the value is the file contents.
- */
-
-static void
-ensure_unittest_path (const char *path)
-{
- struct stat statbuf;
- if (stat (path, &statbuf) == 0 && S_ISDIR (statbuf.st_mode))
- return;
-
- // blindly try to make it // FIXME make this robust. C++ SUCKS!
- gr_mkdir (path, 0750);
-}
-
-static void
-get_unittest_path (const char *filename, char *fullpath, size_t pathsize)
-{
- char path[200];
- snprintf (path, sizeof(path), "./.unittests");
- snprintf (fullpath, pathsize, "%s/%s", path, filename);
-
- ensure_unittest_path(path);
-}
-