// nothing to do.
}
+ dirload_service_set(const dirload_service_set &) = delete;
+
// Construct a dirload_service_set which loads services from the specified directory. The
// directory specified can be dynamically allocated via "new char[...]" (dyn_allocd == true)
// or statically allocated.
-include ../../mconfig
-objects = tests.o test-dinit.o proctests.o test-run-child-proc.o test-bpsys.o
+objects = tests.o test-dinit.o proctests.o loadtests.o test-run-child-proc.o test-bpsys.o
parent_objs = service.o proc-service.o dinit-log.o load-service.o baseproc-service.o
check: build-tests
./tests
./proctests
+ ./loadtests
-build-tests: tests proctests
+build-tests: tests proctests loadtests
# Create an "includes" directory populated with a combination of real and mock headers:
prepare-incdir:
proctests: prepare-incdir $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o
$(CXX) $(SANITIZEOPTS) -o proctests $(parent_objs) proctests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(LDFLAGS)
+
+loadtests: prepare-incdir $(parent_objs) loadtests.o test-dinit.o test-bpsys.o test-run-child-proc.o
+ $(CXX) $(SANITIZEOPTS) -o loadtests $(parent_objs) loadtests.o test-dinit.o test-bpsys.o test-run-child-proc.o $(LDFLAGS)
$(objects): %.o: %.cc
$(CXX) $(CXXOPTS) $(SANITIZEOPTS) -MMD -MP -Iincludes -I../dasynq -c $< -o $@
--- /dev/null
+#include <string>
+#include <iostream>
+#include <cassert>
+
+#include "service.h"
+
+std::string test_service_dir;
+
+void init_test_service_dir()
+{
+ test_service_dir = "./test-services";
+}
+
+void test1()
+{
+ dirload_service_set sset(test_service_dir.c_str());
+ auto t1 = sset.load_service("t1");
+ assert(t1->get_name() == "t1");
+}
+
+#define RUN_TEST(name, spacing) \
+ std::cout << #name "..." spacing; \
+ name(); \
+ std::cout << "PASSED" << std::endl;
+
+int main(int argc, char **argv)
+{
+ init_test_service_dir();
+ RUN_TEST(test1, " ");
+ return 0;
+}
--- /dev/null
+# A comment
+restart = yes # comment at end of setting
+type = internal