How does the build of these tests work? In the stuff you added to the
cmake files, it looks like some cpp files are listed. Are those
generated or did you accidentally forget to add them perhaps?
--
Russell Bryant
On Mon, May 23, 2011 at 2:56 PM, <astokes(a)fedoraproject.org> wrote:
From: Adam Stokes <astokes(a)fedoraproject.org>
- Perform match tests on host api routines.
---
src/tests/mh_api_host.h | 110 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 110 insertions(+), 0 deletions(-)
create mode 100644 src/tests/mh_api_host.h
diff --git a/src/tests/mh_api_host.h b/src/tests/mh_api_host.h
new file mode 100644
index 0000000..f3a6387
--- /dev/null
+++ b/src/tests/mh_api_host.h
@@ -0,0 +1,110 @@
+/*
+ * mh_api_host.h: host unittest
+ *
+ * Copyright (C) 2011 Red Hat Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * Author: Adam Stokes <astokes(a)fedoraproject.org>
+ */
+
+
+#ifndef __MH_API_HOST_UNITTEST_H
+#define __MH_API_HOST_UNITTEST_H
+#include <iostream>
+#include <sstream>
+#include <cstring>
+#include <utility>
+#include <vector>
+#include <cstdlib>
+#include <cstdio>
+#include <sys/stat.h>
+#include <dirent.h>
+#include <pcre.h>
+#include <cxxtest/TestSuite.h>
+
+extern "C" {
+#include "matahari/host.h"
+#include "mh_test_utilities.h"
+#include <sigar.h>
+#include <sigar_format.h>
+#include <glib.h>
+};
+
+#define OVECCOUNT 30
+
+using namespace std;
+
+class MhApiHostSuite : public CxxTest::TestSuite
+{
+ public:
+ std::stringstream infomsg;
+ std::stringstream errmsg;
+
+ void testHostName(void)
+ {
+ infomsg << "Verify " << mh_host_get_hostname() <<
" format";
+ TS_TRACE(infomsg.str());
+ TS_ASSERT((is_match("^([0-9a-zA-Z]+([\\.]|$)){2,3}$",
+ mh_host_get_hostname())) >= 0);
+ infomsg.str("");
+ }
+
+ void testUuid(void)
+ {
+ infomsg << "Verify " << mh_host_get_uuid() << "
exists";
+ TS_TRACE(infomsg.str());
+ TS_ASSERT((is_match("^[0-9a-zA-Z]+$", mh_host_get_uuid())) >= 0);
+ infomsg.str("");
+ }
+
+ void testOperatingSystem(void)
+ {
+ infomsg << "Verify OS : " <<
mh_host_get_operating_system();
+ TS_TRACE(infomsg.str());
+ TS_ASSERT((is_match("^Linux.*|Windows.*|Solaris.*$",
+ mh_host_get_operating_system())) >= 0);
+ infomsg.str("");
+ }
+
+ void testArchitecture(void)
+ {
+ infomsg << "Verify architecture property: " \
+ << mh_host_get_architecture();
+ TS_TRACE(infomsg.str());
+ TS_ASSERT((is_match("^[0-9a-zA-Z_]+$",
+ mh_host_get_architecture())) >= 0);
+ infomsg.str("");
+ }
+
+ void testCpuModel(void)
+ {
+ infomsg << "Verify cpu model: " <<
mh_host_get_cpu_model();
+ TS_TRACE(infomsg.str());
+ TS_ASSERT((is_match("\\sCPU\\s", mh_host_get_cpu_model())) >= 0);
+ infomsg.str("");
+ }
+
+ void testCpuFlags(void)
+ {
+ infomsg << "Verify cpu flags: " <<
mh_host_get_cpu_flags();
+ TS_TRACE(infomsg.str());
+ TS_ASSERT((is_match("\\d+", mh_host_get_cpu_flags())) >= 0);
+ infomsg.str("");
+ }
+
+};
+
+#endif
--
1.7.4.4
_______________________________________________
Matahari mailing list
Matahari(a)lists.fedorahosted.org
https://fedorahosted.org/mailman/listinfo/matahari