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>
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/tools/find_callout_path.cpp b/tools/find_callout_path.cpp
new file mode 100644
index 0000000..97280fc
--- /dev/null
+++ b/tools/find_callout_path.cpp
@@ -0,0 +1,40 @@
+/**
+ * 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 "../sysfs.hpp"
+
+int main(int argc, char* argv[])
+{
+ if (argc < 2)
+ {
+ std::cerr << "Usage: " << argv[0]
+ << " HWMON_INST_PATH" << std::endl;
+ return 1;
+ }
+
+ try
+ {
+ std::cout << sysfs::findCalloutPath(argv[1]) << '\n';
+ }
+ catch (const std::exception& e)
+ {
+ std::cerr << e.what() << '\n';
+ return 1;
+ }
+ return 0;
+}
+
+// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
diff --git a/tools/find_hwmon.cpp b/tools/find_hwmon.cpp
new file mode 100644
index 0000000..1142ad1
--- /dev/null
+++ b/tools/find_hwmon.cpp
@@ -0,0 +1,40 @@
+/**
+ * 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 "../sysfs.hpp"
+
+int main(int argc, char* argv[])
+{
+ if (argc < 2)
+ {
+ std::cerr << "Usage: " << argv[0]
+ << " DT_REL_BASE_PATH" << std::endl;
+ return 1;
+ }
+
+ try
+ {
+ std::cout << sysfs::findHwmonFromOFPath(argv[1]) << '\n';
+ }
+ catch (const std::exception& e)
+ {
+ std::cerr << e.what() << '\n';
+ return 1;
+ }
+ return 0;
+}
+
+// vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4