summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-04-17 14:45:31 -0700
committerPatrick Venture <venture@google.com>2018-04-24 19:56:28 +0000
commitc635e8609f5246224dfba7db57991de0b1c5327f (patch)
treec91c8ad47d43fcb7e332f5028f7e53c14c0400b2
parentdd46739659dd8ce2adb8def30f6b8c2ef4a75c0d (diff)
downloadphosphor-hwmon-c635e8609f5246224dfba7db57991de0b1c5327f.tar.gz
phosphor-hwmon-c635e8609f5246224dfba7db57991de0b1c5327f.zip
test: moved to tools
Moved the current test folder to tools and started a new test folder. This will allow for rapid introduction of new unit-tests into phosphor-hwmon. The tools folder contains small tools to aid in phosphor-hwmon configuration and misc. This folder will go under review at another time. Change-Id: Ice18ffb5cdcbd519d49088e233a8082a9410b03e Signed-off-by: Patrick Venture <venture@google.com>
-rw-r--r--Makefile.am2
-rw-r--r--configure.ac2
-rw-r--r--test/.gitignore4
-rw-r--r--test/Makefile.am53
-rw-r--r--test/hwmonio.cpp50
-rw-r--r--test/test.cpp59
-rw-r--r--tools/.gitignore2
-rw-r--r--tools/Makefile.am19
-rw-r--r--tools/find_callout_path.cpp (renamed from test/find_callout_path.cpp)0
-rw-r--r--tools/find_hwmon.cpp (renamed from test/find_hwmon.cpp)0
10 files changed, 23 insertions, 168 deletions
diff --git a/Makefile.am b/Makefile.am
index 238eaef..27db186 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,4 +27,4 @@ libhwmon_la_SOURCES = \
timer.cpp \
hwmon.cpp
-SUBDIRS = . test msl
+SUBDIRS = . msl tools
diff --git a/configure.ac b/configure.ac
index 0bc5fc4..1e0f27d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -90,5 +90,5 @@ AC_DEFINE_UNQUOTED([BUSNAME_PREFIX], ["$BUSNAME_PREFIX"], [The DBus busname pref
AC_DEFINE_UNQUOTED([SENSOR_ROOT], ["$SENSOR_ROOT"], [The DBus sensors namespace root.])
# Create configured output
-AC_CONFIG_FILES([Makefile test/Makefile msl/Makefile])
+AC_CONFIG_FILES([Makefile tools/Makefile msl/Makefile])
AC_OUTPUT
diff --git a/test/.gitignore b/test/.gitignore
deleted file mode 100644
index c275637..0000000
--- a/test/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-find-callout-path
-find-hwmon
-hwmonio
-phosphor-hwmon-test
diff --git a/test/Makefile.am b/test/Makefile.am
deleted file mode 100644
index a52a992..0000000
--- a/test/Makefile.am
+++ /dev/null
@@ -1,53 +0,0 @@
-check_PROGRAMS =
-noinst_PROGRAMS = \
- find-callout-path \
- find-hwmon \
- hwmonio \
- phosphor-hwmon-test
-
-find_callout_path_SOURCES = \
- find_callout_path.cpp
-find_callout_path_LDFLAGS = \
- -static
-find_callout_path_LDADD = \
- -lstdc++fs \
- $(SDBUSPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- ${top_builddir}/sysfs.o
-
-find_callout_path_CXXFLAGS =
-
-find_hwmon_SOURCES = \
- find_hwmon.cpp
-find_hwmon_LDFLAGS = \
- -static
-find_hwmon_LDADD = \
- -lstdc++fs \
- $(SDBUSPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- ${top_builddir}/sysfs.o
-
-find_hwmon_CXXFLAGS =
-
-hwmonio_SOURCES = \
- hwmonio.cpp
-hwmonio_LDFLAGS = \
- -static
-hwmonio_LDADD = \
- -lstdc++fs \
- $(SDBUSPLUS_LIBS) \
- $(PHOSPHOR_LOGGING_LIBS) \
- ${top_builddir}/sysfs.o
-
-hwmonio_CXXFLAGS =
-
-phosphor_hwmon_test_SOURCES = \
- test.cpp
-phosphor_hwmon_test_LDADD = \
- ${top_builddir}/libhwmon.la \
- $(SDBUSPLUS_LIBS) \
- $(PTHREAD_LIBS)
-
-phosphor_hwmon_test_CXXFLAGS = \
- $(SDBUSPLUS_CFLAGS) \
- $(PTHREAD_CFLAGS)
diff --git a/test/hwmonio.cpp b/test/hwmonio.cpp
deleted file mode 100644
index 00c4ae1..0000000
--- a/test/hwmonio.cpp
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * Copyright © 2017 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include <iostream>
-#include <string>
-#include "../sysfs.hpp"
-
-int main(int argc, char* argv[])
-{
- using namespace std::string_literals;
-
- if (argc < 6)
- {
- std::cerr << "Usage: " << argv[0]
- << " [read|write] PATH TYPE N ATTR [VALUE]" << std::endl;
- return 1;
- }
-
- sysfs::hwmonio::HwmonIO io(argv[2]);
-
- if ("read"s == argv[1])
- {
- std::cout << io.read(argv[3], argv[4], argv[5],
- sysfs::hwmonio::retries, sysfs::hwmonio::delay) <<
- std::endl;
- }
- else
- {
- io.write(
- strtol(argv[6], nullptr, 0),
- argv[3], argv[4], argv[5], sysfs::hwmonio::retries,
- sysfs::hwmonio::delay);
- }
-
- return 0;
-}
-
-// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
diff --git a/test/test.cpp b/test/test.cpp
deleted file mode 100644
index 90a07c0..0000000
--- a/test/test.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * Copyright © 2016 IBM Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#include "../mainloop.hpp"
-#include <iostream>
-#include <fstream>
-#include <cstdio>
-#include <unistd.h>
-#include <thread>
-
-void runTests(MainLoop& loop)
-{
- loop.shutdown();
- std::cout << "Success!\n";
-}
-
-int main()
-{
- char tmpl[] = "/tmp/hwmon-test.XXXXXX";
- std::string dir = mkdtemp(tmpl);
- std::string entry = dir + "/temp1_input";
- std::ofstream f{entry};
- f << "1234";
-
- MainLoop loop(
- sdbusplus::bus::new_default(),
- dir,
- dir,
- "xyz.openbmc_project.Testing", "/testing");
-
- auto threadMain = [](auto loop)
- {
- loop->run();
- };
- auto t = std::thread(threadMain, &loop);
-
- runTests(loop);
-
- // Wait for server thread to exit.
- t.join();
- unlink(entry.c_str());
- rmdir(dir.c_str());
-
- return 0;
-}
-
-// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
diff --git a/tools/.gitignore b/tools/.gitignore
new file mode 100644
index 0000000..e46850d
--- /dev/null
+++ b/tools/.gitignore
@@ -0,0 +1,2 @@
+find_callout_path
+find_hwmon
diff --git a/tools/Makefile.am b/tools/Makefile.am
new file mode 100644
index 0000000..e737eed
--- /dev/null
+++ b/tools/Makefile.am
@@ -0,0 +1,19 @@
+noinst_PROGRAMS = find_callout_path find_hwmon
+
+find_callout_path_SOURCES = find_callout_path.cpp
+find_callout_path_LDFLAGS = -static
+find_callout_path_LDADD = \
+ -lstdc++fs \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ ${top_builddir}/sysfs.o
+find_callout_path_CXXFLAGS =
+
+find_hwmon_SOURCES = find_hwmon.cpp
+find_hwmon_LDFLAGS = -static
+find_hwmon_LDADD = \
+ -lstdc++fs \
+ $(SDBUSPLUS_LIBS) \
+ $(PHOSPHOR_LOGGING_LIBS) \
+ ${top_builddir}/sysfs.o
+find_hwmon_CXXFLAGS =
diff --git a/test/find_callout_path.cpp b/tools/find_callout_path.cpp
index 97280fc..97280fc 100644
--- a/test/find_callout_path.cpp
+++ b/tools/find_callout_path.cpp
diff --git a/test/find_hwmon.cpp b/tools/find_hwmon.cpp
index 1142ad1..1142ad1 100644
--- a/test/find_hwmon.cpp
+++ b/tools/find_hwmon.cpp
OpenPOWER on IntegriCloud