about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--cpu.c4
-rw-r--r--filesystem.c4
-rw-r--r--test/Makefile2
-rw-r--r--uname.c4
4 files changed, 7 insertions, 7 deletions
diff --git a/cpu.c b/cpu.c
index d8bed66..f8bc030 100644
--- a/cpu.c
+++ b/cpu.c
@@ -146,8 +146,8 @@ void cpu_collect(scrape_req *req, void *ctx_ptr) {
   }
 }
 
-// exposed only for testing
-
+#ifdef NANO_EXPORTER_TEST
 void cpu_test_override_tick(void *ctx, long tick) {
   ((struct cpu_context *) ctx)->clock_tick = tick;
 }
+#endif // NANO_EXPORTER_TEST
diff --git a/filesystem.c b/filesystem.c
index aa16421..bda569a 100644
--- a/filesystem.c
+++ b/filesystem.c
@@ -159,8 +159,8 @@ static void filesystem_collect(scrape_req *req, void *ctx_ptr) {
   fclose(f);
 }
 
-// exposed only for testing
-
+#ifdef NANO_EXPORTER_TEST
 void filesystem_test_override_statvfs(void *ctx, int (*statvfs_func)(const char *path, struct statvfs *buf)) {
   ((struct filesystem_context *) ctx)->statvfs_func = statvfs_func;
 }
+#endif // NANO_EXPORTER_TEST
diff --git a/test/Makefile b/test/Makefile
index c2bd981..7e9ab3e 100644
--- a/test/Makefile
+++ b/test/Makefile
@@ -31,7 +31,7 @@ $(COLLECTOR_TEST_OBJS): %.o: %.c harness.h mock_scrape.h
 	$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 $(COLLECTOR_TEST_IMPLS): %_test.impl.o: ../%.c stub.h
-	$(CC) $(CFLAGS) $(CPPFLAGS) -include stub.h -c -o $@ $<
+	$(CC) $(CFLAGS) $(CPPFLAGS) -include stub.h -DNANO_EXPORTER_TEST=1 -c -o $@ $<
 
 $(COLLECTOR_TEST_PROGS): %: %.o %.impl.o harness.o mock_scrape.o util.o
 	$(CC) -o $@ $^ $(LDFLAGS) $(LDLIBS)
diff --git a/uname.c b/uname.c
index b5ac849..a9e4ade 100644
--- a/uname.c
+++ b/uname.c
@@ -76,8 +76,8 @@ static void uname_collect(scrape_req *req, void *ctx_ptr) {
   scrape_write(req, "node_uname_info", ctx->labels, 1.0);
 }
 
-// exposed only for testing
-
+#ifdef NANO_EXPORTER_TEST
 void uname_test_override_data(void *ctx, struct utsname *name) {
   uname_set_labels((struct uname_context *) ctx, name);
 }
+#endif // NANO_EXPORTER_TEST